omar-polo / gmid

a Gemini server
https://gmid.omarpolo.com
ISC License
98 stars 8 forks source link

GG: /.. reported as invalid IRI #12

Closed Toby222 closed 3 weeks ago

Toby222 commented 2 years ago

Requesting the address gemini://localhost/../ returns the error gg: invalid IRI: illegal path, even though it should be a valid IRI gemini://localhost/./...../ (arbitrarily many . at the end) works, and will return the index of localhost, if requested on a gmid server

omar-polo commented 2 years ago

good catch, I haven't thought about that case.

gg uses the same IRI code that gmid use, and so it performs some cleanups that are needed server-side but not on the client.

I had in mind to improve the IRI handling and separate the parsing and cleanup phases, now I have a strong reason to do that :)

omar-polo commented 8 months ago

If you don't mind, I'd keep this open. While it's not a top-priority, I still like to to eventually fix it ^^"

Toby222 commented 8 months ago

No problem! just went through my old stuff and removed the inactive-seeming ones

omar-polo commented 3 weeks ago

Took a while to fix this, oops :)

When I wrote the parser I was a bit paranoic and decided to reject altogether paths that tried to "escape" the root. However, RFC 3986 § 5.2.4 in the algorithm "remove_dot_segments" explicitly allows for it.