davecheney / httpstat

It's like curl -v, with colours.
MIT License
6.95k stars 382 forks source link

Use httptrace WroteHeaders instead of WroteRequest #102

Closed moorereason closed 7 years ago

moorereason commented 7 years ago

When POSTing a large request, the TLS Handshake timings become very skewed. Using WroteHeaders is about the best we can do for now until httptrace adds additional hooks.

davecheney commented 7 years ago

Good idea.

moorereason commented 7 years ago

For the record:

$ echo -n 'file=' > testfile && base64 -w 0 httpstat >>testfile
$ ./httpstat -d @testfile -X POST https://requestb.in/11pbuek1                                                           

Connected to 104.31.87.204:443

HTTP/2.0 200 OK
Server: cloudflare-nginx
Cf-Ray: 2ead41a3dc571159-DFW
Content-Type: text/html; charset=utf-8
Date: Sat, 01 Oct 2016 04:44:09 GMT
Set-Cookie: __cfduid=d3d76a938181f75eb2bf9d9438d1379aa1475297048; expires=Sun, 01-Oct-17 04:44:08 GMT; path=/; domain=.requestb.in; HttpOnly
Sponsored-By: https://www.runscope.com
Via: 1.1 vegur

Body discarded

  DNS Lookup   TCP Connection   TLS Handshake   Server Processing   Content Transfer
[     18ms  |          16ms  |      13407ms  |           1726ms  |             0ms  ]
            |                |               |                   |                  |
   namelookup:18ms           |               |                   |                  |
                       connect:35ms          |                   |                  |
                                   pretransfer:13443ms           |                  |
                                                     starttransfer:15169ms          |
                                                                                total:15170ms  
$ ./httpstat-wroteheaders -d @testfile -X POST https://requestb.in/11pbuek1                                                                                                               

Connected to 104.31.86.204:443

HTTP/2.0 200 OK
Server: cloudflare-nginx
Cf-Ray: 2ead4297f9671fb8-DFW
Content-Type: text/html; charset=utf-8
Date: Sat, 01 Oct 2016 04:44:49 GMT
Set-Cookie: __cfduid=db110dc6a7ba3c0a4f3618f4a757f301a1475297087; expires=Sun, 01-Oct-17 04:44:47 GMT; path=/; domain=.requestb.in; HttpOnly
Sponsored-By: https://www.runscope.com
Via: 1.1 vegur

Body discarded

  DNS Lookup   TCP Connection   TLS Handshake   Server Processing   Content Transfer
[     17ms  |          12ms  |        137ms  |          15898ms  |             0ms  ]
            |                |               |                   |                  |
   namelookup:17ms           |               |                   |                  |
                       connect:29ms          |                   |                  |
                                   pretransfer:166ms             |                  |
                                                     starttransfer:16064ms          |
                                                                                total:16065ms