1
0
mirror of https://github.com/apache/httpd.git synced 2026-10-23 22:49:01 +03:00
Files
apache/server
Joe Orton 246ae2739e 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.

Submitted by: Robert McConnell <robert mcc0nnell.org>, jorton
GitHub: closes #749
Assisted-By: Claude Opus 4.8 <noreply@anthropic.com>


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1938194 13f79535-47bb-0310-9956-ffa450edef68
2026-09-14 11:05:50 +00:00
..
2011-01-17 10:45:54 +00:00
2022-04-04 08:24:09 +00:00
2025-08-20 13:39:03 +00:00
2024-01-24 14:44:49 +00:00
2020-11-07 18:59:15 +00:00
2017-09-22 13:13:44 +00:00
2016-12-21 16:19:26 +00:00
2021-04-17 20:13:28 +00:00