In Part 1 and Part 2 of this series I discussed the tools used to configure WinHttp today, introduced the changes happening for Windows Vista and how to set up proxies. In this post I’m looking at the Tracing settings. Again as a reminder, this is how it is for Windows Vista Beta 2 and it is likely to change some before Vista RTM.

After running netsh and going to the winhttp context, we switch to the tracing context by typing “tracing”:

netsh winhttp>tracing

netsh winhttp tracing>?

The following commands are available:

..

.. (Skipping the inherited commands)

..

Commands in this context:

?              - Displays a list of commands.

config         - Configures WinHTTP tracing parameters.

disable        - Turns off WinHTTP tracing.

dump           - Displays a configuration script.

enable         - Turns on WinHTTP tracing.

help           - Displays a list of commands.

reset          - Resets WinHTTP trace parameters to default.

show           - Displays current tracing parameters.

   

Again the functionality here is similar to the WinHttpTraceCfg.exe tool with the addition of the “dump” command that creates a script with the current tracing settings which can be executed later to restore those settings on the current or another machine.

Let’s look at the current tracing settings:

netsh winhttp tracing>show

WinHTTP trace configuration not set.

   

You can easily disable or enable tracing by just typing “disable” or “enable”:

netsh winhttp tracing>disable

    Tracing is disabled.

   

netsh winhttp tracing>enable 

Current WinHTTP Tracing settings:

    Tracing is enabled.

   

    Trace File Prefix: (none)

    Trace Output: file

    Trace Level:  default (headers and top-level APIs only)

    Network Traffic Format: ansi

    Maximum size of trace file (in bytes): 65535

   

Note that “enable” sets some default tracing parameters.

You can use the “config” command to set some different values:

netsh winhttp tracing>config trace-file-prefix="C:\Temp\Test3" format="ansi" output=debugger level="verbose"

   

    Tracing is updated.

   

Current WinHTTP Tracing settings:

    Tracing is enabled.

   

    Trace File Prefix: C:\Temp\Test3

    Trace Output: debugger

    Trace Level:  verbose (headers, APIs, and entity body)

    Network Traffic Format: ansi

    Maximum size of trace file (in bytes): 65535

   

If you have used WinHttpTraceCfg.exe before you probably noted a slight difference in the parameters. WinHttpTraceCfg.exe uses two parameters, -s and -t, to specify whether or not to trace the payloads (and if included, as Hex or ANSI) and whether or not to include the top level API traces respectively. The config command has a more clear separation by allowing you to specify a level (default – no payloads, verbose - include payloads) and logging format for the network traffic data (Hex or ANSI).

Again, if you need to get a help on a command, just type it with question mark after it.

Next time I will go into a bit more detail about client cert configuration.

-- Nesho Neshev