Commit 12888c2c authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

StopFinder: Re-use HAFAS.pm User Agent if possible

parent 01da3afd
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -118,6 +118,7 @@ sub new {
		exclusive_mots => $conf{exclusive_mots},
		excluded_mots  => $conf{excluded_mots},
		station        => $conf{station},
		ua             => $ua,
		post           => {
			input => $conf{station},
			date  => $date,
@@ -253,6 +254,7 @@ sub similar_stops {
		my $sf = Travel::Status::DE::HAFAS::StopFinder->new(
			url   => $hafas_instance{$service}{stopfinder},
			input => $self->{station},
			ua    => $self->{ua},
		);
		if ( my $err = $sf->errstr ) {
			$self->{errstr} = $err;
+6 −5
Original line number Diff line number Diff line
@@ -17,12 +17,13 @@ sub new {
	my ( $obj, %conf ) = @_;

	my $lang = $conf{language} // 'd';
	my $ua = $conf{ua};

	if ( not $ua ) {
		my %lwp_options = %{ $conf{lwp_options} // { timeout => 10 } };

	my $ua = LWP::UserAgent->new(%lwp_options);

		$ua = LWP::UserAgent->new(%lwp_options);
		$ua->env_proxy;
	}

	my $reply;