From 9f970d0d068932c0087f48cff0dc2102a8b115be Mon Sep 17 00:00:00 2001 From: Michael O'Brien Date: Wed, 2 Jun 2021 14:05:20 +1000 Subject: [PATCH] FIX: parse ext after decode --- src/http.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/http.c b/src/http.c index bed1f51f..37df3a82 100644 --- a/src/http.c +++ b/src/http.c @@ -1002,7 +1002,7 @@ static void parseFirstLine(Webs *wp) start of the URL. Non-proxied will just be local path names. */ host = path = port = query = ext = NULL; - if (websUrlParse(url, &buf, NULL, &host, &port, &path, &ext, NULL, &query) < 0) { + if (websUrlParse(url, &buf, NULL, &host, &port, &path, NULL, NULL, &query) < 0) { error("Cannot parse URL: %s", url); websError(wp, HTTP_CODE_BAD_REQUEST | WEBS_CLOSE | WEBS_NOLOG, "Bad URL"); return; @@ -1013,7 +1013,7 @@ static void parseFirstLine(Webs *wp) return; } wp->url = sclone(url); - if (ext) { + if ((ext = strrchr(wp->path, '.')) != NULL) { wp->ext = sclone(slower(ext)); } wp->filename = sfmt("%s%s", websGetDocuments(), wp->path);