diff --git a/gosher b/gosher index 2a1acfa..16d2d83 100755 --- a/gosher +++ b/gosher @@ -37,7 +37,7 @@ ## ## -## NETCAT: the netcat command to use, and any additional option +## NETCAT: the netcat command to use, without additional options ## ### Original netcat ##NETCAT="nc.traditional" @@ -48,6 +48,11 @@ ### OpenBSD netcat NETCAT="nc" +## +## NETCAT_OPTS: any additional options to netcat +## +NETCAT_OPTS="" + ## ## STYLE: The way in which netcat will talk to gosher_serve ## @@ -164,9 +169,9 @@ serve_index(){ while read -r line; do rline=$(echo "$line" | tr -d '\r') case "$rline" in - '['*) - line=$(echo "$rline" | sed -r -e 's/^\[//;s/\]$//;s/\|/ /g;s/ / /;') - line=$(echo "$line" | sed -r -e "s/server port/$HOSTNAME $PORT/") + '['*) + line=$(echo "$rline" | sed -r -e "s/ / /g;s/server\|port\]$/$HOSTNAME $PORT/") + line=$(echo "$line" | sed -r -e 's/^\[//;s/\]$//;s/\|/ /g;s/ //1') ;; t*) line=$(echo "$rline" | cut -b 2-)