aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOmar Polo <op@omarpolo.com>2022-07-04 08:15:39 +0000
committerOmar Polo <op@omarpolo.com>2022-07-04 08:15:39 +0000
commit5e41063f1b0cd8f096ec925777bc4cf4ef6ba828 (patch)
tree466aab4a55073ff0ae293e9b290caeafe2ac8bf5
parentdf9b3790817d4d64fee06e046a479a67d4a91b13 (diff)
bugfix: allow @ and : in paths
gmid would disallow the '@' and ':' characters in paths (unless percent-encoded.) Issue reported by freezr.
-rw-r--r--iri.c2
-rw-r--r--regress/iri_test.c4
2 files changed, 6 insertions, 0 deletions
diff --git a/iri.c b/iri.c
index ae292d0..f34b800 100644
--- a/iri.c
+++ b/iri.c
@@ -352,6 +352,8 @@ parse_path(struct parser *p)
while (unreserved(*p->iri)
|| sub_delimiters(*p->iri)
+ || *p->iri == '@'
+ || *p->iri == ':'
|| *p->iri == '/'
|| parse_pct_encoded(p)
|| valid_multibyte_utf8(p))
diff --git a/regress/iri_test.c b/regress/iri_test.c
index 6595f92..c6725b5 100644
--- a/regress/iri_test.c
+++ b/regress/iri_test.c
@@ -198,6 +198,10 @@ main(void)
PASS,
IRI("http", "a", "", "", "", ""),
"avoid infinite loops (see v1.6.1)");
+ TEST("gemini://example.com/@f:b!(z$&)/baz",
+ PASS,
+ IRI("gemini", "example.com", "", "@f:b!(z$&)/baz", "", ""),
+ "allow @, :, !, (), $ and & in paths");
/* query */
TEST("foo://example.com/foo/?gne",