httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bill Jones" <>
Subject Re: http protocol tracing?
Date Wed, 08 Sep 1999 00:07:23 GMT
> On Fri, Sep 03, 1999 at 02:26:41PM -0600, BIXBY,MARK HP-Cupertino,ex1" wrote:
>> Is there anything I can turn on within Apache that will log the http
>> protocol between the server and the browser?  Or do I have to add my own
>> code to do this?
> There is no such code in Apache itself (that I know of). Try netcat,
> at <>. It has
> the ability to act as an intermediary between clients and servers on a
> TCP connection, logging the data that go through.

Here is something I've been playing with - Lincoln Stein wrote it originally
(I believe this fragment is his own code. I am not sure anymore as I have
been making my own changes.)  You should be able to add just about any other
protocol stuff.  Note you need tcpdump (or snoop) already setup...


$LIMIT = shift || 5000000;

open (STDIN,"/usr/sbin/tcpdump -lnx -s 1024 dst port 80|");
while (<>) {
    if (/^\S/) {
        last unless $LIMIT--;
        while ($packet=~/(GET|POST|WWW-Authenticate|Authorization).+/g)  {
            print "$client -> $host\t$&\n";
        undef $client; undef $host; undef $packet;
        ($client,$host) = /(\d+\.\d+\.\d+\.\d+).+ > (\d+\.\d+\.\d+\.\d+)/
            if /P \d+:\d+\((\d+)\)/ && $1 > 0;
    next unless $client && $host;
    $packet .= $_;

Just goes to show how easy it is to watch HTTP (and similar protocols.)

-Sneex-  :]

View raw message