mirror of
https://github.com/cesanta/mongoose.git
synced 2025-08-05 21:18:32 +08:00
Corrected misplaced brackets in parse_http_message()
This commit is contained in:
parent
1ef29c1b3b
commit
2055d41a9f
@ -3070,7 +3070,7 @@ static int parse_http_message(char *buf, int len, struct mg_request_info *ri) {
|
||||
// "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) {
|
||||
(!is_request && memcmp(ri->request_method, "HTTP/", 5) != 0)) {
|
||||
request_length = -1;
|
||||
} else {
|
||||
if (is_request) {
|
||||
|
@ -63,6 +63,10 @@ static void test_parse_http_message() {
|
||||
char req6[] = "G";
|
||||
char req7[] = " blah ";
|
||||
char req8[] = " HTTP/1.1 200 OK \n\n";
|
||||
char req9[] = "HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n";
|
||||
|
||||
ASSERT(parse_http_message(req9, sizeof(req9), &ri) == sizeof(req9) - 1);
|
||||
ASSERT(ri.num_headers == 1);
|
||||
|
||||
ASSERT(parse_http_message(req1, sizeof(req1), &ri) == sizeof(req1) - 1);
|
||||
ASSERT(strcmp(ri.http_version, "1.1") == 0);
|
||||
|
Loading…
Reference in New Issue
Block a user