panic with gemini path without ending "/"
Hi, I'm trying to access au gemini server agate trough gmitohtml.
It works well when I use this url : https://gmitohtml.mydomain.com/gemini/gemini.mydomain.com/
But without the ending /
(https://gmitohtml.mydomain.com/gemini/gemini.mydomain.com
), gmitohtml panic :
gmitohtml | 2021/01/06 10:33:20 http: panic serving 172.25.0.1:50336: runtime error: index out of range [-1]
gmitohtml | goroutine 588 [running]:
gmitohtml | net/http.(*conn).serve.func1(0xc00023a140)
gmitohtml | /usr/lib/go/src/net/http/server.go:1801 +0x147
gmitohtml | panic(0x720f20, 0xc000019b80)
gmitohtml | /usr/lib/go/src/runtime/panic.go:975 +0x47a
gmitohtml | gitlab.com/tslocum/gmitohtml/pkg/gmitohtml.rewriteURL(0xc00001b0f8, 0x5, 0xc0001e2ab0, 0xc00001b0f8, 0x5)
gmitohtml | /home/trevor/go/src/gitlab.com/tslocum/gmitohtml/pkg/gmitohtml/convert.go:51 +0x9f6
gmitohtml | gitlab.com/tslocum/gmitohtml/pkg/gmitohtml.Convert(0xc0001b8618, 0x9, 0x5e8, 0xc000019b60, 0x1a, 0x600, 0x0, 0x0)
gmitohtml | /home/trevor/go/src/gitlab.com/tslocum/gmitohtml/pkg/gmitohtml/convert.go:129 +0x93f
gmitohtml | gitlab.com/tslocum/gmitohtml/pkg/gmitohtml.fetch(0xc000019060, 0x1a, 0x1a, 0x0, 0x0, 0xc000019040, 0x1a, 0x3, 0x3, 0xc)
gmitohtml | /home/trevor/go/src/gitlab.com/tslocum/gmitohtml/pkg/gmitohtml/daemon.go:149 +0xbcc
gmitohtml | gitlab.com/tslocum/gmitohtml/pkg/gmitohtml.handleRequest(0x7a5660, 0xc000112460, 0xc0001d2200)
gmitohtml | /home/trevor/go/src/gitlab.com/tslocum/gmitohtml/pkg/gmitohtml/daemon.go:228 +0xd45
gmitohtml | net/http.HandlerFunc.ServeHTTP(0x75a9d0, 0x7a5660, 0xc000112460, 0xc0001d2200)
gmitohtml | /usr/lib/go/src/net/http/server.go:2042 +0x44
gmitohtml | net/http.(*ServeMux).ServeHTTP(0xc0000ca600, 0x7a5660, 0xc000112460, 0xc0001d2200)
gmitohtml | /usr/lib/go/src/net/http/server.go:2417 +0x1ad
gmitohtml | net/http.serverHandler.ServeHTTP(0xc000112000, 0x7a5660, 0xc000112460, 0xc0001d2200)
gmitohtml | /usr/lib/go/src/net/http/server.go:2843 +0xa3
gmitohtml | net/http.(*conn).serve(0xc00023a140, 0x7a5c20, 0xc0000ca800)
gmitohtml | /usr/lib/go/src/net/http/server.go:1925 +0x8ad
gmitohtml | created by net/http.(*Server).Serve
gmitohtml | /usr/lib/go/src/net/http/server.go:2969 +0x36c
gmitohtml | 2021/01/06 10:33:20 http: panic serving 172.25.0.1:50616: runtime error: index out of range [-1]
gmitohtml | goroutine 539 [running]:
gmitohtml | net/http.(*conn).serve.func1(0xc00023a000)
gmitohtml | /usr/lib/go/src/net/http/server.go:1801 +0x147
gmitohtml | panic(0x720f20, 0xc0003bd580)
gmitohtml | /usr/lib/go/src/runtime/panic.go:975 +0x47a
gmitohtml | gitlab.com/tslocum/gmitohtml/pkg/gmitohtml.rewriteURL(0xc0004a8ee8, 0x5, 0xc000178090, 0xc0004a8ee8, 0x5)
gmitohtml | /home/trevor/go/src/gitlab.com/tslocum/gmitohtml/pkg/gmitohtml/convert.go:51 +0x9f6
gmitohtml | gitlab.com/tslocum/gmitohtml/pkg/gmitohtml.Convert(0xc00013a618, 0x9, 0x5e8, 0xc0003bd560, 0x1a, 0x600, 0x0, 0x0)
gmitohtml | /home/trevor/go/src/gitlab.com/tslocum/gmitohtml/pkg/gmitohtml/convert.go:129 +0x93f
gmitohtml | gitlab.com/tslocum/gmitohtml/pkg/gmitohtml.fetch(0xc000019ca0, 0x1a, 0x1a, 0x0, 0x0, 0xc000019c80, 0x1a, 0x3, 0x3, 0xc)
gmitohtml | /home/trevor/go/src/gitlab.com/tslocum/gmitohtml/pkg/gmitohtml/daemon.go:149 +0xbcc
gmitohtml | gitlab.com/tslocum/gmitohtml/pkg/gmitohtml.handleRequest(0x7a5660, 0xc000112620, 0xc00015c100)
gmitohtml | /home/trevor/go/src/gitlab.com/tslocum/gmitohtml/pkg/gmitohtml/daemon.go:228 +0xd45
gmitohtml | net/http.HandlerFunc.ServeHTTP(0x75a9d0, 0x7a5660, 0xc000112620, 0xc00015c100)
I tried vulpes.one and native clients, the url https://gmitohtml.mydomain.com/gemini/gemini.mydomain.com
works, and I don't se any option or issue related to a similar problem on the server.
My gmitohtml instance is behind a reverse proxy (apache) vhost :
ProxyPass / http://internal-fqdn:1967/
ProxyPassReverse / http://internal-fqdn:1967/
Any idea ? :) Thanks !
PS : if you wand I can send you the real url for testing.