Commit Diff


commit - 15902770073dd67df3a9af0f6da7d63bfb031d72
commit + e4d82becb71b1b8f9c843a5f0f8657bc6b93c67b
blob - 1b997dd7ce1164b0ccc0735a0efdfde14706c184
blob + d64afe8573d606eb389163efca65b27289baa17f
--- iri.c
+++ iri.c
@@ -146,8 +146,12 @@ parse_authority(struct parser *p)
 
 	while (unreserved(*p->iri)
 	    || sub_delimiters(*p->iri)
-	    || parse_pct_encoded(p))
+	    || parse_pct_encoded(p)) {
+		/* normalize the host name. */
+		if (*p->iri < 0x7F)
+			*p->iri = tolower(*p->iri);
 		p->iri++;
+	}
 
 	if (p->err != NULL)
 		return 0;
blob - e3228134bbfd322a8cd8cdfefbe0343258ea7ea6
blob + 81ec0b4d26a7ef7cae39b770bcd0cbb54bfc3c6c
--- iri_test.c
+++ iri_test.c
@@ -123,6 +123,10 @@ main(void)
 	    FAIL,
 	    empty,
 	    "FAIL with invalid port number");
+	TEST("gemini://OmArPoLo.CoM",
+	    PASS,
+	    IRI("gemini", "omarpolo.com", "", "", "", ""),
+	    "host is case-insensitive");
 
 	/* path */
 	TEST("gemini://omarpolo.com/foo/bar/baz",