mirror of
https://github.com/cesanta/mongoose.git
synced 2025-01-18 23:53:15 +08:00
SIZE_MAX is not defined on MSVC6, use (size_t) ~0
This commit is contained in:
parent
05c88a98fc
commit
2d1d2e6534
@ -2485,7 +2485,7 @@ static size_t parse_http_message(char *buf, size_t len,
|
||||
ri->request_method = ri->uri = ri->http_version = ri->query_string = NULL;
|
||||
ri->num_headers = ri->status_code = ri->is_websocket = ri->content_len = 0;
|
||||
|
||||
if (len < 1) return SIZE_MAX;
|
||||
if (len < 1) return ~0;
|
||||
|
||||
buf[len - 1] = '\0';
|
||||
|
||||
@ -2502,7 +2502,7 @@ static size_t parse_http_message(char *buf, size_t len,
|
||||
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)) {
|
||||
len = SIZE_MAX;
|
||||
len = ~0;
|
||||
} else {
|
||||
if (is_request) {
|
||||
ri->http_version += 5;
|
||||
|
@ -120,8 +120,8 @@ static const char *test_parse_http_message() {
|
||||
ASSERT(strcmp(ri.http_version, "1.1") == 0);
|
||||
ASSERT(ri.num_headers == 0);
|
||||
|
||||
ASSERT(parse_http_message(req2, sizeof(req2) - 1, &ri) == SIZE_MAX);
|
||||
ASSERT(parse_http_message(req6, 0, &ri) == SIZE_MAX);
|
||||
ASSERT(parse_http_message(req2, sizeof(req2) - 1, &ri) == (size_t) ~0);
|
||||
ASSERT(parse_http_message(req6, 0, &ri) == (size_t) ~0);
|
||||
ASSERT(parse_http_message(req8, sizeof(req8) - 1, &ri) == sizeof(req8) - 1);
|
||||
|
||||
// TODO(lsm): Fix this. Header value may span multiple lines.
|
||||
|
Loading…
Reference in New Issue
Block a user