mirror of
https://github.com/cesanta/mongoose.git
synced 2025-06-11 12:14:41 +08:00
Refactored parse_http_message()
This commit is contained in:
parent
a730afc44d
commit
cf18c932a4
@ -3060,8 +3060,11 @@ static int parse_http_message(char *buf, int len, struct mg_request_info *ri) {
|
||||
ri->request_method = skip(&buf, " ");
|
||||
ri->uri = skip(&buf, " ");
|
||||
ri->http_version = skip(&buf, "\r\n");
|
||||
if (((is_request = is_valid_http_method(ri->request_method)) &&
|
||||
memcmp(ri->http_version, "HTTP/", 5) != 0) ||
|
||||
|
||||
// HTTP message could be either HTTP request or HTTP response, e.g.
|
||||
// "GET / HTTP/1.0 ...." or "HTTP/1.0 200 OK ..."
|
||||
is_request = is_valid_http_method(ri->request_method);
|
||||
if ((is_request && memcmp(ri->http_version, "HTTP/", 5) != 0) ||
|
||||
(!is_request && memcmp(ri->request_method, "HTTP/", 5)) != 0) {
|
||||
request_length = -1;
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user