1
0
mirror of https://github.com/apache/httpd.git synced 2026-10-23 22:49:01 +03:00

22 Commits

Author SHA1 Message Date
Arturo Bernal
6da0450e00 test: Fix a flaky test_proxy_07_cache_control.py (seen on Windows CI).
The cache entry for the first request is committed by the CACHE_SAVE
filter on the EOS-only pass that follows the body, which can still be
running server side for an instant after the client has already read
the complete body. Two back-to-back requests with no delay can race
this, making the second one miss the cache and hit the backend again.

Give the commit room to land before relying on it, instead of
asserting immediately after the first request returns. Reproduced
locally (about 1 in 5 runs failing, on different parametrized cases
each time, none of them involving a comma) and confirmed fixed (0
failures in 55 runs) before and after this change.

Also harden the TCPFaker backend used by this test to close its
socket with an orderly shutdown() instead of an abrupt close(), which
removes one more way for a slow platform to see a reset instead of a
clean end of response.

GitHub: closes #864


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1939305 13f79535-47bb-0310-9956-ffa450edef68
2026-10-21 05:12:57 +00:00
Arturo Bernal
6f0c237673 mod_cache: Parse comma separated Cache-Control directives again.
cache_strqtok() did not end a token at a comma or whitespace unless an
argument followed, so "private, no-store" was read as one token and the
response was stored. Stop at any non-token character, after the '='
test.

This is a trunk-only regression from r1856507, which rewrote the
tokenizer as a state machine and dropped the T_HTTP_TOKEN_STOP check in
the token state that r1856493 and r1856500 still had.

PR: 70028
GitHub: closes #821


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1939267 13f79535-47bb-0310-9956-ffa450edef68
2026-10-19 10:04:36 +00:00
Jean-Frederic Clere
502faf44d5 Add --strict-optional to prevent success when missing modules.
Submitted by Maya Echtinaw

This closes #808



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1939059 13f79535-47bb-0310-9956-ffa450edef68
2026-10-12 13:14:38 +00:00
Joe Orton
2bb4724f4f Fix broken uwsgi test on windows:
* test/modules/proxy/env.py (ProxyBackend._process): read 8192 bytes
  on Windows and 4096 elsewhere to avoid short reads on win32.

Submitted by: Paul Lodge <paullodge outlook.com>
GitHub: closes #785


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1938786 13f79535-47bb-0310-9956-ffa450edef68
2026-10-05 07:24:48 +00:00
Joe Orton
3fc5caa57b CMake: Build mod_proxy_uwsgi; enable mod_mime_magic by default:
* CMakeLists.txt: Add mod_proxy_uwsgi, linked against mod_proxy.
  Change mod_mime_magic from optional to included by default.

* test/modules/proxy/test_03_uwsgi.py: Remove duplicate copy of the
  module appended after the first.
  (_proxy_uwsgi_setup): Add LogLevel trace4.

* test/modules/proxy/uwsgi_faker.py: Remove duplicate copy of the
  module appended after the first.

Submitted by: Paul Lodge <paullodge outlook.com>
GitHub: closes #781


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1938757 13f79535-47bb-0310-9956-ffa450edef68
2026-10-02 09:05:43 +00:00
Eric Covener
9c4d210cd2 drop hop-by-hop headers from UWSGI
Submitted By: Maya Echtinaw



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1938690 13f79535-47bb-0310-9956-ffa450edef68
2026-09-29 11:28:03 +00:00
Rainer Jung
96276a79a3 Prevent 'f-string expression part cannot include a backslash'
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1938416 13f79535-47bb-0310-9956-ffa450edef68
2026-09-22 07:52:20 +00:00
Joe Orton
82313d0a96 * modules/metadata/mod_remoteip.c (remoteip_modify_request): Trim
trailing spaces using a one-past-the-end pointer, so the pointer is
  never decremented to before the start of the buffer when the
  token is empty.  Test for an empty token with equality instead.

* test/modules/proxy/test_03_response.py (TestProxyResponse): Add
  127.0.0.1 as a trusted RemoteIP proxy.
  (test_proxy_03_004): Move after test_proxy_03_002.
  (test_proxy_03_005): New test: an X-Forwarded-For header ending in
  an empty token must still get a 200 response.

Submitted by: Robert McConnell <robert mcc0nnell.org>
GitHub: closes #756


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1938292 13f79535-47bb-0310-9956-ffa450edef68
2026-09-16 14:36:32 +00:00
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
Joe Orton
1c116fc738 mod_proxy_connect: Implement "AllowCONNECT None":
The "none" arg is documented somehow in r1932337, but not implemented.

* modules/proxy/mod_proxy_connect.c (connect_conf): Add "None".
  (set_allowed_ports): Accept "None"; reject combining it with ports in
  the same context.
  (merge_config): Special-case "None": it disallows all ports and
  overrides an inherited list, and an inherited "None" is overridden by
  a port list in a vhost; two port lists still merge as a union.
  (allowed_port): Disallow all ports when "none" is set.

* docs/manual/mod/mod_proxy_connect.xml: Clarify the merge behaviour and
  the "None" restriction.

* test/modules/proxy/test_07_connect.py: Added.

* test/modules/proxy/env.py: Load mod_proxy_connect for the suite.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Github: closes #719


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1937537 13f79535-47bb-0310-9956-ffa450edef68
2026-08-27 20:39:05 +00:00
Joe Orton
fbedef2af2 * modules/http/http_filters.c (validate_status_line): Only accept
space as the status-code separator, not other whitespace.

* server/protocol.c (ap_send_interim_response): Reject control
  characters in the reason phrase of interim responses.

* test/modules/proxy/test_06_interim_resp.py: New test case.

Assisted-by: Claude Opus 4.6 <noreply@anthropic.com>
GitHub: closes #702


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1937041 13f79535-47bb-0310-9956-ffa450edef68
2026-08-10 12:49:40 +00:00
Giannis Christodoulou
62147ea0da test/modules/proxy: Add test for uwsgi headers
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1936420 13f79535-47bb-0310-9956-ffa450edef68
2026-07-21 10:13:35 +00:00
Giannis Christodoulou
ba1d85a6e5 mod_proxy_ajp: Add protocol robustness tests
Add coverage for AJP message size limits, header length handling,
and chunk message handling.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1934964 13f79535-47bb-0310-9956-ffa450edef68
2026-06-04 07:32:47 +00:00
Giannis Christodoulou
291000fb94 mod_proxy: add response handling tests
Add coverage for backend Content-Type handling, X-Forwarded-*
headers and request body preservation during balancer failover.

Add a simple TCP backend faker used by the tests.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1934963 13f79535-47bb-0310-9956-ffa450edef68
2026-06-04 06:55:13 +00:00
Stefan Eissing
1d7ba6ce10 modern python fixes:
- rename hook parameter, because python thought this is a super good idea
- change call property to method because it no longer worked



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1933904 13f79535-47bb-0310-9956-ffa450edef68
2026-05-07 09:46:23 +00:00
Rainer Jung
f889bcb228 Make sure pytest shuts down the web server after each package
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1919265 13f79535-47bb-0310-9956-ffa450edef68
2024-07-15 22:34:32 +00:00
Yann Ylavic
ac622813b2 pytests: Ignore log errors/warnings per function.
It's easier to control errors at the function scope and it avoids ignored
errors/warnings to propagate to the following tests (i.e. mask further
unexpected errors).

github: closes #371



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1910844 13f79535-47bb-0310-9956-ffa450edef68
2023-07-07 08:21:21 +00:00
Stefan Eissing
499480e507 *) test: check for recent curl version in proxy tests
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1909560 13f79535-47bb-0310-9956-ffa450edef68
2023-05-02 09:03:32 +00:00
Stefan Eissing
3e835f22af *) mod_ssl: when a proxy connection had handled a request using SSL, an
error was logged when "SSLProxyEngine" was only configured in the
     location/proxy section and not the overall server. The connection
     continued to work, the error log was in error. Fixed PR66190.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1903167 13f79535-47bb-0310-9956-ffa450edef68
2022-08-01 12:56:11 +00:00
Yann Ylavic
c05638b072 test: fully qualified URIs should work through reverse proxy too.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1896043 13f79535-47bb-0310-9956-ffa450edef68
2021-12-16 11:23:41 +00:00
Stefan Eissing
f42a58f70b *) test: modules/proxy, make uds faker a daemon thread, so it does not
prevent test shutdown.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1896041 13f79535-47bb-0310-9956-ffa450edef68
2021-12-16 11:22:29 +00:00
Stefan Eissing
928f80ea4c *) test: added first mod_proxy tests in test/modules/proxy that
check some variations on forward, reverse and mixed vhosts
     and also using a unix: domain socket backend.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1896002 13f79535-47bb-0310-9956-ffa450edef68
2021-12-15 16:39:38 +00:00