From 0609b6cdad3931fd71b33ebf32da770f3b58e517 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Sun, 5 Apr 2020 12:02:27 +0100 Subject: Update the http_parser library to v2.9.4. --- vendor/README.md | 2 +- vendor/http_parser/http_parser.c | 11 +++++++---- vendor/http_parser/http_parser.h | 15 ++++++++------- 3 files changed, 16 insertions(+), 12 deletions(-) (limited to 'vendor') diff --git a/vendor/README.md b/vendor/README.md index ec476ff83..c769285ac 100644 --- a/vendor/README.md +++ b/vendor/README.md @@ -18,7 +18,7 @@ This directory contains vendored dependencies that are shipped with InspIRCd to **License** — MIT License -**Version** — v2.9.3 +**Version** — v2.9.4 **Website** — [https://github.com/nodejs/http-parser](https://github.com/nodejs/http-parser) diff --git a/vendor/http_parser/http_parser.c b/vendor/http_parser/http_parser.c index 0f76b6aca..95ff42f78 100644 --- a/vendor/http_parser/http_parser.c +++ b/vendor/http_parser/http_parser.c @@ -731,6 +731,7 @@ reexecute: if (ch == CR || ch == LF) break; parser->flags = 0; + parser->extra_flags = 0; parser->content_length = ULLONG_MAX; if (ch == 'H') { @@ -768,6 +769,7 @@ reexecute: if (ch == CR || ch == LF) break; parser->flags = 0; + parser->extra_flags = 0; parser->content_length = ULLONG_MAX; if (ch == 'H') { @@ -925,6 +927,7 @@ reexecute: if (ch == CR || ch == LF) break; parser->flags = 0; + parser->extra_flags = 0; parser->content_length = ULLONG_MAX; if (UNLIKELY(!IS_ALPHA(ch))) { @@ -1338,7 +1341,7 @@ reexecute: parser->header_state = h_general; } else if (parser->index == sizeof(TRANSFER_ENCODING)-2) { parser->header_state = h_transfer_encoding; - parser->flags |= F_TRANSFER_ENCODING; + parser->extra_flags |= F_TRANSFER_ENCODING >> 8; } break; @@ -1800,7 +1803,7 @@ reexecute: /* Cannot us transfer-encoding and a content-length header together per the HTTP specification. (RFC 7230 Section 3.3.3) */ - if ((parser->flags & F_TRANSFER_ENCODING) && + if ((parser->extra_flags & (F_TRANSFER_ENCODING >> 8)) && (parser->flags & F_CONTENTLENGTH)) { /* Allow it for lenient parsing as long as `Transfer-Encoding` is * not `chunked` @@ -1886,7 +1889,7 @@ reexecute: /* chunked encoding - ignore Content-Length header, * prepare for a chunk */ UPDATE_STATE(s_chunk_size_start); - } else if (parser->flags & F_TRANSFER_ENCODING) { + } else if (parser->extra_flags & (F_TRANSFER_ENCODING >> 8)) { if (parser->type == HTTP_REQUEST && !lenient) { /* RFC 7230 3.3.3 */ @@ -2162,7 +2165,7 @@ http_message_needs_eof (const http_parser *parser) } /* RFC 7230 3.3.3, see `s_headers_almost_done` */ - if ((parser->flags & F_TRANSFER_ENCODING) && + if ((parser->extra_flags & (F_TRANSFER_ENCODING >> 8)) && (parser->flags & F_CHUNKED) == 0) { return 1; } diff --git a/vendor/http_parser/http_parser.h b/vendor/http_parser/http_parser.h index 983d88a91..df8825260 100644 --- a/vendor/http_parser/http_parser.h +++ b/vendor/http_parser/http_parser.h @@ -27,7 +27,7 @@ extern "C" { /* Also update SONAME in the Makefile whenever you change these. */ #define HTTP_PARSER_VERSION_MAJOR 2 #define HTTP_PARSER_VERSION_MINOR 9 -#define HTTP_PARSER_VERSION_PATCH 3 +#define HTTP_PARSER_VERSION_PATCH 4 #include #if defined(_WIN32) && !defined(__MINGW32__) && \ @@ -225,7 +225,7 @@ enum flags , F_UPGRADE = 1 << 5 , F_SKIPBODY = 1 << 6 , F_CONTENTLENGTH = 1 << 7 - , F_TRANSFER_ENCODING = 1 << 8 + , F_TRANSFER_ENCODING = 1 << 8 /* Never set in http_parser.flags */ }; @@ -272,13 +272,13 @@ enum flags "unexpected content-length header") \ XX(INVALID_CHUNK_SIZE, \ "invalid character in chunk size header") \ - XX(INVALID_TRANSFER_ENCODING, \ - "request has invalid transfer-encoding") \ XX(INVALID_CONSTANT, "invalid constant string") \ XX(INVALID_INTERNAL_STATE, "encountered unexpected internal state")\ XX(STRICT, "strict mode assertion failed") \ XX(PAUSED, "parser is paused") \ - XX(UNKNOWN, "an unknown error occurred") + XX(UNKNOWN, "an unknown error occurred") \ + XX(INVALID_TRANSFER_ENCODING, \ + "request has invalid transfer-encoding") \ /* Define HPE_* values for each errno value above */ @@ -296,11 +296,12 @@ enum http_errno { struct http_parser { /** PRIVATE **/ unsigned int type : 2; /* enum http_parser_type */ + unsigned int flags : 8; /* F_* values from 'flags' enum; semi-public */ unsigned int state : 7; /* enum state from http_parser.c */ unsigned int header_state : 7; /* enum header_state from http_parser.c */ - unsigned int index : 7; /* index into current matcher */ + unsigned int index : 5; /* index into current matcher */ + unsigned int extra_flags : 2; unsigned int lenient_http_headers : 1; - unsigned int flags : 16; /* F_* values from 'flags' enum; semi-public */ uint32_t nread; /* # bytes read in various scenarios */ uint64_t content_length; /* # bytes in body (0 if no Content-Length header) */ -- cgit v1.2.3