How do I do a network trace of Subversion client/server interaction?

Use Wireshark (formerly known as "Ethereal") to eavesdrop on the conversation.

First, make sure that between captures within the same wireshark session, you hit Clear, otherwise filters from one capture (say, an HTTP capture) might interfere with others (say, an ra_svn capture).

Assuming you're cleared, then:

  1. From the Capture menu, choose Capture Filters.
  2. If debugging the http:// (WebDAV) protocol, then in the window that pops up, choose "HTTP TCP port (80)", which should result in the filter string tcp port http. If debugging the svn:// (ra_svn) protocol, then choose New, give the new filter a name (say, "ra_svn"), and type "tcp port 3690" into the filter string box. When done, click OK.
  3. Again go to the Capture menu, this time choose Interfaces, and click Options next to the appropriate interface (probably you want interface "lo", for "loopback", assuming the server will run on the same machine as the client).
  4. Turn off promiscuous mode by unchecking the appropriate checkbox.
  5. Click the Start button in the lower right to start the capture.
  6. Run your Subversion client.
  7. Click the Stop icon (a red X over an ethernet interface card) when the operation is finished (or Capture+Stop should work). Now you have a capture. It looks like a huge list of lines.
  8. Click on the Protocol column to sort.
  9. Click on the first relevant line to select it; usually this is just the first line.
  10. Right-click and choose Follow TCP Stream. You'll be presented with the request/response pairs of the Subversion client's HTTP conversion.

These instructions are specific to the graphical version of Wireshark (version 0.99.6), and don't apply to the command-line version known as "tshark" (which corresponds to "tethereal", from back when Wireshark was called Ethereal).

Alternatively, you may set the neon-debug-mask parameter in your servers configuration file to cause neon's debugging output to appear when you run the svn client. The numeric value of neon-debug-mask is a combination of the NE_DBG_... values in the header file ne_utils.h. For current versions of neon, setting neon-debug-mask to 130 (i.e. NE_DBG_HTTP+NE_DBG_HTTPBODY) will cause the HTTP data to be shown.

You may well want to disable compression when doing a network trace - see the http-compression parameter in the servers configuration file.

Another alternative is to set up a logging proxy between the Subversion client and server. A simple way to do this is to use the socat program. For example, to log communication with an svnserve instance, run the following command:

socat -v TCP4-LISTEN:9630,reuseaddr,fork TCP4:localhost:svn

Then run your svn commands using a URL base of svn://127.0.0.1:9630/; socat will forward the traffic from port 9630 to the normal svnserve port (3690), and will print all traffic in both directions to a standard error, prefixing it with < and > signs to show the direction of the traffic.