A proposal for an HTTP stream capture mechanism
Max (Weijun) Wang
Weijun.Wang at Sun.COM
Thu Apr 23 07:33:01 PDT 2009
Hi Jessie
This is very useful.
What kind of info are dumped? Content and/or headers?
Can you also capture the connection info? Sometimes I need to know if
a new connection is created or the old one is reused.
The \. in sun\.com looks a little cumbersome. I know .hgignore
supports several different pattern matching mechanisms, probably worth
a look?
Thanks
Max
On Apr 23, 2009, at 10:02 PM, Jean-Christophe Collet wrote:
> I have been working on adding better logging and debugging tools to
> the HTTP implementation.
> A significant chunk of the bugs that we have to investigate are HTTP
> related and being able to monitor the traffic has always been a
> problem. Using a packet sniffer is cumbersome and not always possible.
> So I have been putting together a prototype to make that a lot
> easier. The idea is to be able to turn on traffic capture with a
> system property and a simple "rule" file.
>
> The idea is that you can specify a set of capture rules in a file
> and point to that file with the property 'sun.net.http.captureRules'
> The rule file has a simple syntax. 1 rule per line. A line starting
> with a '#' is a comment and is ignored. A rule is a comma separated
> pair regular-expression , file pattern.
> e.g.:
>
> http://www\.sun\.com , sun%d.log
>
> tells to capture traffic for all URLs containing http://www.sun.com
> and to dump that traffic into a file sunxxxxxx.log (the xxxxxx is a
> randomly generated number that ensures the created file doesn't
> overwrite an existing one. Of course that '%d' is optional. If the
> files exist, then every capture is appended to it (which might not
> be a good idea in case of multiple parallel threads).
>
> So to capture all the traffic into a single file, the rule would be:
>
> .* , http.log
>
> A usage example becomes:
>
> $ java -Dsun.net.http.captureRules=capture-rules GetURL http://www.sun.com
>
> where 'capture-rules' is the file containing my set of rules.
>
> I have a first prototype of this working but I'm still refining it.
> I'll publish a webrev in a few days.
>
> Comments?
>
>
>
More information about the net-dev
mailing list