From 24e782312d777035aad39dabf033a0e977a3ca02 Mon Sep 17 00:00:00 2001 From: Nicolas Boisselier Date: Wed, 15 Jul 2015 10:08:59 +0100 Subject: [PATCH] Get, Head --- etc/aliases | 8 ++++++++ 1 file changed, 8 insertions(+) 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 -- 2.47.3