$| = 1; near the beginning of your program to unbuffer STDOUT so that when you send output, it gets passed to the Web server immediately. 13.7 cgi-test Let’s add to our black bag the following script: #!/usr/bin/perl -Tw use strict; print “Content-type: text/plainnn”; print “$_: $ENV{$_}n” for sort keys %ENV; print “nInput:n”; print ; Use this whenever you have doubts about what a form is really sending to the server. Just make this script the target of the form action, and you’ll get a terse dump of the environment variables and any content that the form sent via POST. 13.8 Eavesdropping Sometimes you’d just like to listen in on the conversation between a browser and a server, like a gossip-hungry neighbor on a party line. Perhaps you’re dealing with browsers whose caching behavior is questionable, and you don’t want to guess what’s really being fetched. You could use a connection-sniffing tool like tcpdump to monitor the traffic between the client and the server, but this generally requires superuser access to put the network interface into “promiscuous” mode. So try instead our proxylog tool: #!/usr/bin/perl -w use strict; use Getopt::Std; use IO::Socket; use IO::Select; sub usage { <<"EndUsage"; $0 lets you snoop on the conversation between a client and server. $0 -i clientport -o serverhost:port [-1] [-v] -i incoming port to listen to -o outgoing port to make connection to -1 only process one client request, then exit -v verbose Caveats:
Note: If you are looking for cheap and reliable provider to host and run your servlet application check Vision servlet hosting services
This entry was posted
on Friday, November 3rd, 2006 at 2:15 pm and is filed under perl.
You can follow any responses to this entry through the RSS 2.0 feed.
Responses are currently closed, but you can trackback from your own site.