From afed19a8fc07b66cad2c0df84ff7590f8b3fecee Mon Sep 17 00:00:00 2001 From: Felipe Zipitria Date: Tue, 13 Oct 2026 09:20:57 -0300 Subject: [PATCH] fix: provide ap_map_http_request_error for the standalone build read_request_body() calls ap_map_http_request_error(), which is a symbol of httpd itself (modules/http/http_filters.c), not of APR, so the standalone module (and the IIS/nginx flavours built on it) failed to link since that call was introduced. Builds that define VERSION_STANDALONE, VERSION_IIS or VERSION_NGINX now carry a local copy of the function, taken from httpd, under the same name through a macro so the call site stays identical for the Apache module. Fixes #3451 Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_0181jBv5JdNQviwDzfnkf1Gy --- apache2/apache2_io.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/apache2/apache2_io.c b/apache2/apache2_io.c index 8deeb01c9a..536948146d 100644 --- a/apache2/apache2_io.c +++ b/apache2/apache2_io.c @@ -28,6 +28,33 @@ static void dummy_free_func(void *data) {} #endif +#if defined(VERSION_STANDALONE) || defined(VERSION_IIS) || defined(VERSION_NGINX) +/* ap_map_http_request_error() lives in httpd itself (modules/http/ + * http_filters.c), so builds that do not link against httpd need their own + * copy of it (#3451). */ +static int msc_ap_map_http_request_error(apr_status_t rv, int status) +{ + switch (rv) { + case AP_FILTER_ERROR: + return AP_FILTER_ERROR; + + case APR_ENOSPC: + return HTTP_REQUEST_ENTITY_TOO_LARGE; + + case APR_ENOTIMPL: + return HTTP_NOT_IMPLEMENTED; + + case APR_TIMEUP: + case APR_ETIMEDOUT: + return HTTP_REQUEST_TIME_OUT; + + default: + return status; + } +} +#define ap_map_http_request_error msc_ap_map_http_request_error +#endif + /** * This request filter will forward the previously stored * request body further down the chain (most likely to the