summaryrefslogtreecommitdiff
path: root/vendor/http_parser
diff options
context:
space:
mode:
authorPeter Powell <petpow@saberuk.com>2019-04-25 00:42:34 +0100
committerPeter Powell <petpow@saberuk.com>2019-04-25 19:24:35 +0100
commitf2712eaf0c191575a55576217a88e4a7af3b8865 (patch)
tree1d215b0f6349baf938243f18d4fef1bf04d3b1ed /vendor/http_parser
parent56c94774286e0be9de8b05d4ae4e752a394f7146 (diff)
Update vendored http_parser library to v2.9.2.
Diffstat (limited to 'vendor/http_parser')
-rw-r--r--vendor/http_parser/http_parser.c45
-rw-r--r--vendor/http_parser/http_parser.h2
2 files changed, 22 insertions, 25 deletions
diff --git a/vendor/http_parser/http_parser.c b/vendor/http_parser/http_parser.c
index e2fc5d2ee..48963853d 100644
--- a/vendor/http_parser/http_parser.c
+++ b/vendor/http_parser/http_parser.c
@@ -1257,9 +1257,9 @@ reexecute:
switch (parser->header_state) {
case h_general: {
- size_t limit = data + len - p;
- limit = MIN(limit, max_header_size);
- while (p+1 < data + limit && TOKEN(p[1])) {
+ size_t left = data + len - p;
+ const char* pe = p + MIN(left, max_header_size);
+ while (p+1 < pe && TOKEN(p[1])) {
p++;
}
break;
@@ -1496,28 +1496,25 @@ reexecute:
switch (h_state) {
case h_general:
- {
- const char* p_cr;
- const char* p_lf;
- size_t limit = data + len - p;
-
- limit = MIN(limit, max_header_size);
-
- p_cr = (const char*) memchr(p, CR, limit);
- p_lf = (const char*) memchr(p, LF, limit);
- if (p_cr != NULL) {
- if (p_lf != NULL && p_cr >= p_lf)
- p = p_lf;
- else
- p = p_cr;
- } else if (UNLIKELY(p_lf != NULL)) {
- p = p_lf;
- } else {
- p = data + len;
+ {
+ size_t left = data + len - p;
+ const char* pe = p + MIN(left, max_header_size);
+
+ for (; p != pe; p++) {
+ ch = *p;
+ if (ch == CR || ch == LF) {
+ --p;
+ break;
+ }
+ if (!lenient && !IS_HEADER_CHAR(ch)) {
+ SET_ERRNO(HPE_INVALID_HEADER_TOKEN);
+ goto error;
+ }
+ }
+ if (p == data + len)
+ --p;
+ break;
}
- --p;
- break;
- }
case h_connection:
case h_transfer_encoding:
diff --git a/vendor/http_parser/http_parser.h b/vendor/http_parser/http_parser.h
index 880ed278e..16b5281d1 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 0
+#define HTTP_PARSER_VERSION_PATCH 2
#include <stddef.h>
#if defined(_WIN32) && !defined(__MINGW32__) && \