From: Nicolas Boisselier Date: Wed, 15 Jul 2015 09:08:59 +0000 (+0100) Subject: Get, Head X-Git-Url: https://git.nbdom.net/?a=commitdiff_plain;h=24e782312d777035aad39dabf033a0e977a3ca02;p=nb.git Get, Head --- diff --git a/etc/aliases b/etc/aliases index b74a5d78..300251fa 100644 --- a/etc/aliases +++ b/etc/aliases @@ -54,6 +54,14 @@ elif which curl &> /dev/null; then alias Head="curl -s --head" alias Get="curl -s --get -L" fi +# NB 15.07.15 function nbGet() { +# NB 15.07.15 declare host port uri +# NB 15.07.15 eval $(perl -ne 'm,^\s*\w+://([^/:]+)(?::(\d+))?(/.*)?\s*$, and print qq|host=$1 port=$2 uri=$3\n|' <<< "$@") +# NB 15.07.15 [ -z "$port" ] && port=80 +# NB 15.07.15 [ -z "$uri" ] && uri='/' +# NB 15.07.15 echo $host $port $uri +# NB 15.07.15 printf "GET $uri HTTP/1.0\r\nHost: $host\r\n\r\n" |nc -i 5 $host $port +# NB 15.07.15 } #-------------------------------------------------------------------------------- # bc