Skip Menu |

This queue is for tickets about the HTTP-ProxyPAC CPAN distribution.

Report information
The Basics
Id: 51449
Status: resolved
Priority: 0/
Queue: HTTP-ProxyPAC

People
Owner: MACKENNA [...] cpan.org
Requestors: gml4410 [...] gsk.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Bug in HTTP-ProxyPAC v0.01
Date: Wed, 11 Nov 2009 17:04:30 +0000
To: bug-HTTP-ProxyPAC [...] rt.cpan.org
From: "Gordon M Lack" <gml4410 [...] gsk.com>
I notice that it copies the protocol from the requested URI. So if http://my.example.com/ results in a proxy of http://my.proxy.com:800/ then https://my.example.com/ results in a proxy of https://my.proxy.com:800/ and ftp://my.example.com/ results in a proxy of ftp://my.proxy.com:800/ But that can't work as you can't run http, https and ftp on the same port+system! I think it would be better to force the proxy protocol to always be http rather than copying the request protocol. Here's a patch: --- lib/HTTP/ProxyPAC/Result.pm.orig 2006-05-25 03:05:27.000000000 +0100 +++ lib/HTTP/ProxyPAC/Result.pm 2009-11-11 17:01:09.380176000 +0000 @@ -19,7 +19,9 @@ if ($self->{type} ne 'DIRECT') { my $proxy = URI->new; - $proxy->scheme($url->scheme); # same scheme as the target host +# Proxy will use HTTP regardless of request scheme +# $proxy->scheme($url->scheme); # same scheme as the target host + $proxy->scheme('http'); $proxy->host_port($string); $self->{lc($self->{type})} = $proxy; ----------------------------------------------------------- This e-mail was sent by GlaxoSmithKline Services Unlimited (registered in England and Wales No. 1047315), which is a member of the GlaxoSmithKline group of companies. The registered address of GlaxoSmithKline Services Unlimited is 980 Great West Road, Brentford, Middlesex TW8 9GS. -----------------------------------------------------------
In version 0.2 I may simply omit the scheme from the returned value. It should always contain a port number, but recommendations on the Web indicate that the port should not be a standard one. Since the underlying FindProxyForURL function does not provide a scheme, it is presumptive for its wrapper to do so. On Wed Nov 11 12:07:18 2009, gml4410@gsk.com wrote: Show quoted text
> I notice that it copies the protocol from the requested URI. > > So if http://my.example.com/ results in a proxy of > http://my.proxy.com:800/ > > then > > https://my.example.com/ results in a proxy of > https://my.proxy.com:800/ > and > ftp://my.example.com/ results in a proxy of ftp://my.proxy.com:800/ > > > But that can't work as you can't run http, https and ftp on the same > port+system! > > I think it would be better to force the proxy protocol to always be > http rather than copying the > request protocol. > > Here's a patch: > > > --- lib/HTTP/ProxyPAC/Result.pm.orig 2006-05-25 03:05:27.000000000 > +0100 > +++ lib/HTTP/ProxyPAC/Result.pm 2009-11-11 17:01:09.380176000 +0000 > @@ -19,7 +19,9 @@ > > if ($self->{type} ne 'DIRECT') { > my $proxy = URI->new; > - $proxy->scheme($url->scheme); # same scheme as the target > host > +# Proxy will use HTTP regardless of request scheme > +# $proxy->scheme($url->scheme); # same scheme as the target > host > + $proxy->scheme('http'); > $proxy->host_port($string); > > $self->{lc($self->{type})} = $proxy; > > ----------------------------------------------------------- > This e-mail was sent by GlaxoSmithKline Services Unlimited > (registered in England and Wales No. 1047315), which is a > member of the GlaxoSmithKline group of companies. The > registered address of GlaxoSmithKline Services Unlimited > is 980 Great West Road, Brentford, Middlesex TW8 9GS. > ----------------------------------------------------------- >
Mr. Luck was exactly right in his bug report, and all proxy results will include http as the scheme in version 0.2. The document that convinced me was this sequence in a 1995 web page about setting environment variables: #!/bin/sh http_proxy="http://your.proxy.server:8080/"; export http_proxy ftp_proxy="http://your.proxy.server:8080/"; export ftp_proxy gopher_proxy="http://your.proxy.server:8080/"; export gopher_proxy wais_proxy="http://your.proxy.server:8080/"; export wais_proxy cmac