diff options
Diffstat (limited to 'sapi/cli/php_http_parser.c')
| -rw-r--r-- | sapi/cli/php_http_parser.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/sapi/cli/php_http_parser.c b/sapi/cli/php_http_parser.c index 2fc0405499..653c54c1a5 100644 --- a/sapi/cli/php_http_parser.c +++ b/sapi/cli/php_http_parser.c @@ -91,6 +91,7 @@ static const char *method_strings[] = , "MOVE" , "PROPFIND" , "PROPPATCH" + , "SEARCH" , "UNLOCK" , "REPORT" , "MKACTIVITY" @@ -588,7 +589,7 @@ size_t php_http_parser_execute (php_http_parser *parser, case 'O': parser->method = PHP_HTTP_OPTIONS; break; case 'P': parser->method = PHP_HTTP_POST; /* or PROPFIND or PROPPATCH or PUT */ break; case 'R': parser->method = PHP_HTTP_REPORT; break; - case 'S': parser->method = PHP_HTTP_SUBSCRIBE; break; + case 'S': parser->method = PHP_HTTP_SUBSCRIBE; /* or SEARCH */ break; case 'T': parser->method = PHP_HTTP_TRACE; break; case 'U': parser->method = PHP_HTTP_UNLOCK; /* or UNSUBSCRIBE */ break; default: parser->method = PHP_HTTP_NOT_IMPLEMENTED; break; @@ -596,7 +597,6 @@ size_t php_http_parser_execute (php_http_parser *parser, state = s_req_method; break; } - case s_req_method: { const char *matcher; @@ -630,6 +630,8 @@ size_t php_http_parser_execute (php_http_parser *parser, parser->method = PHP_HTTP_PUT; } else if (index == 1 && parser->method == PHP_HTTP_POST && ch == 'A') { parser->method = PHP_HTTP_PATCH; + } else if (index == 1 && parser->method == PHP_HTTP_SUBSCRIBE && ch == 'E') { + parser->method = PHP_HTTP_SEARCH; } else if (index == 2 && parser->method == PHP_HTTP_UNLOCK && ch == 'S') { parser->method = PHP_HTTP_UNSUBSCRIBE; } else if (index == 4 && parser->method == PHP_HTTP_PROPFIND && ch == 'P') { @@ -1431,7 +1433,9 @@ size_t php_http_parser_execute (php_http_parser *parser, } case s_body_identity: - to_read = MIN(pe - p, (size_t)parser->content_length); + assert(pe >= p); + + to_read = MIN((size_t)(pe - p), (size_t)parser->content_length); if (to_read > 0) { if (settings->on_body) settings->on_body(parser, p, to_read); p += to_read - 1; @@ -1515,8 +1519,9 @@ size_t php_http_parser_execute (php_http_parser *parser, case s_chunk_data: { assert(parser->flags & F_CHUNKED); + assert(pe >= p); - to_read = MIN(pe - p, (size_t)(parser->content_length)); + to_read = MIN((size_t)(pe - p), (size_t)(parser->content_length)); if (to_read > 0) { if (settings->on_body) settings->on_body(parser, p, to_read); |
