aboutsummaryrefslogtreecommitdiff
path: root/gmid.c
diff options
context:
space:
mode:
authorOmar Polo <op@omarpolo.com>2021-01-27 10:47:49 +0000
committerOmar Polo <op@omarpolo.com>2021-01-27 10:47:49 +0000
commit3300cbe06a9567c66ee63f3866bcbcf3430e0205 (patch)
treea7686f8e774573b55ebbe18373a27eb60f44baa4 /gmid.c
parent390a61189309451462c0a1dc56c68f71e334ad4b (diff)
initial punycode support
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 */