From 7113efe71ed4e1d5aebcb7501129ab30b1cfa2fd Mon Sep 17 00:00:00 2001 From: cel Date: Wed, 26 Feb 2020 09:22:17 -0500 Subject: Support input status type --- gemini.filter.dpi | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/gemini.filter.dpi b/gemini.filter.dpi index c9e17d1..f6c7cb3 100755 --- a/gemini.filter.dpi +++ b/gemini.filter.dpi @@ -50,6 +50,28 @@ serve_missing_status() { echo Empty status response. $2 } +serve_input() { + printf "\n" + prompt=$1 + # TODO: html-escape prompt + printf "Content-type: text/html\r\n\r\n" + cat <<-EOF + + + + Input + + +
+

$prompt

+ + +
+ + + EOF +} + serve_success() { printf "\n" type=$1 @@ -124,6 +146,15 @@ serve_gemini() { hostname=${url1%%/*} host=${hostname%%:*} port=${hostname##*:} + + # replace "?_=" with "?". + # dillo can only submit forms with name=value items, but Gemini + # uses the whole querystring as a single string + url1=${url%%?_=*} + if [ "$url1" != "$url" ]; then + url="${url1}?${url#*?_=}" + fi + if [ "$host" = "$port" ]; then port=1965; fi send_status_msg "Sending request..." printf "%s\r\n" "$url" | openssl s_client -verify_quiet -quiet "$host:$port" | { -- cgit v1.2.3