Commit Diff


commit - d59fad58f6a3ce0c11ee5792e21e0ce73a059dd5
commit + 997b9cd04af3eb9e27e6ad8422d915af04902a7a
blob - b35157691fc275aeec85d7915d237a02f959e1e5
blob + a7bc472e82455bbbd80102d4bab1b290bcc5b4f6
--- iri.c
+++ iri.c
@@ -438,10 +438,11 @@ cpfields(struct iri *dest, const struct iri *src, int 
 		lowerify(dest->iri_scheme);
 	}
 	if (flags & IH_UINFO) {
-		dest->iri_flags |= IH_UINFO;
-		if (src->iri_flags & IH_UINFO)
+		if (src->iri_flags & IH_UINFO) {
 			memcpy(dest->iri_uinfo, src->iri_uinfo,
 			    sizeof(dest->iri_uinfo));
+			dest->iri_flags |= IH_UINFO;
+		}
 	}
 	if (flags & IH_HOST) {
 		dest->iri_flags |= IH_HOST;
@@ -451,9 +452,10 @@ cpfields(struct iri *dest, const struct iri *src, int 
 		lowerify(dest->iri_host);
 	}
 	if (flags & IH_PORT) {
-		dest->iri_flags |= IH_PORT;
-		if (src->iri_flags & IH_PORT)
+		if (src->iri_flags & IH_PORT) {
 			dest->iri_port = src->iri_port;
+			dest->iri_flags |= IH_PORT;
+		}
 	}
 	if (flags & IH_PATH) {
 		dest->iri_flags |= IH_PATH;
@@ -462,10 +464,11 @@ cpfields(struct iri *dest, const struct iri *src, int 
 			    sizeof(dest->iri_path));
 	}
 	if (flags & IH_QUERY) {
-		dest->iri_flags |= IH_QUERY;
-		if (src->iri_flags & IH_QUERY)
+		if (src->iri_flags & IH_QUERY) {
+			dest->iri_flags |= IH_QUERY;
 			memcpy(dest->iri_query, src->iri_query,
 			    sizeof(dest->iri_query));
+		}
 	}
 }