Commit 2d1d2e65 authored by Sergey Lyubka's avatar Sergey Lyubka

SIZE_MAX is not defined on MSVC6, use (size_t) ~0

parent 05c88a98
......@@ -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.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment