Go4Expert

Go4Expert (http://www.go4expert.com/)
-   Perl (http://www.go4expert.com/articles/perl-tutorials/)
-   -   Proxy using Perl (http://www.go4expert.com/articles/proxy-using-perl-t1130/)

alfa 3Jul2009 02:58

Re: Proxy using Perl
 
Thank you Mr.Pradeep for perl proxy.. Um using ur code for a project. We suppose to analyze the request from the browser before it reach the proxy..problem is we need to forward the web request to the Squid proxy running in the localhost in port 3128 (default)..i have tried many things, but unable to reach a perfect output.? could anyone help...

Thanks in advance..
alfa

pradeep 3Jul2009 10:01

Re: Proxy using Perl
 
Try this http://search.cpan.org/~book/HTTP-Pr.../HTTP/Proxy.pm

alfa 3Jul2009 20:17

Re: Proxy using Perl
 
thank u very for ur quick reply Mr.Pradeep..prevsly i tried that method (HTTP::Proxy)..but i need to see the request and file types send by the browser so ur code was well suited for that purpose..then i edited ur code to achive my target..
ur code was
$host = IO::Socket::INET->new (
PeerAddr=> $uri->host,
PeerPort=> $uri->port);

my Squid is running in localhost port 3128 so i replaced above like this
$host = IO::Socket::INET->new (
PeerAddr=> "127.0.0.1",
PeerPort=> 3128);

i didnt changed anything then i run the code and configure the browser proxy for 0.0.0.0:8080 i got the reply from Squid but only error messages like Ileagal URL,..so i hope the request is going to Squid..but not the full URL is writen to Squid..coz some times error messages shows
When trying to retrive the URL:/webhp?hl=en ..

i didnt clearly understand the following part
/////////////////////////////////////////
binmode host

print $host "$method ".$uri->path_query." $httpVer\n";
print "$method ".$uri->path_query." $httpVer\n";
next;
////////////////////////////////////////////

i think this is the portion where u writing the request to socket..if i could write the full request here then i hope i can send the full URL to SQUID..
Any suggestions.. to do that

Thank u very


All times are GMT +5.5. The time now is 10:27.