Skip to content

Commit

Permalink
FIX: parse ext after decode
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael O'Brien committed Jun 2, 2021
1 parent 05c0a50 commit 9f970d0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/http.c
Expand Up @@ -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;
Expand All @@ -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);
Expand Down

0 comments on commit 9f970d0

Please sign in to comment.