gm

an extremely simple gemini browser/formatter
git clone git://bvnf.space/gm.git
Log | Files | Refs | LICENSE

commit b20a2144ffd11b9beced8dd0b531db436117db60
parent d0361df6a419788a88d5b6a3bbf0bd70ba042cb1
Author: phoebos <ben@bvnf.space>
Date:   Sat, 28 Aug 2021 18:30:40 +0100

incomplete mimetype detection

a possible header response is
200 text/gemini; charset=utf-8
So, the mimetype should be found by scanning up to ';' or EOF.

Diffstat:
Mgm.go | 7++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/gm.go b/gm.go @@ -68,6 +68,7 @@ func main() { os.Exit(0) } + var mimetype string scanner := bufio.NewScanner(conn) // read first line (status) @@ -78,6 +79,7 @@ func main() { // INPUT case '2': // SUCCESS + mimetype = statusline[3:] case '3': // REDIRECT log("redirecting to", statusline[3:]) @@ -94,5 +96,8 @@ func main() { die("error: ", err.Error()) } s := string(resp) - fmt.Println(*Prettify(&s)) + if mimetype == "text/gemini" { + s = *Prettify(&s) + } + fmt.Println(s) }