summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/Travel/Status/DE/HAFAS.pm7
-rw-r--r--lib/Travel/Status/DE/HAFAS/Services.pm.PL11
2 files changed, 16 insertions, 2 deletions
diff --git a/lib/Travel/Status/DE/HAFAS.pm b/lib/Travel/Status/DE/HAFAS.pm
index 638b4af..bc274d7 100644
--- a/lib/Travel/Status/DE/HAFAS.pm
+++ b/lib/Travel/Status/DE/HAFAS.pm
@@ -45,6 +45,13 @@ sub new {
if ( $service and $hafas_instance->{$service}{ua_string} ) {
$lwp_options{agent} = $hafas_instance->{$service}{ua_string};
}
+ if ( $service
+ and my $geoip_service = $hafas_instance->{$service}{geoip_lock} )
+ {
+ if ( my $proxy = $ENV{"HAFAS_PROXY_${geoip_service}"} ) {
+ $lwp_options{proxy} = [ [ 'http', 'https' ] => $proxy ];
+ }
+ }
$ua = LWP::UserAgent->new(%lwp_options);
$ua->env_proxy;
}
diff --git a/lib/Travel/Status/DE/HAFAS/Services.pm.PL b/lib/Travel/Status/DE/HAFAS/Services.pm.PL
index f0e1d18..2adaf71 100644
--- a/lib/Travel/Status/DE/HAFAS/Services.pm.PL
+++ b/lib/Travel/Status/DE/HAFAS/Services.pm.PL
@@ -72,6 +72,10 @@ sub load_instance {
$ret{request}{ver} = $data->{options}{version};
}
+ if ( $opt{geoip_lock} ) {
+ $ret{geoip_lock} = $opt{geoip_lock};
+ }
+
if ( $opt{lang} ) {
$ret{request}{lang} = $opt{lang};
}
@@ -182,8 +186,11 @@ my %hafas_instance = (
),
stopfinder => 'https://fahrplan.oebb.at/bin/ajax-getstop.exe',
},
- PKP =>
- { load_instance( 'pl/pkp', lang => 'pol' ), ua_string => 'Dalvik/2.1.0' },
+ PKP => {
+ load_instance( 'pl/pkp', lang => 'pol' ),
+ ua_string => 'Dalvik/2.1.0',
+ geoip_lock => 'PKP'
+ },
Resrobot => { load_instance( 'se/resrobot', lang => 'sve' ), },
RMV => { load_instance( 'de/rmv', lang => 'deu' ), },
RSAG => { load_instance( 'de/rsag', lang => 'deu' ), },