Re: HTTP proxy authentication

[email protected]
Newsgroups gmane.comp.lang.perl.modules.lwp
Organization http://groups.google.com
Message-ID <[email protected]>
Hi,

I am using the following program to access a HTTPS link through proxy.
Proxy Authentication is required. So, I am specifying the values as
shown below (passwd changed but similar in format):

================================================
#!/usr/bin/perl -w
use strict;
$|++;

use LWP::UserAgent;
use LWP::Debug qw(+);

my $ua = LWP::UserAgent->new;
$ua->proxy(['https'], 'http://x52635:[email protected]:1080');

my $req = HTTP::Request->new(GET => 'https://mail.yahoo.com/');
my $res = $ua->request($req);
if ($res->is_success) {
    print $res->as_string;
}
else {
    print "Failed: ", $res->status_line, "\n";
}
================================================
I am not able to get through. It returns "400 bad Request".
Though, if I only change the link 'https://mail.yahoo.com/' to
'http://mail.yahoo.com/', it gets through.
Please help...
The output of the program is as below:
LWP::UserAgent::new: ()
LWP::UserAgent::proxy: ARRAY(0x225524)
http://x52635:[email protected]:1080
LWP::UserAgent::proxy: http
http://x52635:[email protected]:1080

LWP::UserAgent::proxy: https
http://x52635:[email protected]:1080
LWP::UserAgent::request: ()
LWP::UserAgent::send_request: GET https://mail.yahoo.com/
LWP::UserAgent::_need_proxy: Proxied to
http://x52635:[email protected]:1080
LWP::Protocol::http::request: ()
LWP::Protocol::collect: read 862 bytes
LWP::Protocol::collect: read 1716 bytes
LWP::UserAgent::request: Simple response: Bad Request
Failed: 400 Bad Request
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.