-
Notifications
You must be signed in to change notification settings - Fork 7.3k
HTTP server should allow custom methods #3192
Comments
Related to nodejs/http-parser#92.
You may be surprised. Support for arbitrary request methods would first need to be added to joyent/http-parser in a way that a) doesn't suck (it should have a nice API) and b) imposes no performance penalty. I won't be working on that anytime soon but I will consider pull requests. |
Not in non-brittle ways. There are a number of pure JS HTTP parsers out there, e.g. https://github.com/substack/node-parsley |
I actually ended up adding the required method in the http_parser and node_http_parser sources, and it works fine, but for one specific method only. I'll try to find some time to fork and provide something more generic. Thx for your help. |
+1 I agree to have a proper parser reading HTTP method in compliance with RFC2616 5.1.1 with:
and the latter produced as (defined in RFC2616 2.2):
This is a very limited set of excluded values. And since HTTP's method is contained in very leading octets of a request message there might be simple method reading octet by octet to the first I haven't checked the http_parser.cc in detail, but isn't there such a tokenizer to be reused here for sake of simplicity? |
Revisit for 0.12. |
Just to bring this up again, as 0.12 is on it's way (as far as I can see). Skipping through the source I get the feeling, that the HTTP module deserves a rewrite anyway. |
Yes, the http module needs a lot of work. That's planned for 0.12. Moving the parser to JS is an interesting idea, but not one that'll probably happen for 0.12. |
Hi, just wanted to 👍 this update |
@jezell .. thank you for linking issue #6078 to this. I had missed this existing issue when I opened it. There are a few issues that I'm seeing in this code. The GEM/PUN -> GET/PUT is definitely one (i see there was already a pull request to cover that one); dropping the connection rather than returning a 405 or other error code is another; the complete lack of support for parsing perfectly valid methods is only part of it. |
If nodejs/http-parser#158 lands, then this is trivial to do. If not, then it's impossible. Closing this issue. Please take any discussion over to nodejs/http-parser#158. If/when that lands, we'll do this. |
Hello,
While working with the "http" module, and specifically the http server, I noticed that the server closes the connection instantly if the client attempts to use a custom method (i.e. something else than GET, HEAD...).
I think we should allow custom methods for this server:
On my side, I currently need to use custom methods. Is there any way I could allow a method of my own with your HTTP server without having to hack the code ?
Regards,
Antoine
The text was updated successfully, but these errors were encountered: