mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-11-22 05:15:04 +00:00
Avoid crashing on missing 'method' or 'path' headers in httpd_connection().
This commit is contained in:
parent
af912dba0b
commit
195c21ab2e
1 changed files with 7 additions and 2 deletions
9
httpd.c
9
httpd.c
|
@ -245,8 +245,13 @@ void httpd_connection(FILE *f)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
method = xs_dict_get(req, "method");
|
if (!(method = xs_dict_get(req, "method")) || !(p = xs_dict_get(req, "path"))) {
|
||||||
q_path = xs_dup(xs_dict_get(req, "path"));
|
/* missing needed headers; discard */
|
||||||
|
fclose(f);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
q_path = xs_dup(p);
|
||||||
|
|
||||||
/* crop the q_path from leading / and the prefix */
|
/* crop the q_path from leading / and the prefix */
|
||||||
if (xs_endswith(q_path, "/"))
|
if (xs_endswith(q_path, "/"))
|
||||||
|
|
Loading…
Reference in a new issue