http-parser icon indicating copy to clipboard operation
http-parser copied to clipboard

Allow non-standard HTTP method

Open tatsuhiro-t opened this issue 9 years ago • 3 comments

This change adds non-standard HTTP method support. We added new callback on_method of type http_data_cb, which notifies incoming method. For non-standard HTTP method, method field in struct http_parser becomes HTTP_METHOD_UNKNOWN.

The non-standard HTTP method is disabled by default, and must be explicitly enabled by giving -DHTTP_PARSER_METHOD_CB=1 on build time. This is for backward compatibility; because non-standard HTTP method is now accepted rather than rejected.

tatsuhiro-t avatar May 28 '16 10:05 tatsuhiro-t

Not sure you like this PR, it is a bit ugly with lots of if-def dance.

The only concern at the moment is that if HTTP_BOTH is used and this non-standard HTTP method support is enabled, on_method will be called even if it later turns out that it is response.

tatsuhiro-t avatar May 28 '16 10:05 tatsuhiro-t

Is there a use-case for HTTP_BOTH? I can't imagine any real-world scenario where you might get either a request or a response on a connection. As far as I am concerned, this feature could be removed. I would love to hear a counter-example.

vinniefalco avatar May 31 '16 17:05 vinniefalco

Can this PR be moved forward somehow? It is quite old, would be nice to have it merged.

nazar-pc avatar Sep 26 '16 22:09 nazar-pc