RE: https and proxy
am 08.03.2005 00:28:27 von worenkdTry
$ENV{HTTPS_PROXY}=3D"127001:5865";
----=
-Original Message-----
From: Luc_Gerard@streamcom [mailto:Luc_Gerar=
d@streamcom]
Sent: Wednesday, March 02, 2005 10:04 AM
To: lib=
www@perlorg
Subject: https and proxy
=
Hello,
I searched on complangperlmodules (and pos=
ted on it ) and the archive
of
this mailing-list to find solution=
s to my current problem.
=0AFirst, some details about my configuration:=
I use Activeperl version
58811 ( last one ) and lwp version 5=
801 on win2k.
=0ASummary: I can't connect to any secure websit=
es The as_string method of
the lwp module returns something like th=
at:
( when I use the connect method )
-----------------
5=
801HTTP/11 200 (OK) Connection established
Via: 11 my_PROXY2=0D=
=0AClient-Date: Wed, 02 Mar 2005 14:28:46 GMT
Client-Peer: 12700=
1:5865
-----------------
and ( when I use the get or pos=
t method )
-----------------
HTTP/10 200 OK
Content-Type:=
text/html
Client-Date: Wed, 02 Mar 2005 14:29:23 GMT
Client-Peer=
: 127001:5865
Client-Response-Num: 1
Refresh: 0; URL=3Dh=
ttps://wwwmywebsitecom/
---------------=
--
I try to connect to secure or non-secure websites via a basic=
proxy (no
authentification),
which forward requests to a MS pro=
xy server ( with NTLM, but that's not
the problem here ).
=
=0AIf I use firefox or Ie to connect to the same secure websites, it works=
successfully and display these.
=0AThe only difference foun=
d ( 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 C=
ONNECT request to the proxy, and then
receive
the webpage content=
.
=0AInstead of that, the lwp module sends the CONNECT method, re=
ceive a 200
connection etablished, and then close connection.
=0AI=
f I try to manually do a second CONNECT request, I got again only the
=
200
Connection etablished status.
=0AIf anyone has som=
e ideas to try to solve this issue, it would be
greatfully
apprec=
iated.
=0AThanks in advance.
=0ALuc
NB: here's a basi=
c demo code.
=0Arequire LWP::UserAgent;
$ua =3D =
LWP::UserAgent->new(redirect =3D> '5');
$ua->proxy('http', 'http://127=
001:5865/');
$ua->proxy('https', 'https://12700=
1:5865/');
$request =3D new HTTP::Request 'CONNECT' =3D>=0D=
=0A'https://wwwsomewebsitecom/';
$response =3D $ua->reques=
t($request);
print $response->as_string;
if ($respons=
e->is_success) {
#print $response->content;
}
else {=
die $response->status_line;
}
=0D=
=0A=
-----------------------------------------
******* ***************=
**********************************************
This e-mail is intended=
only for the addressee named above As this e-mail
may contain con=
fidential or privileged information, if you are not the
named address=
ee, you are not authorised to retain, read, copy or
disseminate this =
message or any part of it.
=0A*****************************************=
***************************