panic with gemini path without ending "/" #3

Closed
opened 2 years ago by thasos · 5 comments
thasos commented 2 years ago (Migrated from gitlab.com)
Owner

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.

Hi, I'm trying to access au gemini server [agate](https://github.com/mbrubeck/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.
thasos commented 2 years ago (Migrated from gitlab.com)
Owner

Note that this happen only on the root folder.

Both urls https://gmitohtml.mydomain.com/gemini/gemini.mydomain.com/somefolder and https://gmitohtml.mydomain.com/gemini/gemini.mydomain.com/somefolder/ are working.

Note that this happen only on the root folder. Both urls `https://gmitohtml.mydomain.com/gemini/gemini.mydomain.com/somefolder` and `https://gmitohtml.mydomain.com/gemini/gemini.mydomain.com/somefolder/` are working.
tslocum commented 2 years ago (Migrated from gitlab.com)
Owner

I can't seem to reproduce this yet. Are you running gmitohtml v1.0.3? I will investigate further once you've confirmed you're running the latest version.

I can't seem to reproduce this yet. Are you running gmitohtml v1.0.3? I will investigate further once you've confirmed you're running the latest version.
thasos commented 2 years ago (Migrated from gitlab.com)
Owner

Yes, 1.0.3.

I will try running without the apache httpd reverse proxy and inform you.

Yes, 1.0.3. I will try running without the apache httpd reverse proxy and inform you.
thasos commented 2 years ago (Migrated from gitlab.com)
Owner

Same behavior without the reverse proxy... but I've tested running agate and gmitohtml on my desktop computer, it works well, so it's something on my server !

This issue can be closed, if I found something interesting I will reply on it.

Sorry for the inconvenience !

Same behavior without the reverse proxy... but I've tested running agate and gmitohtml on my desktop computer, it works well, so it's something on my server ! This issue can be closed, if I found something interesting I will reply on it. Sorry for the inconvenience !
thasos commented 2 years ago (Migrated from gitlab.com)
Owner
solved with https://github.com/mbrubeck/agate/releases/tag/v2.1.3 :)
Sign in to join this conversation.
No Milestone
No Assignees
1 Participants
Notifications
Due Date

No due date set.

Dependencies

This issue currently doesn't have any dependencies.

Loading…
There is no content yet.