|
@@ -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) */
|