Fix #1292 - allow requests with missing protocol version, responses with no reason fields

This commit is contained in:
cpq committed 2021-05-29 10:07:05 +01:00
1 parent e69de57def
commit 886a29d659
3 files changed
+11 -5

No files matched your search

+2 -2
View File
@@ -209,8 +209,8 @@ int mg_http_parse(const char *s, size_t len, struct mg_http_message *hm) {
s = skip(s, end, " ", &hm->uri);
s = skip(s, end, "\r\n", &hm->proto);
// Sanity check
if (hm->method.len == 0 || hm->uri.len == 0 || hm->proto.len == 0) return -1;
// Sanity check. Allow protocol/reason to be empty
if (hm->method.len == 0 || hm->uri.len == 0) return -1;
// If URI contains '?' character, setup query string
if ((qs = (const char *) memchr(hm->uri.ptr, '?', hm->uri.len)) != NULL) {