aboutsummaryrefslogtreecommitdiff
path: root/log.c
diff options
context:
space:
mode:
authorOmar Polo <op@omarpolo.com>2021-10-24 16:34:30 +0000
committerOmar Polo <op@omarpolo.com>2021-10-24 16:34:30 +0000
commita81dd6cda6c823fd9ab43abbf8722ced47a754a8 (patch)
tree59c5694814bd87f395309ed1d8baaff780901e92 /log.c
parent93edd35305508c984cbee45594dfa45808373a61 (diff)
fix "double slash" in logs
gmid ended up printing two slashes between the hostname and the path when logging the request IRI.
Diffstat (limited to 'log.c')
-rw-r--r--log.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/log.c b/log.c
index 8a2ab7b..b9ffe25 100644
--- a/log.c
+++ b/log.c
@@ -238,7 +238,8 @@ log_request(struct client *c, char *meta, size_t l)
else
strlcat(b, c->iri.host, sizeof(b));
- strlcat(b, "/", sizeof(b));
+ if (*c->iri.path != '/')
+ 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));