joyent/http-parser — Issue #92: Parser error when parsing request line with a non standard HTTP method
Author: pbuyle
Created: 2012-02-17 22:08:01+00:00
State: open

I'm trying to serve PURGE request from a HTTP server implemented using Node.JS. PURGE requests are used by Squid and Varnish to purge objects from their cache (cf. http://wiki.squid-cache.org/SquidFaq/OperatingSquid#How_can_I_purge_an_object_from_my_cache.3F and https://www.varnish-cache.org/docs/trunk/tutorial/purging.html).

But Node.JS's HTTP server does let not my code serve non-standard HTTP method. Instead, when receiving a request line using a non-standard method, the server close the connection after a parser error. So it seems that http_parser does not support non-standard methods.

According to the HTTP 1.1 specification (rfc2616, section 5.1), the method of a request line can be any valid token. So it seems natural to expect an HTTP parser to accept any method in the request line. It is up to the parser user to properly handle unknown method.