From f9d96c89db9fd04d5bc0e21d819e3da22a75cd6e Mon Sep 17 00:00:00 2001 From: Stefan Fritsch Date: Fri, 9 Nov 2012 19:38:19 +0000 Subject: [PATCH] Expose ap_method_register() to the admin with a new RegisterHttpMethod directive. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1407599 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES | 3 +++ docs/manual/mod/core.xml | 16 ++++++++++++++++ server/core.c | 11 +++++++++++ 3 files changed, 30 insertions(+) diff --git a/CHANGES b/CHANGES index 92381809ce7..a16b1c2904e 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,9 @@ -*- coding: utf-8 -*- Changes with Apache 2.5.0 + *) core: New directive RegisterHttpMethod for registering non-standard + HTTP methods. [Stefan Fritsch] + *) mod_xml2enc: Fix problems with charset conversion altering the Content-Length. [Micha Lenk ] diff --git a/docs/manual/mod/core.xml b/docs/manual/mod/core.xml index dd59bfae4d6..b8e4767c02c 100644 --- a/docs/manual/mod/core.xml +++ b/docs/manual/mod/core.xml @@ -4403,4 +4403,20 @@ hostname or IP address different sections are combined when a request is received + +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 d63b989f17a..871c1c9750f 100644 --- a/server/core.c +++ b/server/core.c @@ -3633,6 +3633,15 @@ static const char *set_http_protocol(cmd_parms *cmd, void *dummy, return NULL; } +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, @@ -4134,6 +4143,8 @@ AP_INIT_TAKE1("TraceEnable", set_trace_enable, NULL, RSRC_CONF, "'on' (default), 'off' or 'extended' to trace request body content"), AP_INIT_TAKE1("HttpProtocol", set_http_protocol, NULL, RSRC_CONF, "'+0.9' (default) or '-0.9' to allow/deny HTTP/0.9"), +AP_INIT_ITERATE("RegisterHttpMethod", set_http_method, NULL, RSRC_CONF, + "Registers non-standard HTTP methods"), { NULL } }; -- 2.47.2