summaryrefslogtreecommitdiff
path: root/vendor/http_parser
diff options
context:
space:
mode:
authorSadie Powell <sadie@witchery.services>2020-04-05 12:02:27 +0100
committerSadie Powell <sadie@witchery.services>2020-04-05 12:03:00 +0100
commit0609b6cdad3931fd71b33ebf32da770f3b58e517 (patch)
treec7efadb803d8be1db9487ae3e6cd3f8dd2f27438 /vendor/http_parser
parent3d56d49cf1696964a6349be6c5820fc60266ef26 (diff)
Update the http_parser library to v2.9.4.
Diffstat (limited to 'vendor/http_parser')
-rw-r--r--vendor/http_parser/http_parser.c11
-rw-r--r--vendor/http_parser/http_parser.h15
2 files changed, 15 insertions, 11 deletions
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 <stddef.h>
#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) */