[Nix-dev] Perl HTTPS proxy broken?
Jookia
166291 at gmail.com
Tue Dec 29 16:14:51 CET 2015
Hey there,
I've been attempting to package an application written in Perl, though I'm
having issues with it connecting to proxies. I've narrowed it down to a few
problems, using the following test.pl file:
-- 8< --------------------------------------------------------------------------
#!/usr/bin/env perl
use strict;
use warnings;
use LWP::UserAgent;
use HTTP::Request::Common;
my $ua = LWP::UserAgent->new;
my $url = 'https://check.torproject.org/';
$ua->env_proxy;
my $request = GET $url;
my $res = $ua->request($request);
print $res->as_string
-- 8< --------------------------------------------------------------------------
I'd expect my HTTP proxy to be used to connect to a site through HTTPS, but this
happens:
> % nix-shell --pure -p perl perlPackages.MozillaCA perlPackages.LWPUserAgent \
> perlPackages.LWPProtocolHttps
> % https_proxy=http://127.0.0.1:8118 ./test.pl
> HTTP/1.1 200 Connection established
> Client-Date: Tue, 29 Dec 2015 14:22:27 GMT
> Client-Peer: 192.168.100.11:8118
> Client-Response-Num: 1
> Proxy-Agent: Privoxy/3.0.22
With nothing else in the body. Changing the 'https' in the URL in the source
code shows it'll proxy HTTP traffic just fine. Even weirder, this happens:
> % nix-shell --pure -p perl perlPackages.MozillaCA
> perlPackages.LWPProtocolHttps perlPackages.LWPUserAgent
> $ https_proxy=http://192.168.100.11:8118 ./test.pl | head -15
> HTTP/1.1 200 OK
> Connection: close
> Date: Tue, 29 Dec 2015 15:12:38 GMT
> Via: 1.1 check.torproject.org
> Vary: Accept-Encoding
> Content-Type: text/html; charset=utf-8
> Client-Date: Tue, 29 Dec 2015 15:12:31 GMT
> Client-Peer: 38.229.72.22:443
> Client-Response-Num: 1
> Client-Transfer-Encoding: chunked
> Link: </torcheck/img/tor-off.png>; rel="icon"; type="image/x-icon"
> Strict-Transport-Security: max-age=15768000
> Title: Sorry. You are not using Tor.
> X-Meta-Charset: utf-8
> X-Meta-Viewport: width=device-width, initial-scale=1.0
So based on the ordering of the perl packages, the program will either return no
response or **bypass the proxy**. Can anyone else confirm this?
Cheers,
Jookia.
More information about the nix-dev
mailing list