Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upHandle custom methods and protocols #54
Conversation
toddwong
commented
Aug 16, 2020
|
Please someone mege this? |
|
Hey! Thank you for submitting this and sorry I didn't get back to you earlier. Adding new HTTP methods is tricky in HTTP 1.1. According to the protocol different methods might imply presence or absence of body in the request/response. It is not possible to apriori know it without hand-coding this semantic into it. Secondly, and likely more importantly with this patch the burden of parsing the HTTP method is shifted to the user of the library, and the optimization (happening in With this being said, I suggest we close the Pull Request. I wish you would have had a chance to discuss it with us before you created this sizable patch. Sorry to dismiss you work, but I don't think it is in line with the idea of the llhttp. Thanks again! |
|
Hi @indutny, Talking about HTTP 1.1, the RFC 7231 Section 4.1 does not limit HTTP method and defines it as
Some methods are standardized in the same RFC, but there's no RFC that restricts methods. The only requirement is that the method MUST contain only characters in US-ASCII charset. The same RFC also explicit (in section 8.1.2) that
and
According to this section, excluding
Regarding this: it's true, unfortunately, but without a method map, it's unavoidable. In addition, this allows to parse HTTP-like messages, but with another protocol (RTSP for example). For this case the method map is not usable and is removed in the patch.
I think that a roadmap, known issues that will not be fixed or at least the limits that this library will not trespass could help to choose this library as base tool or another parsing library. IMHO the direction was not clear enough, but if this direction is confirmed, I will personally start evaluating another library for my projects or create a fork. |
|
Thank you for an elaborated write-up. Your reasoning behind the patch is very sound. I'd like to invite few members of @nodejs/http here for discussion. There was never a specific roadmap or direction anywhere, but in my head prior to this, but I'm open to improving things! |

Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.

alekitto commentedMar 19, 2020
I've tried to solve #11
This introduced
protocolandmethodadditional spans and removed the static methods map.The removal of the static method map implied a BC break as the http method is now a string and should be retrieved by the embedder registering an
on_methodcallback.It's pretty dirty in the
req_or_respart, where it is trying to guess if the message is a request or a response. IMHO this behavior should be removed completly and the embedder must pass the message type to the parser: I don't really see a real usage application to keep the things mixed up like this.Hope this could help