httpstat
httpstat copied to clipboard
Appending the redirect urls stats.
The following changes are done to append the redirect urls stats to the output.
- [x] Added a new -L option analogous to the curl -L option to follow redirects and print the stats.
- [x] Changed the code formatting and created new functions run_command, print_stats and run_command_and_print_stats.
- [x] Appended keys http_code and redirect_curl to the curl format.
- [x] Added a while loop to print the stats if follow redirects (-L) option is used.
Sample output:
HTTP/1.1` 302 Found
Cache-Control: private
Content-Type: text/html; charset=UTF-8
Location: http://www.google.co.in/?gfe_rd=cr&ei=CQPyV8-SBuuK8QeBy7LgCg
Content-Length: 261
Date: Mon, 03 Oct 2016 07:04:41 GMT
Body stored in: /tmp/tmpWV9fJm
DNS Lookup TCP Connection Server Processing Content Transfer
[ 0.061ms | 0.068ms | 0.076ms | 0.0ms ]
| | | |
namelookup:0.061ms | | |
connect:0.129ms | |
starttransfer:0.205ms |
total:0.205ms
HTTP/1.0 200 OK
Date: Mon, 03 Oct 2016 07:04:41 GMT
Expires: -1
Cache-Control: private, max-age=0
Content-Type: text/html; charset=ISO-8859-1
P3P: CP="This is not a P3P policy! See https://www.google.com/support/accounts/answer/151657?hl=en for more info."
Server: gws
X-XSS-Protection: 1; mode=block
X-Frame-Options: SAMEORIGIN
Set-Cookie: NID=87=KaRf8ZB11GmdE6rn1GjaGNDxO2qL4KPYZfQbNpgHns9wbhBM-Xw3wwioSN14tf3RdRFEcvFFqZdEsn1M9I_qV6Ds8fF40Z6j5w_gm_Ay7yqRlGwVj2ymZPppIGTw16Rx; expires=Tue, 04-Apr-2017 07:04:41 GMT; path=/; domain=.google.co.in; HttpOnly
Accept-Ranges: none
Vary: Accept-Encoding
X-Cache: MISS from localhost
X-Cache-Lookup: MISS from localhost:8080
Via: 1.0 localhost (squid/3.1.19)
Connection: close
Body stored in: /tmp/tmpWV9fJm
DNS Lookup TCP Connection Server Processing Content Transfer
[ 0.253ms | 0.045ms | 0.19ms | 0.045ms ]
| | | |
namelookup:0.253ms | | |
connect:0.298ms | |
starttransfer:0.488ms |
total:0.533ms