4 ms·
This is awesome! I've been thinking of doing something like this myself lately. I've mostly done CLI output when testing sites, but a GUI like this is enough
by UI_at_80x24 6y ago
This is awesome! I've been thinking of doing something like this myself lately. I've mostly done CLI output when testing sites, but a GUI like this is enough to keep the management happy.
Related; here's an alias that I frequently use:
alias hstat="curl -o /dev/null --silent --head --write-out '%{http_code}\n'" $1
Example:
$ hstat www.google.com
200
- yegle 6y agoHere's the command I use: curl -s -w 'Testing Website Response Time for :%{url_effective}\n\nLookup Time:\t\t%{time_namelookup}\nConnect Time:\t\t%{time_connect}\nAppCon Time:\t\t%{time_appconnect}\nRedirect Time:\t\t%{time_redirect}\nPre-transfer Time:\t%{time_pretransfer}\nStart-transfer Time:\t%{time_starttransfer}\n\nTotal Time:\t\t%{time_total}\n' -o /dev/null https://google.com Here's the explanation of each timestamp: https://blog.cloudflare.com/a-question-of-timing/ https://blog.cloudflare.com/a-question-of-timing/
- 1vuio0pswjnm7 6y agono curl, only bash hstat(){ exec 3<>/dev/tcp/$1/80; echo -e "GET / HTTP/1.1\r\nhost: http://$1\r\nconnection: close\r\n\r\n" >&3; sed -n '1s/^HTTP\/1\.[01] //;s/ .*//;p' <&3;} no bash, only busybox hstat(){ echo -e "GET / HTTP/1.1\r\nhost: http://$1\r\nconnection: close\r\n\r\n" \ |busybox nc $1 80|busybox sed "1s/^HTTP\/1\.[10] //;s/ .*//;q";}
- dastx 6y agoNow do https. I get not using curl is a cool and fun challenge, but outside that, there's very little reason to not just rely on curl.
- 1vuio0pswjnm7 6y ago"Now do https." Is TLSv1.3 ok? hstat(){ X="GET / HTTP/1.1\r\n" Y="Host: $1\r\n" Z="Connection: close\r\n\r\n" cat << eof|stunnel -fd 0 pid = /tmp/1.pid [hstat] client = yes accept = 127.0.0.1:1337 connect = $1:443 sni = $1 sslVersionMin = TLSv1.3 eof # no curl, only bash exec 3<>/dev/tcp/127.0.0.1/1337 printf "$X$Y$Z" >&3;sed '1s/^HTTP\/1.[01] //;1s/ .*//;q' <&3; # no bash, only busybox printf "$X$Y$Z"|busybox nc 127.0.0.1 1337|busybox sed '1s/^HTTP\/1.[01] //;1s/ .*//;q'; read x < /tmp/1.pid;kill -9 $x;rm /tmp/1.pid; } A careful observer would note that the original parent comment did not use HTTPS. "curl www.example.com" does not automatically transform the method to https nor does Google automatically redirect to HTTPS. cURL is a very popular program. However it is not the program I use on a daily basis. It has a gazillion features (HTTP 1.1 pipelining is still not among them), but it's overkill for the tasks I have. I use other programs like netcat, tcpclient, socat, openssl, stunnel, haproxy, etc. along with custom utilities for generating HTTP I wrote for myself. When I use an http client, I use tnftp or fetch, even wget or lftp, before I will use curl. I only use curl in examples on HN because it is what everyone is familiar with.