[prev in list] [next in list] [prev in thread] [next in thread] 

List:       perl-win32-web
Subject:    Proxy & HTTP
From:       "K Andrew" <andrew () mail ! dgu ! ru>
Date:       2002-12-25 13:51:45
[Download RAW message or body]

Hi, All !!!

I want to get connention to some host through 2 proxies.
Perl code :

-----------------------------------------

#!e:/perl/bin/perl

use Socket;

$PROXY = '194.190.250.23';#first proxy
$PORT = 80;

$cont =
          "GET http://www.yahoo.com HTTP/1.1\n".
          "Host: www.yahoo.com\n".
          "Content-type: application/x-www-form-urlencoded\n".
          "Accept: */*\n".
          "Referer: www.somehost.com\n".
          "Connection: Keep-Alive\n\n";

 socket(SH, PF_INET, SOCK_STREAM, getprotobyname('tcp'));
 connect(SH, sockaddr_in ($PORT, inet_aton($PROXY))) or {print
"Error",die()};
 select(SH);
 $| = 1;

 binmode SH;


 print SH "POST http://194.213.51.100:3128
HTTP/1.1\n".#194.213.51.100:3128 - second proxy
          "Host: 194.213.51.100:3128\n".
          "Accept: */*\n".
          "Referer: www.somehost.com\n",
          "Content-type: application/x-www-form-urlencoded\n",
          "Content-Length: ".length($cont)."\n\n";

 print SH $cont;

select(STDOUT);

print "Content-Type: text/html\n\n";

 while(<SH>){
  print $_;
 }

close(SH);

-----------------------------------------

But the second proxy response :

ERROR
The requested URL could not be retrieved

----------------------------------------------------------------------------
----

While trying to retrieve the URL: /

The following error was encountered:

  a.. Invalid URL
Some aspect of the requested URL is incorrect. Possible problems:

  a.. Missing or incorrect access protocol (should be `http://'' or similar)
  b.. Missing hostname
  c.. Illegal double-escape in the URL-Path
  d.. Illegal character in hostname; underscores are not allowed
Your cache administrator is webmaster.



----------------------------------------------------------------------------
----
Generated Wed, 25 Dec 2002 13:42:29 GMT by wwwftp.trionet.cz
(Squid/2.3.STABLE4-hno.CVS)


Request to 2-nd proxy not working. How to make right request to a second
proxy ?

_______________________________________________
Perl-Win32-Web mailing list
Perl-Win32-Web@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic