Control: tag -1 + confirmed On Wed, 10 Jun 2015 13:43:59 +0000, Damyan Ivanov wrote:
> Package: libfurl-perl > Version: 3.06-1 > Severity: serious > > libfurl fails to build in an up to date pbuilder chroot, with test failures: > > ... > # Failed test at t/100_low/08_proxy.t line 42. > # got: '1.0 pc1:51242 (HTTP::Proxy/0.303)' > # expected: '1.0 VIA!VIA!VIA!' Same here. I looked into t/100_low/08_proxy.t a bit: First, it only unsets HTTP_PROXY but not http_proxy; after doing that my errors look the same: t/100_low/08_proxy.t .. 1/21 # Failed test at t/100_low/08_proxy.t line 45. # got: '1.0 jadzia:50312 (HTTP::Proxy/0.303)' # expected: '1.0 VIA!VIA!VIA!' The line in 'got' is the default Via header as set by HTTP::Proxy: 118 if (!defined $self->{via}) { 119 $self->{via} = hostname() . ($self->{port} != 80 ? ':' . $self->{port} : '') . " (HTTP::Proxy/$VERSION)"; 120 } but t/100_low/08_proxy.t does set via at the bottom: my $proxy = Test::HTTP::Proxy->new(port => $proxy_port, via => $via); (and with some diag() sprinkled it we see: # via_server: VIA!VIA!VIA! ) And then I don't know what's really going on. Is the request from client-client to client-server not going through server (= proxy) here? But then we wouldn't get the default HTTP::Proxy Via string in the reply. Or is HTTP::Proxy simply ignoring the via attreibute? Data::Dumpering in /usr/share/perl5/HTTP/Proxy.pm: $self before line 118 above: $VAR1 = bless( { 'logmask' => 0, 'daemon' => undef, 'host' => 'localhost', 'max_keep_alive_requests' => 10, 'chunk' => 4096, 'conn' => 0, 'loop' => 1, 'timeout' => 60, 'agent' => undef, 'max_connections' => 0, 'port' => 50085, 'stash' => {}, 'x_forwarded_for' => 1, 'logfh' => *::STDERR }, 'Test::HTTP::Proxy' ); Hm, yeah, no 'via'. But the port is the one requested from t/100_low/08_proxy.t. And the %params hash of the new() constructor still looks as expected: $VAR1 = 'port'; $VAR2 = 50819; $VAR3 = 'via'; $VAR4 = 'VIA!VIA!VIA!'; Ok, this looks like a bug in HTTP::Proxy, maybe in #v+ commit e105876f84220791f2a6b1e64d2a913658c1d269 Author: Slaven Rezic <sla...@rezic.de> Date: Fri Nov 12 11:37:59 2010 +0100 add port to Via header RFC 2616 kind of suggests to add the port to the Via header if it's not the default port: "If the port is not given, it MAY be assumed to be the default port of the received-protocol." This patch sets the port in the generated Via header if it's not the default 80. diff --git a/lib/HTTP/Proxy.pm b/lib/HTTP/Proxy.pm index 1ac10c8..c074d24 100644 --- a/lib/HTTP/Proxy.pm +++ b/lib/HTTP/Proxy.pm @@ -90,7 +90,6 @@ sub new { port => 8080, stash => {}, timeout => 60, - via => hostname() . " (HTTP::Proxy/$VERSION)", x_forwarded_for => 1, ); @@ -116,6 +115,10 @@ sub new { $self->{$_} = exists $params{$_} ? delete( $params{$_} ) : $defaults{$_} for keys %defaults; + if (!defined $self->{via}) { + $self->{via} = hostname() . ($self->{port} != 80 ? ':' . $self->{port} : '') . " (HTTP::Proxy/$VERSION)"; + } + # choose an engine with the remaining parameters $self->{engine} = HTTP::Proxy::Engine->new( %params, proxy => $self ); $self->log( PROXY, "PROXY", "Selected engine " . ref $self->{engine} ); #v- And here we are: Adding "via => undef" to the %defaults hash in /usr/share/perl5/HTTP/Proxy.pm fixes the issue. Does this make sense? Someone please sanity-check :) Cheers, gregor -- .''`. Homepage: http://info.comodo.priv.at/ - OpenPGP key 0xBB3A68018649AA06 : :' : Debian GNU/Linux user, admin, and developer - https://www.debian.org/ `. `' Member of VIBE!AT & SPI, fellow of the Free Software Foundation Europe `- NP: Willie Nelson: Bonaparte's Retreat
signature.asc
Description: Digital Signature