Uh oh!
There was an error while loading. Please reload this page.
api: limit HTTP_METHOD_MAP to HTTP methods - #103
Conversation
RTSP methods shouldn't mix up with HTTP methods in the method map since they are supported only with the RTSP protocol. Node.js uses `HTTP_METHOD_MAP` to generate `http.METHODS` array and this breaks tests in `body-parser` because it assumes that all of these methods are for HTTP requests.
indutny
commented
Apr 17, 2021
Gosh, I realized that I didn't include the diff of the generated header file. Sorry! diff --git a/tmp/llhttp-old.h b/tmp/llhttp-new.h
index 8f9590d..6f40b67 100644
--- a/tmp/llhttp-old.h+++ b/tmp/llhttp-new.h@@ -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" */ |
indutny
commented
Apr 17, 2021
So the point is that |
RTSP methods shouldn't mix up with HTTP methods in the method map since they are supported only with the RTSP protocol. Node.js uses `HTTP_METHOD_MAP` to generate `http.METHODS` array and this breaks tests in `body-parser` because it assumes that all of these methods are for HTTP requests. PR-URL: #103 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Daniele Belardi <dwon.dnl@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Beth Griggs <bgriggs@redhat.com>
indutny
commented
Apr 17, 2021
Landed in 25c6ea4, thank you! |
BethGriggs
commented
Apr 20, 2021
@indutny, related query - do we also need to treat the PRI method as a special case? Latest CITGM showed |
indutny
commented
Apr 20, 2021
@BethGriggs ouuuch, didn't think about it. Sorry! Here's the PR to fix it: #105 . I'm going to make it a patch release because it is clearly a bug. |
pallas
commented
Apr 20, 2021
How does a caller tell that PRI is the reason the parser stopped? Is it just due to the upgrade return code? |
indutny
commented
Apr 20, 2021
@pallas yep, this is what it is. The error code was introduced solely for this. |
RTSP methods shouldn't mix up with HTTP methods in the method map since they are supported only with the RTSP protocol. Node.js uses `HTTP_METHOD_MAP` to generate `http.METHODS` array and this breaks tests in `body-parser` because it assumes that all of these methods are for HTTP requests. PR-URL: nodejs/llhttp#103 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Daniele Belardi <dwon.dnl@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Beth Griggs <bgriggs@redhat.com>
RTSP methods shouldn't mix up with HTTP methods in the method map since
they are supported only with the RTSP protocol. Node.js uses
HTTP_METHOD_MAPto generatehttp.METHODSarray and this breaks testsin
body-parserbecause it assumes that all of these methods are forHTTP requests.
cc @nodejs/http