diff options
author | Omar Polo <op@omarpolo.com> | 2021-01-21 22:48:16 +0000 |
---|---|---|
committer | Omar Polo <op@omarpolo.com> | 2021-01-21 22:48:16 +0000 |
commit | 42bbdc7978acc6be9beb5baa7d94fedb7c211b49 (patch) | |
tree | 9184f10e29ac2182f518831796829a7470ad7fc2 /iri.c | |
parent | f77a8c867ecc2881d60345b9e1b1ee4259189e9a (diff) |
trim initial forward slashes
this parse gemini://example.com///foo into an IRI whose path is
"foo". I'm not 100% this is standard-compliant but:
1. it seems a logical consequence of the URI/IRI cleaning algo (where
we drop sequential slashes)
2. practically speaking serving file a sequence of forward slashes
doesn't really make sense, even in the case of CGI scripts
Diffstat (limited to 'iri.c')
-rw-r--r-- | iri.c | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -293,6 +293,10 @@ parse_path(struct parser *p) { char c; + /* trim initial slashes */ + while (*p->iri == '/') + p->iri++; + p->parsed->path = p->iri; if (*p->iri == '\0') { p->parsed->query = p->parsed->fragment = p->iri; |