Commit Diff


commit - b34824a6a86b13a1bbba769f23c7acc64fa72822
commit + 46102ea3153564d16a0ab489cbecb67025e29aea
blob - 80128b892cc588402958d8f88267e6e75aae03cd
blob + a4a0e28c016e659b27148b40613eaac5ffc3ea6b
--- parse.y
+++ parse.y
@@ -32,6 +32,8 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+
+#include "iri.h"
 
 typedef struct {
 	union {
@@ -467,21 +469,21 @@ setattr(char *prfx, char *line, char *trail)
 static void
 add_proxy(char *proto, char *proxy)
 {
+	static struct iri iri;
 	struct proxy *p;
-	struct phos_uri uri;
 
-	if (!phos_parse_absolute_uri(proxy, &uri)) {
+	if (iri_parse(NULL, proxy, &iri) == -1) {
 		yyerror("can't parse URL: %s", proxy);
 		return;
 	}
 
-	if (*uri.path != '\0' || *uri.query != '\0' || *uri.fragment != '\0') {
+	if (iri.iri_flags & (IH_PATH|IH_QUERY)) {
 		yyerror("proxy url can't have path, query or fragments");
 		return;
 	}
 
-	if (strcmp(uri.scheme, "gemini")) {
-		yyerror("disallowed proxy protocol %s", uri.scheme);
+	if (strcmp(iri.iri_scheme, "gemini")) {
+		yyerror("disallowed proxy protocol %s", iri.iri_scheme);
 		return;
 	}
 
@@ -491,10 +493,10 @@ add_proxy(char *proto, char *proxy)
 	p->match_proto = proto;
 	p->proto = PROTO_GEMINI;
 
-	if ((p->host = strdup(uri.host)) == NULL)
+	if ((p->host = strdup(iri.iri_host)) == NULL)
 		err(1, "strdup");
 
-	if ((p->port = strdup(uri.port)) == NULL)
+	if ((p->port = strdup(iri.iri_portstr)) == NULL)
 		err(1, "strdup");
 
 	TAILQ_INSERT_HEAD(&proxies, p, proxies);