John Klar <[EMAIL PROTECTED]> writes:
> I got one report that the $p_auth scalar should be unescaped also. His
> username has embedded '\'.
Good catch. Seems like a good idea to just reuse the code from the
authorization_basic() hack. The patch now looks like:
Index: lib/LWP/Protocol/http.pm
===================================================================
RCS file: /cvsroot/libwww-perl/lwp5/lib/LWP/Protocol/http.pm,v
retrieving revision 1.50
retrieving revision 1.52
diff -u -p -d -u -r1.50 -r1.52
--- lib/LWP/Protocol/http.pm 2000/05/24 09:41:13 1.50
+++ lib/LWP/Protocol/http.pm 2001/04/05 15:08:33 1.52
@@ -1,5 +1,5 @@
#
-# $Id: http.pm,v 1.50 2000/05/24 09:41:13 gisle Exp $
+# $Id: http.pm,v 1.52 2001/04/05 15:08:33 gisle Exp $
package LWP::Protocol::http;
@@ -60,7 +60,7 @@ sub _get_sock_info
sub _fixup_header
{
- my($self, $h, $url) = @_;
+ my($self, $h, $url, $proxy) = @_;
$h->remove_header('Connection'); # need support here to be useful
@@ -76,8 +76,19 @@ sub _fixup_header
if (defined($1) && not $h->header('Authorization')) {
require URI::Escape;
$h->authorization_basic(map URI::Escape::uri_unescape($_),
- split(":", $1));
+ split(":", $1, 2));
}
+
+ if ($proxy) {
+ # Check the proxy URI's userinfo() for proxy credentials
+ # export http_proxy="http://proxyuser:proxypass@proxyhost:port"
+ my $p_auth = $proxy->userinfo();
+ if(defined $p_auth) {
+ require URI::Escape;
+ $h->proxy_authorization_basic(map URI::Escape::uri_unescape($_),
+ split(":", $p_auth, 2))
+ }
+ }
}
@@ -141,7 +152,7 @@ sub request
if defined($$cont_ref) && length($$cont_ref);
}
- $self->_fixup_header($h, $url);
+ $self->_fixup_header($h, $url, $proxy);
my $buf = $request_line . $h->as_string($CRLF) . $CRLF;
my $n; # used for return value from syswrite/sysread