Hello,
I searched on comp.lang.perl.modules (and posted on it ) and the archive of
this mailing-list to find solutions to my current problem.
First, some details about my configuration: I use Activeperl version
5.8.811 ( last one ) and lwp version 5.801 on win2k.
Summary: I can't connect to any secure websites. The as_string method of
the lwp module returns something like that:
( when I use the connect method )
-----------------
5.801HTTP/1.1 200 (OK) Connection established
Via: 1.1 my_PROXY2
Client-Date: Wed, 02 Mar 2005 14:28:46 GMT
Client-Peer: 127.0.0.1:5865
-----------------
and ( when I use the get or post method )
-----------------
HTTP/1.0 200 OK
Content-Type: text/html
Client-Date: Wed, 02 Mar 2005 14:29:23 GMT
Client-Peer: 127.0.0.1:5865
Client-Response-Num: 1
Refresh: 0; URL=https://www.mywebsite.com/
<HTML></HTML>
-----------------
I try to connect to secure or non-secure websites via a basic proxy (no
authentification),
which forward requests to a MS proxy server ( with NTLM, but that's not
the problem here ).
If I use firefox or Ie to connect to the same secure websites, it works
successfully and display these.
The only difference found ( using ethereal ) between the http headers
sent/received by the lwp module and a web browser,
is that the brower send a CONNECT, receive a 200 Connection etablished
status,
and then send back another CONNECT request to the proxy, and then receive
the webpage content.
Instead of that, the lwp module sends the CONNECT method, receive a 200
connection etablished, and then close connection.
If I try to manually do a second CONNECT request, I got again only the 200
Connection etablished status.
If anyone has some ideas to try to solve this issue, it would be greatfully
appreciated.
Thanks in advance.
Luc
N.B: here's a basic demo code.
require LWP::UserAgent;
$ua = LWP::UserAgent->new(redirect => '5');
$ua->proxy('http', 'http://127.0.0.1:5865/');
$ua->proxy('https', 'https://127.0.0.1:5865/');
$request = new HTTP::Request 'CONNECT' => 'https://www.somewebsite.com/';
$response = $ua->request($request);
print $response->as_string;
if ($response->is_success) {
#print $response->content;
}
else {
die $response->status_line;
}