Skip to content

Commit

Permalink
usingcurl/verbose/trace.md: add --trace-config and --trace-ids
Browse files Browse the repository at this point in the history
Fixes #329
Addresses half of #326
Closes #349
  • Loading branch information
bagder committed Dec 16, 2023
1 parent a1b2931 commit eed3eeb
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 4 deletions.
2 changes: 2 additions & 0 deletions index-words
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@
--tr-encoding
--trace
--trace-ascii
--trace-config
--trace-ids
--trace-time
--url-query
--variable
Expand Down
53 changes: 49 additions & 4 deletions usingcurl/verbose/trace.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,11 @@ first lines of tracing look like:
<= Recv header, 31 bytes (0x1f)
0000: Cache-Control: max-age=604800

## --trace-time
## Time stamps

This options prefixes all verbose/trace outputs with a high resolution timer
for when the line is printed. It works with the regular `-v / --verbose`
option as well as with `--trace` and `--trace-ascii`.
The `--trace-time` option prefixes all verbose/trace outputs with a high
resolution timer for when the line is printed. It works with the regular `-v /
--verbose` option as well as with `--trace` and `--trace-ascii`.

An example could look like this:

Expand All @@ -83,3 +83,48 @@ An example could look like this:
The lines are all the local time as hours:minutes:seconds and then number of
microseconds in that second.

## Identify transfers and connections

As the trace information flow showing on screen or to a file using these
options is a continuous stream even though your command line might make curl
use a large number of separate connections and different transfers, there are
times when you want to see to which specific transfers or connections the
various information below to. To better understand the trace output.

You can then add `--trace-ids` to the line and you will see how curl adds two
numbers to all tracing: the connection number and the transfer number. They
are two separate identifiers because connections can be reused and multiple
transfers can use the same connection.

## More data

If the amount of tracing data is not enough. Like when you suspect and want to
debug a problem in a more fundamental lower protocol level, curl provides the
`--trace-config` option for you.

With this option you tell curl to also include logging about components that
it otherwise does not include by default. Such as details about TLS, HTTP/2 or
HTTP/3 protocol bits. It also has convenience options for adding the
connection and transfers identifiers and time stamps.

The `--trace-config` option accepts an argument where you specify a
comma-separated list with the areas you want it to trace. For example, include
identifiers and show me HTTP/2 details:

curl --trace-config ids,http/2 https://example.com

The exact set of ares will vary, but here are some ones to try:

| area | description |
|----------|-------------------------------------------------|
| `ids` | the same identifiers as `--trace-ids` provides |
| `time` | the same time output as `--trace-time` provides |
| `all` | show everything possible |
| `tls` | TLS protocol exchange details |
| `http/2` | HTTP/2 frame information |
| `http/3` | HTTP/3 frame information |
| `*` | additional ones in future versions |

Doing a quick run with `all` is often a good way to get to see which specific
areas that are shown, as then you can do follow-up runs with more specific
areas set.

0 comments on commit eed3eeb

Please sign in to comment.