Tools - httpstat.py
Alasta 6 Octobre 2016 tools bash tools Linux Open Source shell ssl
Description : Voici un script python qui permet de mesurer le temps dans les différents processus d'une connexion HTTP(s)
Récupération du script :
Recupération du script
$ wget https://raw.githubusercontent.com/reorx/httpstat/master/httpstat.py
Utilisation :
La commande et ses options
$ ./httpstat.py -h
Usage: httpstat URL [CURL_OPTIONS]
httpstat -h | --help
httpstat --version
Arguments:
URL url to request, could be with or without `http(s)://` prefix
Options:
CURL_OPTIONS any curl supported options, except for -w -D -o -S -s,
which are already used internally.
-h --help show this screen.
--version show version.
Environments:
HTTPSTAT_SHOW_BODY Set to `true` to show resposne body in the output,
note that body length is limited to 1023 bytes, will be
truncated if exceeds. Default is `false`.
HTTPSTAT_SHOW_SPEED Set to `true` to show download and upload speed.
Default is `false`.
HTTPSTAT_SAVE_BODY By default httpstat stores body in a tmp file,
set to `false` to disable this feature. Default is `true`
HTTPSTAT_CURL_BIN Indicate the curl bin path to use. Default is `curl`
from current shell $PATH.
HTTPSTAT_DEBUG Set to `true` to see debugging logs. Default is `false`
Utilisation avec affichage de la vitesse de téléchargement.
$ export HTTPSTAT_SHOW_SPEED=true
$ ./httpstat.py https://www.example.com
HTTP/1.1 200 OK
Cache-Control: max-age=604800
Content-Type: text/html
Date: Thu, 06 Oct 2016 19:09:28 GMT
Etag: "359670651+gzip+ident"
Expires: Thu, 13 Oct 2016 19:09:28 GMT
Last-Modified: Fri, 09 Aug 2013 23:54:35 GMT
Server: ECS (iad/18CB)
Vary: Accept-Encoding
X-Cache: HIT
x-ec-custom-error: 1
Content-Length: 1270
Body stored in: /var/folders/k3/1hynv9s11m97xn852sq79n_m0000gn/T/tmpw3Yvg6
DNS Lookup TCP Connection TLS Handshake Server Processing Content Transfer
[ 10ms | 0ms | 435ms | 131ms | 0ms ]
| | | | |
namelookup:10ms | | | |
connect:10ms | | |
pretransfer:445ms | |
starttransfer:576ms |
total:576ms
speed_download: 2.2 KiB/s, speed_upload: 0.0 KiB/s