From: William A. Rowe Jr Date: Thu, 3 Nov 2016 18:01:23 +0000 (+0000) Subject: Expose ap_method_register() to the admin with a new RegisterHttpMethod X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=14e341118d5e0ff9da26904fc83d29c3a9f7e4c6;p=thirdparty%2Fapache%2Fhttpd.git Expose ap_method_register() to the admin with a new RegisterHttpMethod directive. Backports: r1407599 Submitted by: sf git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x-merge-http-strict@1767942 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/CHANGES b/CHANGES index dd23d8c4853..5744a1a91c8 100644 --- a/CHANGES +++ b/CHANGES @@ -2,6 +2,9 @@ Changes with Apache 2.4.24 + *) core: New directive RegisterHttpMethod for registering non-standard + HTTP methods. [Stefan Fritsch] + *) core: New directive HttpProtocol which allows to disable HTTP/0.9 support. [Stefan Fritsch] diff --git a/docs/manual/mod/core.xml b/docs/manual/mod/core.xml index 72f4c777e66..08c1b323b92 100644 --- a/docs/manual/mod/core.xml +++ b/docs/manual/mod/core.xml @@ -4766,5 +4766,20 @@ as if 'QualifyRedirectURL ON' was configured. + +RegisterHttpMethod +Register non-standard HTTP methods +RegisterHttpMethod method [method [...]] +server config + + +

HTTP Methods that are not conforming to the relvant RFCs are normally +rejected by request processing in Apache HTTPD. To avoid this, modules +can register non-standard HTTP methods they support. +The RegisterHttpMethod allows to register such +methods manually. This can be useful for if such methods are forwared +for external processing, e.g. to a CGI script.

+
+
diff --git a/server/core.c b/server/core.c index 4cb03ff8546..58b95ccf2bc 100644 --- a/server/core.c +++ b/server/core.c @@ -3917,6 +3917,15 @@ static const char *set_http_protocol(cmd_parms *cmd, void *dummy, return "HttpProtocol must be min=0.9|1.0"; } +static const char *set_http_method(cmd_parms *cmd, void *conf, const char *arg) +{ + const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); + if (err != NULL) + return err; + ap_method_register(cmd->pool, arg); + return NULL; +} + static apr_hash_t *errorlog_hash; static int log_constant_item(const ap_errorlog_info *info, const char *arg, @@ -4443,6 +4452,8 @@ AP_INIT_TAKE1("ProtocolsHonorOrder", set_protocols_honor_order, NULL, RSRC_CONF, "by default the client specified order determines selection"), AP_INIT_TAKE1("HttpProtocol", set_http_protocol, NULL, RSRC_CONF, "'min=0.9' (default) or 'min=1.0' to allow/deny HTTP/0.9"), +AP_INIT_ITERATE("RegisterHttpMethod", set_http_method, NULL, RSRC_CONF, + "Registers non-standard HTTP methods"), { NULL } };