Hi Joe and all,
Am 14.09.26 um 13:05 schrieb [email protected]:
Author: jorton
Date: Mon Sep 14 11:05:50 2026
New Revision: 1938194
Log:
core: Add ap_cstr_stripws() to strip trailing whitespace from a
NUL-terminated string in place, returning a pointer to the new
terminating NUL.
* include/httpd.h: Declare ap_cstr_stripws().
* server/util.c (ap_cstr_stripws): Implement it, handling the
empty-string case safely.
(ap_getline): Use it; adjust the returned length and memmove size
accordingly.
* modules/http/byterange_filter.c, modules/mappers/mod_negotiation.c,
modules/metadata/mod_cern_meta.c, modules/proxy/mod_proxy_hcheck.c,
modules/proxy/mod_proxy_http.c, modules/proxy/mod_proxy_uwsgi.c,
server/util_script.c: Replace open-coded trailing-whitespace
stripping loops with ap_cstr_stripws(). This avoids the undefined
behaviour of forming &value[strlen(value)-1], which points before
the start of the string when the value is empty.
* modules/metadata/mod_cern_meta.c, server/util_script.c: Use
apr_pstrmemdup() with the returned end pointer rather than
apr_pstrdup().
* include/ap_mmn.h: Bump MMN minor.
* test/unit/util.c: Add ap_cstr_stripws() unit tests.
* test/modules/proxy/test_03_response.py,
test/modules/proxy/test_05_uwsgi.py: Add tests for empty backend
response header values.
These two tests seem to succeed when backported to 2.4.x. Not sure,
whether they only make sense to check the new trunk ap_cstr_stripws(),
or whether it would be useful if I merged just the two tests to 2.4.x?
Thanks and regards,
Rainer