Commit Diff


commit - 0be51733ef271183e8164b8de1871cba634c1508
commit + 0ab65593e21482c53ece36aa954204d7b202d351
blob - e9cccf08d188ef5c69acd727bb7c01297d2ba323
blob + 510d71f5110e6e88f492bd2caf21369c3ecef813
--- gmid.c
+++ gmid.c
@@ -119,15 +119,19 @@ log_request(struct client *c, char *meta, size_t l)
 	if (ec != 0)
 		fatal("getnameinfo: %s", gai_strerror(ec));
 
-	/* serialize the IRI */
-	strlcpy(b, c->iri.schema, sizeof(b));
-	strlcat(b, "://", sizeof(b));
-	strlcat(b, c->iri.host, sizeof(b));
-	strlcat(b, "/", sizeof(b));
-	strlcat(b, c->iri.path, sizeof(b)); /* TODO: sanitize UTF8 */
-	if (*c->iri.query != '\0') {	    /* TODO: sanitize UTF8 */
-		strlcat(b, "?", sizeof(b));
-		strlcat(b, c->iri.query, sizeof(b));
+	if (c->iri.schema != NULL) {
+		/* serialize the IRI */
+		strlcpy(b, c->iri.schema, sizeof(b));
+		strlcat(b, "://", sizeof(b));
+		strlcat(b, c->iri.host, sizeof(b));
+		strlcat(b, "/", sizeof(b));
+		strlcat(b, c->iri.path, sizeof(b)); /* TODO: sanitize UTF8 */
+		if (*c->iri.query != '\0') {	    /* TODO: sanitize UTF8 */
+			strlcat(b, "?", sizeof(b));
+			strlcat(b, c->iri.query, sizeof(b));
+		}
+	} else {
+		strlcpy(b, c->req, sizeof(b));
 	}
 
 	if ((t = gmid_strnchr(meta, '\r', l)) == NULL)
blob - 728a679525556324ffcb2efedd570fc32b40630a
blob + 50329cf18d0e714f84c77f3d01c4e70062019967
--- server.c
+++ server.c
@@ -196,6 +196,11 @@ handle_handshake(struct pollfd *fds, struct client *c)
 	}
 
 hostnotfound:
+	if (servname != NULL)
+		strncpy(c->req, servname, sizeof(c->req));
+	else
+		strncpy(c->req, "null", sizeof(c->req));
+
 	/* XXX: check the correct response */
 	if (!start_reply(fds, c, BAD_REQUEST, "Wrong host or missing SNI"))
 		return;