davecheney / httpstat

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

Break out each leg of 30x redirect chain #86

Closed moorereason closed 7 years ago

moorereason commented 7 years ago

Fixes #83

moorereason commented 7 years ago

Without redirects enabled:

$ go run main.go https://google.com

Connected to 216.58.218.110:443

HTTP/2.0 301 Moved Permanently
Server: gws
Alt-Svc: quic=":443"; ma=2592000; v="36,35,34,33,32"
Cache-Control: public, max-age=2592000
Content-Length: 220
Content-Type: text/html; charset=UTF-8
Date: Wed, 28 Sep 2016 04:50:07 GMT
Expires: Fri, 28 Oct 2016 04:50:07 GMT
Location: https://www.google.com/
X-Frame-Options: SAMEORIGIN
X-Xss-Protection: 1; mode=block

  DNS Lookup   TCP Connection   TLS Handshake   Server Processing   Content Transfer
[     40ms  |          18ms  |        120ms  |             42ms  |             0ms  ]
            |                |               |                   |                  |
   namelookup:40ms           |               |                   |                  |
                       connect:59ms          |                   |                  |
                                   pretransfer:180ms             |                  |
                                                     starttransfer:222ms            |
                                                                                total:223ms    
moorereason commented 7 years ago

Redirects enabled:

$ go run main.go -L https://google.com

Connected to 216.58.218.110:443

HTTP/2.0 301 Moved Permanently
Server: gws
Alt-Svc: quic=":443"; ma=2592000; v="36,35,34,33,32"
Cache-Control: public, max-age=2592000
Content-Length: 220
Content-Type: text/html; charset=UTF-8
Date: Wed, 28 Sep 2016 04:50:16 GMT
Expires: Fri, 28 Oct 2016 04:50:16 GMT
Location: https://www.google.com/
X-Frame-Options: SAMEORIGIN
X-Xss-Protection: 1; mode=block

  DNS Lookup   TCP Connection   TLS Handshake   Server Processing   Content Transfer
[     16ms  |          14ms  |        103ms  |             39ms  |             0ms  ]
            |                |               |                   |                  |
   namelookup:16ms           |               |                   |                  |
                       connect:31ms          |                   |                  |
                                   pretransfer:134ms             |                  |
                                                     starttransfer:173ms            |
                                                                                total:173ms    

Connected to 216.58.218.100:443

HTTP/2.0 200 OK
Server: gws
Alt-Svc: quic=":443"; ma=2592000; v="36,35,34,33,32"
Cache-Control: private, max-age=0
Content-Type: text/html; charset=ISO-8859-1
Date: Wed, 28 Sep 2016 04:50:16 GMT
Expires: -1
P3p: CP="This is not a P3P policy! See https://www.google.com/support/accounts/answer/151657?hl=en for more info."
Set-Cookie: NID=87=l76zr1yiWj1Rft8SHc-V694xKqfIA7_SIHGHi5HbSebw9TF07-OPk3udcOHM_KP14K9HqGCBphgcPZk_C_55G9uWdDyCVhta-XXpTYC1WhMRVMGwczv6HAt2JJjG2uHNy8QBwM-Zycqblg; expires=Thu, 30-Mar-201
7 04:50:16 GMT; path=/; domain=.google.com; HttpOnly
X-Frame-Options: SAMEORIGIN
X-Xss-Protection: 1; mode=block

Body discarded

  DNS Lookup   TCP Connection   TLS Handshake   Server Processing   Content Transfer
[     41ms  |          14ms  |         37ms  |             57ms  |             1ms  ]
            |                |               |                   |                  |
   namelookup:41ms           |               |                   |                  |
                       connect:56ms          |                   |                  |
                                   pretransfer:93ms              |                  |
                                                     starttransfer:151ms            |
                                                                                total:152ms    
davecheney commented 7 years ago

Nice. I didn't realise it would be that easy.