From f8214c618faf6f99eebabd1b6d47a538eb938ab0 Mon Sep 17 00:00:00 2001 From: KatolaZ Date: Sat, 21 Jul 2018 23:45:49 +0100 Subject: support for h-selector (HTTP URLs) --- gosher | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/gosher b/gosher index 8203bf6..a0fa98b 100755 --- a/gosher +++ b/gosher @@ -146,6 +146,24 @@ serve_index(){ exit 0 } +### Serve an HTML URL through a redirect page +## function +serve_redirect(){ + url=$1 + cat<< EOF + + + + gopher redirect + + + Click to be redirected to: $url + +EOF + +} + + GOPHERDIR=${1:-"./"} @@ -160,6 +178,10 @@ selector=$(echo $selector | sed -r 's:\$.*::g;s:\r::g' ) } case $selector in + /URL:*) + url=$(echo $selector | cut -d ":" -f 2-) + serve_redirect $url + ;; /?*|"") RP1=$(realpath "${GOPHERDIR}"/"${selector}" || "") [ $? -eq 0 ] || invalid_selector "$selector" -- cgit v1.2.3