]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Update vendored http_parser library to v2.9.2.
authorPeter Powell <petpow@saberuk.com>
Wed, 24 Apr 2019 23:42:34 +0000 (00:42 +0100)
committerPeter Powell <petpow@saberuk.com>
Thu, 25 Apr 2019 18:24:35 +0000 (19:24 +0100)
vendor/README.md
vendor/http_parser/http_parser.c
vendor/http_parser/http_parser.h

index b52166464b25ea0efda09ec8fd7fd2dd488a180e..f887858c8eb1fc4b6c58d3702a32a61633ac40cf 100644 (file)
@@ -16,7 +16,7 @@ This directory contains vendored dependencies that are shipped with InspIRCd to
 
 **Author** &mdash; Joyent, Inc. and other Node contributors
 
-**Last Updated** &mdash; 2019-01-01 (v2.9.0)
+**Last Updated** &mdash; 2019-04-25 (v2.9.2)
 
 **License** &mdash; MIT License
 
index e2fc5d2ee7a71718839911446d3e7e0de9f293c7..48963853d8912ce4e6adbc0308ef588b2e3415b4 100644 (file)
@@ -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:
index 880ed278ef992d34ef9250a0c827690caf4c666d..16b5281d1b852ebbc82fdbf85b3d9c6ef0630c6a 100644 (file)
@@ -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__) && \