Harald Wopenka wrote:
Hi there!
I wanted to watch the communication between browser and server and found
that nice ProxyMod-Module. But for some reason it doesnt work.
This is the code:
use Net::ProxyMod;
$p = Net::ProxyMod->new("172.16.3.1", 8080, "", 0, 1);
$p->get_conn(\&infunc,\&outfunc);
sub infunc
{
my($data) = @_;
print "IN: '$data'\n";
return($data);
}
sub outfunc
{
my($data) = @_;
print "OUT: '$data'\n";
return($data);
}
And this is the output:
C:\temp>proxytest.pl
Started server at 172.16.3.1:8080
Connect from 172.16.3.1:1357
Connecting to 172.16.3.1:8080
Connect from 172.16.3.1:1358
Connecting to 172.16.3.1:8080
Connect from 172.16.3.1:1359
Connecting to 172.16.3.1:8080
There is nothing else - the browser times out after a while. It doesnt
matter which IP I use for the proxy (172.16.3.1, 127.0.0.1, localhost) - its
always the same :(
Does anyone have any idea what could be wrong?
I am on 5.6.1 not 5.8 (which may have better forking).
I was able to get it to work for a while before crashing Perl. THe
module is for UNIX and uses fork etc. I would try instead to use
something like httpsniffer:
http://www.schmerg.com/WrapUp.asp?file=HttpSniffer.html
This was my test script (I used a specific 2nd IP addr and dumpit is a
routine of mine to hex-ascii-dump the data to my log file) - you don't
want to write the stuff to STDOUT because it will end up at the browser.
It crashed after the HTML output working on images that were on the test
page.
use strict;
use Net::ProxyMod;
$| = 1; binmode STDOUT;
select ((select (STDIN), $| = 1)[0]); binmode STDIN;
# using a logfile to prevent getting output mixed with browser info
open LOG, ">c:/tmp/dbg.log";
select ((select (LOG), $| = 1)[0]); binmode LOG;
my $p = Net::ProxyMod->new("127.0.0.1", 8080, "127.0.0.1", 80, 1);
$p->get_conn(\&infunc, \&outfunc);
sub infunc {
my $data = shift;
print LOG "IN: \n";
dumpit ($data, \*LOG);
return $data;
}
sub outfunc {
my $data = shift;
print LOG "OUT: \n";
dumpit ($data, \*LOG);
return $data;
}
__END__
--
,-/- __ _ _ $Bill Luebkert ICQ=162126130
(_/ / ) // // DBE Collectibles Mailto:[EMAIL PROTECTED]
/ ) /--< o // // http://dbecoll.tripod.com/ (Free site for Perl)
-/-' /___/_<_</_</_ Castle of Medieval Myth & Magic http://www.todbe.com/
_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs