aboutsummaryrefslogtreecommitdiff
path: root/gmid.c
diff options
context:
space:
mode:
Diffstat (limited to 'gmid.c')
-rw-r--r--gmid.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/gmid.c b/gmid.c
index 7a973f5..09a1d6f 100644
--- a/gmid.c
+++ b/gmid.c
@@ -131,7 +131,14 @@ log_request(struct client *c, char *meta, size_t l)
/* serialize the IRI */
strlcpy(b, c->iri.schema, sizeof(b));
strlcat(b, "://", sizeof(b));
- strlcat(b, c->iri.host, sizeof(b));
+
+ /* log the decoded host name, but if it was invalid
+ * use the raw one. */
+ if (*c->domain != '\0')
+ strlcat(b, c->domain, sizeof(b));
+ else
+ 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 */