diff options
author | Omar Polo <op@omarpolo.com> | 2021-01-27 10:47:49 +0000 |
---|---|---|
committer | Omar Polo <op@omarpolo.com> | 2021-01-27 10:47:49 +0000 |
commit | 3300cbe06a9567c66ee63f3866bcbcf3430e0205 (patch) | |
tree | a7686f8e774573b55ebbe18373a27eb60f44baa4 /gmid.c | |
parent | 390a61189309451462c0a1dc56c68f71e334ad4b (diff) |
initial punycode support
Diffstat (limited to 'gmid.c')
-rw-r--r-- | gmid.c | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -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 */ |