LogIOTrackTTFU / %^FU was added to trunk only (r1828727) and never
backported to 2.4.x, so the 'Available in Apache 2.4.34 and later'
claim was incorrect. Correct it to 2.5.1 in both the %^FU format table
entry and the LogIOTrackTTFU directive compatibility line. Also document
that %^FB and %^FU log '-' when tracking is disabled or the measured
point was never reached. PR 70174.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1939346 13f79535-47bb-0310-9956-ffa450edef68
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
ap_duplicate_listeners() ignored the return value of make_sock() for a
duplicated listener. On failure make_sock() logs the error and closes
the socket, but the loop carried on with the closed listener: with one
Listen the server started or restarted with fewer listeners, and with
several it failed on the closed descriptor with a misleading "Bad file
descriptor". Return the error so that the MPM reports "could not
duplicate listeners" with the original status.
PR: 70106
Submitted by: Xuqing Yang
GitHub: closes#861
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1939304 13f79535-47bb-0310-9956-ffa450edef68
* server/util.c (ap_size_parameter_parse): Allow an optional
case-insensitive 'b', 'k', 'm' or 'g' suffix, bounding the
multiplication by the range of apr_off_t.
* include/httpd.h: Update doxygen accordingly.
* test/unit/util.c (size_parameter_parse_handles_suffixes): New test.
* test/modules/core/test_012_config_off_t.py: Update for suffix
support.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
GitHub: PR #851
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1939295 13f79535-47bb-0310-9956-ffa450edef68
This evolved from troubleshooting content under NT4 that had origins outside of
httpd, but likely was never necessary for httpd.
Also remove gory details about how to change the rights of the user.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1939285 13f79535-47bb-0310-9956-ffa450edef68
* modules/md/md_crypt.c (md_asn1_time_get): For OpenSSL >= 1.1.1,
convert the certificate's ASN1_TIME directly via ASN1_TIME_to_tm()
instead of reconstructing it as apr_time_now() + ASN1_TIME_diff().
The latter samples the current time twice (once explicitly, once
inside ASN1_TIME_diff()); if the wall clock ticks over a second
between the two reads, the result is off by one second. This is a
real, reproducible race, not a theoretical one: forcing the two
reads to straddle a second boundary reproduces it in 29-39 out of
40 trials. It intermittently broke the exact-timestamp assertions
in test/modules/md/test_920_status.py::test_md_920_002.
* changes-entries/md-asn1-time-race.txt: Add entry.
GitHub: closes#838
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1939271 13f79535-47bb-0310-9956-ffa450edef68
A MultiViews response took the media type of the selected file as it
was, so the qs source quality set with AddType was sent to the client.
Drop it after the variant has been selected. Other parameters are kept.
PR: 53595
GitHub: closes#824
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1939268 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
Stop reading (and writing) one byte past the end of a file
description when it ends inside an unterminated "&" entity or "<"
tag, as a ScanHTMLTitles title can.
* modules/generators/mod_autoindex.c (terminate_description): Check
for the terminating NUL before advancing past it when scanning an
unterminated "<" tag or "&" entity, and break out of the loop at
end of string rather than continuing past it.
* test/modules/generators/env.py (GeneratorsTestSetup.__init__): Load
mod_autoindex for the generators test suite.
* test/modules/generators/htdocs/autoindex/: New test content.
* test/modules/generators/test_002_autoindex.py (TestAutoindex): New
test that a ScanHTMLTitles description ending in a bare "&" is
rendered without reading past the end of the description.
Submitted by: arshiya tabasum <arshi bugqore.com>
GitHub: closes#812
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1939181 13f79535-47bb-0310-9956-ffa450edef68
* .github/workflows/linux.yml: Add a "Python pytest test suites,
64-bit ARM" job to the matrix, as the existing pytest job but on
the ubuntu-24.04-arm runner.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
GitHub: closes#855
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1939169 13f79535-47bb-0310-9956-ffa450edef68
* test/clients/h2ws.c (main): Use int for the getopt() return value;
with unsigned char (e.g. on aarch64) the -1 terminator is never
matched, so every invocation failed with "invalid option".
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
GitHub: PR #855
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1939168 13f79535-47bb-0310-9956-ffa450edef68
to a script from 256 to APACHE_ARG_MAX, and bound URI/query/env-value
lengths against the configured request limits rather than APR_PATH_MAX.
PR 70270.
* changes-entries/cgid-env-limit.txt: Add changelog entry.
* modules/generators/mod_cgid.c: Replace ENV_COUNT_MAX with ENV_VAL_MAX,
a sanity bound on the length of a single environment variable value.
(get_req): Take the main server_rec as an argument. Allow up to
APACHE_ARG_MAX environment variables; check uri_len and args_len
against the configured LimitRequestLine rather than APR_PATH_MAX;
check each environment variable value against ENV_VAL_MAX.
(send_req): Fail with APR_ENOSPC if more than APACHE_ARG_MAX
environment variables are present.
(cgid_server): Pass main_server to get_req.
* test/modules/generators/htdocs/cgi/: New tests scripts.
* test/modules/generators/test_001_cgid.py: New tests.
Submitted by: Emmanuel Dreyfus <manu netbsd.org>, jorton
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
GitHub: closes#850
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1939165 13f79535-47bb-0310-9956-ffa450edef68
modules/generators/mod_cgi.c (cgi_handler): For the CGI bucket
creation-error path, return a 503 rather than a 500 and log via
log_scripterror().
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1939164 13f79535-47bb-0310-9956-ffa450edef68
ap_size_parameter_parse() returned APR_ERANGE for a value without any
digits where the libc sets EINVAL when nothing is converted (FreeBSD,
musl), and APR_EINVAL with glibc. end == parameter tells portably that
nothing was converted, so check it before the apr_strtoff() status.
APR_EINVAL is for invalid syntax, APR_ERANGE stays for overflow and
underflow.
Use it for LimitXMLRequestBody too, which had its own apr_strtoff()
parsing from #825, so that it reports the same errors as
LimitRequestBody on every platform. No change in the accepted values.
Extend test_012 to check that LimitRequestBody reports invalid syntax
and range errors with their own messages, and to cover
LimitXMLRequestBody.
GitHub: closes#848
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1939163 13f79535-47bb-0310-9956-ffa450edef68
h2_session_shutdown() passed its reason, an APR or nghttp2 status, as the
error code of the GOAWAY frame. A connection timeout was sent as 70007
(APR_TIMEUP), an inadequate TLS connection as 22 (APR_EINVAL).
Give h2_session_shutdown() the HTTP/2 error code as a separate argument.
Timeouts and graceful shutdowns send NO_ERROR, failures INTERNAL_ERROR
and inadequate TLS parameters INADEQUATE_SECURITY.
PR: 70212
GitHub: closes#799
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1939156 13f79535-47bb-0310-9956-ffa450edef68
dav_method_options() builds its own Allow field and unconditionally
advertised TRACE for existing DAV resources, even when TraceEnable was
off.
Respect TraceEnable when constructing the DAV Allow field.
PR: 70264
GitHub: closes#827
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1939146 13f79535-47bb-0310-9956-ffa450edef68
Add ap_size_parameter_parse(), a helper to parse a configuration value
as an apr_off_t, which fails on trailing characters and on overflow.
The range of the value remains up to the directive.
Use it for configuration directives which parsed such values in
different ways, some of them accepting trailing characters or doing no
checks at all: LimitRequestBody (unchanged behavior), ScriptLogLength,
ScriptLogBuffer, DavQuota, BufferSize, AuthFormSize, and the
mod_cache_disk and mod_cache_socache size and time directives.
GitHub: closes#829
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1939129 13f79535-47bb-0310-9956-ffa450edef68
* changes-entries/deflate-xlen-unsigned.txt: Add changes entry.
* modules/filters/mod_deflate.c (consume_zlib_flags): Cast the
FEXTRA length bytes through unsigned char before widening so a
byte with the high bit set is not sign-extended, fixing inflation
of gzip streams carrying an extra field.
Submitted by: arshiya tabasum <arshi bugqore.com>
GitHub: closes#839
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1939124 13f79535-47bb-0310-9956-ffa450edef68
set_limit_xml_req_body() used atol(), so "abc123" and "123abc" were
accepted as 0 and 123, and a value out of range of a long gave an
undefined result. Parse the whole argument with apr_strtoff() like
LimitRequestBody, and reject values that do not fit in limit_xml_body
or exceed AP_MAX_LIMIT_XML_BODY.
PR: 69975
GitHub: closes#825
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1939121 13f79535-47bb-0310-9956-ffa450edef68
consistency and we could use a dummy file in 2.4.x
so changes-entries/ is not dropped by git every
time `make update-changes` empties it.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1939103 13f79535-47bb-0310-9956-ffa450edef68
On Windows, a subrequest (against a different per-dir config?)
could get and cleanup an LDC that the main subrequest will also
cleanup.
Also don't use ldc->r for trace if null for any reason
Submitted by: covener
Github: closes#830
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1939088 13f79535-47bb-0310-9956-ffa450edef68
inside the client hash table:
* modules/aaa/mod_auth_digest.c (struct hash_table): Hold the counter here
as a 64-bit otn_counter, issued under client_lock like next_id rather
than with 32-bit atomics (apr_atomic_inc64 is not available on the
minimum APR).
(initialize_tables): Seed it; drop its separate shared-memory allocation.
(gen_nonce): Issue the ordinal under client_lock.
(set_shmem_size): Account for two allocations rather than three.
* test/modules/aaa/test_006_config_errors.py
(test_digest_069_shmemsize_no_room_for_entry_rejected): Adjust for the
smaller minimum.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
GitHub: close#787
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1939038 13f79535-47bb-0310-9956-ffa450edef68
* modules/aaa/mod_auth_digest.c (set_shmem_size): Parse with apr_strtoff,
reject overflow and trailing junk, and require room for the table, the
counter, and at least one entry including rmm overhead.
* test/modules/aaa/test_006_config_errors.py
(test_digest_068_shmemsize_trailing_junk_rejected,
test_digest_069_shmemsize_no_room_for_entry_rejected): New.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
GitHub: PR #787
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1939036 13f79535-47bb-0310-9956-ffa450edef68
The domain was suppressed for any proxy request, but a reverse-proxied
request authenticates to this server with an origin-style
WWW-Authenticate, so AuthDigestDomain applies to it as it does to a
non-proxied request; only a forward-proxy (PROXYREQ_PROXY) request, whose
challenge is Proxy-Authenticate, should omit it.
* modules/aaa/mod_auth_digest.c (note_digest_auth_failure): Suppress
domain= only for PROXYREQ_PROXY, matching the rest of the file.
* test/modules/aaa/env.py: Load mod_proxy and mod_proxy_http.
* test/modules/aaa/conftest.py: Add a reverse-proxied location which
authenticates with Digest and sets AuthDigestDomain.
* test/modules/aaa/test_013_proxy_domain.py: New test suite.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
GitHub: PR #787
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1939035 13f79535-47bb-0310-9956-ffa450edef68
* modules/aaa/mod_auth_digest.c (copy_uri_components): Return the
ap_unescape_url status rather than discarding it.
(authenticate_digest_user): Fail the request when the request-target or
the Authorization uri does not unescape.
* test/modules/aaa/test_001_challenge_response.py
(test_digest_015_uri_bad_escaping_rejected): New.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
GitHub: PR #787
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1939034 13f79535-47bb-0310-9956-ffa450edef68
* modules/aaa/mod_auth_digest.c (digest_header_rec): Add nc, the parsed
nonce-count.
(parse_digest_header): Require nc to be 8 hex digits (RFC 7616 3.4) and
store its value, so it is well-formed everywhere it is used or echoed.
(check_and_record_nonce): Use the parsed value; drop the local strtol
and the now-unreachable AH01773.
* test/modules/aaa/test_003_nccheck.py
(test_digest_036_malformed_nc_rejected,
test_digest_037_malformed_nc_does_not_poison_client): New.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
GitHub: PR #787
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1939033 13f79535-47bb-0310-9956-ffa450edef68
The per-request record is created in a post_read_request hook, which does
not run for a request rejected earlier (e.g. no Host on HTTP/1.1). An
ErrorDocument directing such a request into a Digest-protected location
then reached the auth hooks, which walked ->prev to the original request
and used its record without checking it had been created.
* modules/aaa/mod_auth_digest.c (make_digest_rec): New, split from
init_digest_request, storing the record on a given request.
(get_digest_rec): New; walk to the shared record and create it if the
originating request never ran init_digest_request.
(authenticate_digest_user, hook_note_digest_auth_failure): Use it in
place of the open-coded walk, which did not check for a missing record.
* test/modules/aaa/conftest.py: Add an ErrorDocument 400 into a
Digest-protected location.
* test/modules/aaa/test_012_errordoc.py: New test suite.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
GitHub: PR #787
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1939032 13f79535-47bb-0310-9956-ffa450edef68