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
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
* 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
* 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
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
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
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
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
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
- 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
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
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