From d053f12f83b400ba778522ddc9756bcfc7194cf0 Mon Sep 17 00:00:00 2001 From: Fedor Indutny Date: Sat, 17 Apr 2021 11:07:31 -0700 Subject: [PATCH] deps: update llhttp to 6.0.0 See: https://github.com/nodejs/node/pull/37678#issuecomment-821156758 --- deps/llhttp/README.md | 1 + deps/llhttp/include/llhttp.h | 58 ++++++++++++++++++++++++++++-- deps/llhttp/src/api.c | 2 +- test/parallel/test-http-methods.js | 11 ------ 4 files changed, 58 insertions(+), 14 deletions(-) diff --git a/deps/llhttp/README.md b/deps/llhttp/README.md index ff72e07f8ba99d..fcbf86c12b6553 100644 --- a/deps/llhttp/README.md +++ b/deps/llhttp/README.md @@ -90,6 +90,7 @@ if (err == HPE_OK) { parser.reason); } ``` +For more information on API usage, please refer to [src/native/api.h](https://github.com/nodejs/llhttp/blob/master/src/native/api.h). --- diff --git a/deps/llhttp/include/llhttp.h b/deps/llhttp/include/llhttp.h index 8f9590d350c749..241136fe5928ee 100644 --- a/deps/llhttp/include/llhttp.h +++ b/deps/llhttp/include/llhttp.h @@ -1,8 +1,8 @@ #ifndef INCLUDE_LLHTTP_H_ #define INCLUDE_LLHTTP_H_ -#define LLHTTP_VERSION_MAJOR 5 -#define LLHTTP_VERSION_MINOR 1 +#define LLHTTP_VERSION_MAJOR 6 +#define LLHTTP_VERSION_MINOR 0 #define LLHTTP_VERSION_PATCH 0 #ifndef LLHTTP_STRICT_MODE @@ -232,6 +232,12 @@ typedef enum llhttp_method llhttp_method_t; XX(32, UNLINK, UNLINK) \ XX(33, SOURCE, SOURCE) \ XX(34, PRI, PRI) \ + + +#define RTSP_METHOD_MAP(XX) \ + XX(1, GET, GET) \ + XX(3, POST, POST) \ + XX(6, OPTIONS, OPTIONS) \ XX(35, DESCRIBE, DESCRIBE) \ XX(36, ANNOUNCE, ANNOUNCE) \ XX(37, SETUP, SETUP) \ @@ -245,6 +251,54 @@ typedef enum llhttp_method llhttp_method_t; XX(45, FLUSH, FLUSH) \ +#define HTTP_ALL_METHOD_MAP(XX) \ + XX(0, DELETE, DELETE) \ + XX(1, GET, GET) \ + XX(2, HEAD, HEAD) \ + XX(3, POST, POST) \ + XX(4, PUT, PUT) \ + XX(5, CONNECT, CONNECT) \ + XX(6, OPTIONS, OPTIONS) \ + XX(7, TRACE, TRACE) \ + XX(8, COPY, COPY) \ + XX(9, LOCK, LOCK) \ + XX(10, MKCOL, MKCOL) \ + XX(11, MOVE, MOVE) \ + XX(12, PROPFIND, PROPFIND) \ + XX(13, PROPPATCH, PROPPATCH) \ + XX(14, SEARCH, SEARCH) \ + XX(15, UNLOCK, UNLOCK) \ + XX(16, BIND, BIND) \ + XX(17, REBIND, REBIND) \ + XX(18, UNBIND, UNBIND) \ + XX(19, ACL, ACL) \ + XX(20, REPORT, REPORT) \ + XX(21, MKACTIVITY, MKACTIVITY) \ + XX(22, CHECKOUT, CHECKOUT) \ + XX(23, MERGE, MERGE) \ + XX(24, MSEARCH, M-SEARCH) \ + XX(25, NOTIFY, NOTIFY) \ + XX(26, SUBSCRIBE, SUBSCRIBE) \ + XX(27, UNSUBSCRIBE, UNSUBSCRIBE) \ + XX(28, PATCH, PATCH) \ + XX(29, PURGE, PURGE) \ + XX(30, MKCALENDAR, MKCALENDAR) \ + XX(31, LINK, LINK) \ + XX(32, UNLINK, UNLINK) \ + XX(33, SOURCE, SOURCE) \ + XX(34, PRI, PRI) \ + XX(35, DESCRIBE, DESCRIBE) \ + XX(36, ANNOUNCE, ANNOUNCE) \ + XX(37, SETUP, SETUP) \ + XX(38, PLAY, PLAY) \ + XX(39, PAUSE, PAUSE) \ + XX(40, TEARDOWN, TEARDOWN) \ + XX(41, GET_PARAMETER, GET_PARAMETER) \ + XX(42, SET_PARAMETER, SET_PARAMETER) \ + XX(43, REDIRECT, REDIRECT) \ + XX(44, RECORD, RECORD) \ + XX(45, FLUSH, FLUSH) \ + #ifdef __cplusplus } /* extern "C" */ diff --git a/deps/llhttp/src/api.c b/deps/llhttp/src/api.c index 8a4bdd26bb771a..4bd0e5a16d65b0 100644 --- a/deps/llhttp/src/api.c +++ b/deps/llhttp/src/api.c @@ -199,7 +199,7 @@ const char* llhttp_errno_name(llhttp_errno_t err) { const char* llhttp_method_name(llhttp_method_t method) { #define HTTP_METHOD_GEN(NUM, NAME, STRING) case HTTP_##NAME: return #STRING; switch (method) { - HTTP_METHOD_MAP(HTTP_METHOD_GEN) + HTTP_ALL_METHOD_MAP(HTTP_METHOD_GEN) default: abort(); } #undef HTTP_METHOD_GEN diff --git a/test/parallel/test-http-methods.js b/test/parallel/test-http-methods.js index 606126fe74d389..d562f639503d0f 100644 --- a/test/parallel/test-http-methods.js +++ b/test/parallel/test-http-methods.js @@ -29,16 +29,12 @@ const http = require('http'); const methods = [ 'ACL', - 'ANNOUNCE', 'BIND', 'CHECKOUT', 'CONNECT', 'COPY', 'DELETE', - 'DESCRIBE', - 'FLUSH', 'GET', - 'GET_PARAMETER', 'HEAD', 'LINK', 'LOCK', @@ -51,8 +47,6 @@ const methods = [ 'NOTIFY', 'OPTIONS', 'PATCH', - 'PAUSE', - 'PLAY', 'POST', 'PRI', 'PROPFIND', @@ -60,15 +54,10 @@ const methods = [ 'PURGE', 'PUT', 'REBIND', - 'RECORD', - 'REDIRECT', 'REPORT', 'SEARCH', - 'SETUP', - 'SET_PARAMETER', 'SOURCE', 'SUBSCRIBE', - 'TEARDOWN', 'TRACE', 'UNBIND', 'UNLINK',