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

250 Commits

Author SHA1 Message Date
Jean-Frederic Clere
4bc8d94974 Add a test for Bug 69743
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1939335 13f79535-47bb-0310-9956-ffa450edef68
2026-10-22 12:42:23 +00:00
Jean-Frederic Clere
11c896fd0e Allow the --httpd --conf parameter in unix too.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1939326 13f79535-47bb-0310-9956-ffa450edef68
2026-10-22 09:44:34 +00:00
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
Joe Orton
973155ccd4 core: Accept a b/k/m/g suffix in size-valued directive parameters:
* 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
2026-10-20 19:29:29 +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
Joe Orton
54cc53eb4b mod_autoindex: fix one-byte over-read past end of description
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
2026-10-17 11:18:52 +00:00
Joe Orton
e3a8b4e1e6 mod_cgid: Raise the limit on the number of environment variables passed
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
2026-10-16 18:55:52 +00:00
Arturo Bernal
93d7164cf4 core: Distinguish invalid size parameters from range errors
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
2026-10-16 17:06:47 +00:00
Arturo Bernal
3c8bb1b370 mod_http2: Send HTTP/2 error codes in GOAWAY frames
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
2026-10-16 14:41:25 +00:00
Arturo Bernal
261058fa22 mod_dav: Do not advertise disabled TRACE
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
2026-10-16 09:01:44 +00:00
Arturo Bernal
ba3fa29664 core: Add common apr_off_t config parser
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
2026-10-15 03:41:47 +00:00
Arturo Bernal
c1b7c82f7e core: Reject invalid values of LimitXMLRequestBody.
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
2026-10-14 17:07:23 +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
899294692f mod_auth_digest: Widen the one-time-nonce counter to 64 bits and move
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
2026-10-11 13:55:33 +00:00
Joe Orton
df14898a97 mod_auth_digest: Validate AuthDigestShmemSize properly:
* 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
2026-10-11 13:50:42 +00:00
Joe Orton
288f73763c mod_auth_digest: Send Digest domain= for a reverse-proxied request:
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
2026-10-11 13:44:17 +00:00
Joe Orton
ecdf990056 mod_auth_digest: Reject an Authorization uri which fails to unescape:
* 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
2026-10-11 13:42:22 +00:00
Joe Orton
4843e52321 mod_auth_digest: Validate the nonce-count when parsing the header:
* 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
2026-10-11 13:29:47 +00:00
Joe Orton
18309c6c04 mod_auth_digest: Fix handling of a request with no per-request record:
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
2026-10-11 13:29:04 +00:00
Joe Orton
6838b9868e mod_auth_digest: Widen client ids to 64 bits:
* modules/aaa/mod_auth_digest.c (client_id_t): Widen to apr_uint64_t.
  (CLIENT_ID_MAX): New.
  (initialize_tables): Cap the seed at CLIENT_ID_MAX.
  (client_generate): Issue ids in 1..CLIENT_ID_MAX.
  (client_exists, client_update_nonce, client_generate): Log ids with
  APR_UINT64_T_FMT.
  (parse_digest_header): Parse the opaque with apr_strtoi64(), returning
  INVALID if it is not in 1..CLIENT_ID_MAX.
  (authenticate_digest_user): Remove the now-unreachable invalid opaque
  check (AH01787); mention an invalid opaque in AH01782.
  (ltox): Rename to...
  (client_id_to_opaque): ...this; format with APR_UINT64_T_HEX_FMT.
  (note_digest_auth_failure): Update callers.

* test/modules/aaa/test_001_challenge_response.py
  (test_digest_013_invalid_opaque): Accept AH01782 as well as AH01787.

* test/modules/aaa/test_003_nccheck.py
  (test_digest_035_out_of_range_opaque_is_not_truncated): Try opaques
  2^32 and 2^64 above the live id.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
GitHub: PR #787


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1939031 13f79535-47bb-0310-9956-ffa450edef68
2026-10-11 13:28:02 +00:00
Jean-Frederic Clere
f6b14daf42 Those are failing on my box.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1938986 13f79535-47bb-0310-9956-ffa450edef68
2026-10-10 12:53:01 +00:00
Joe Orton
1d27502fb5 * test/modules/filters/test_003_sed.py (TestSed.configure): Check a
failing configuration with httpd -t, and return its stderr;
  apachectl_stderr is not set on Windows.
  (test_filters_003_32, test_filters_003_35, test_filters_003_38,
  test_filters_003_39, test_filters_003_40, test_filters_003_42,
  test_filters_003_44, test_filters_003_45, test_filters_003_46): Use it.

* changes-entries/sed-fixes.txt: Add entry.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
GitHub: closes #791


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1938966 13f79535-47bb-0310-9956-ffa450edef68
2026-10-09 19:37:33 +00:00
Joe Orton
59ca067cb2 mod_sed: Fix handling of malformed scripts:
* modules/filters/sed0.c (fcomp): Reject { nested more than SED_DEPTH
  deep, and an s or y command with no delimiter.
  (ycomp): Index the translation table by the unsigned value of each
  byte.
  (comple): Return NULL from a failed compile without storing circf.
  (address): Reject a line number too large for apr_int64_t.

* test/modules/filters/test_003_sed.py (test_filters_003_37,
  test_filters_003_38, test_filters_003_42, test_filters_003_43,
  test_filters_003_44, test_filters_003_46, test_filters_003_47): New
  tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
GitHub: PR #791


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1938965 13f79535-47bb-0310-9956-ffa450edef68
2026-10-09 19:37:21 +00:00
Joe Orton
968022ebc5 * modules/filters/mod_sed.c (sed_request_filter): Fix handling of the
Content-Length request header; unset it after reading from the next
  filter.

* test/pyhttpd/mod_aptest/mod_aptest.c (aptest_getline_echo): Buffer
  the body, and return the Content-Length request header left after
  reading it in an AP-Test-Content-Length response header.

* test/modules/filters/test_003_sed.py (test_filters_003_34): New test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
GitHub: PR #791


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1938964 13f79535-47bb-0310-9956-ffa450edef68
2026-10-09 19:37:05 +00:00
Joe Orton
f16faef3c2 * modules/filters/mod_sed.c (sed_request_filter): Fix handling of
AP_MODE_GETLINE reads, returning a line of the filtered body; fail
  other modes besides AP_MODE_READBYTES with APR_ENOTIMPL.  Always
  read with AP_MODE_READBYTES from the next filter.

* test/pyhttpd/mod_aptest/mod_aptest.c (aptest_getline_echo): New
  handler.
  (aptest_hooks): Register it.

* test/modules/filters/test_003_sed.py (test_filters_003_33): New test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
GitHub: PR #791


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1938963 13f79535-47bb-0310-9956-ffa450edef68
2026-10-09 19:36:48 +00:00
Joe Orton
7bf5604a5b mod_sed: Fix handling of malformed regular expressions:
* modules/filters/regexp.c (sed_compile): Reject \{m,n\} following
  anything but a character, "." or a bracket expression, or following
  another \{m,n\}.  Track which groups have been closed rather than how
  many, and check \N against that.  Reject a bracket expression which
  ends after a range's "-".  Treat a NUL as a missing delimiter.
  Compare the delimiter as an unsigned char.  Check the \{m,n\} count
  limit as each digit is read.
  (regerr): Add error 47.

* test/modules/filters/test_003_sed.py (TestSed.configure): Add fails
  argument.  Write directives given as bytes to a file of their own and
  Include it.
  (test_filters_003_31, test_filters_003_32, test_filters_003_35,
  test_filters_003_36, test_filters_003_39, test_filters_003_40,
  test_filters_003_41, test_filters_003_45): New tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
GitHub: PR #791


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1938962 13f79535-47bb-0310-9956-ffa450edef68
2026-10-09 19:36:41 +00:00
Joe Orton
1b352ed2f3 Add regression test for Digest auth with a truncated nonce:
* test/modules/aaa/test_012_truncated_nonce.py
  (TestDigestTruncatedNonce.test_digest_012_01): New test.  Request a
  Digest challenge, truncate the nonce by stripping the base64 time
  prefix up to the '=', and send an Authorization header built with the
  truncated nonce.  Expect a 401 response and ignore the logged AH01782
  error.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Submitted by: Paul Lodge <plodge redhat.com>
GitHub: closes #798


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1938930 13f79535-47bb-0310-9956-ffa450edef68
2026-10-08 21:19:15 +00:00
Joe Orton
3f95bd3fe6 mod_remoteip: PROXY protocol: handle a peer going away before the header,
and test the LOCAL command.

* modules/metadata/mod_remoteip.c (remoteip_input_filter): Log EOF while
  reading the PROXY protocol header at info level, as the peer going away;
  other read errors are still logged as errors.  Skip metadata buckets
  rather than copying from them: the EOS bucket arriving before the EOF
  was passed to memcpy() as a NULL source.

* test/modules/metadata/test_004_remoteip.py (test_metadata_004_03,
  test_metadata_004_04, test_metadata_004_05, test_metadata_004_06): Test
  PROXY protocol v2 with the PROXY and LOCAL commands, with and without an
  address block, and a peer disconnecting after a partial header.

PR: 63893
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
GitHub: closes #805


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1938927 13f79535-47bb-0310-9956-ffa450edef68
2026-10-08 20:04:38 +00:00
Joe Orton
47717ee2e4 mod_remoteip: Apply RemoteIP{Trusted,Internal}ProxyList to the virtual host
they are configured in, and fix merging.

* modules/metadata/mod_remoteip.c
  (merge_remoteip_server_config): When both the main server and the virtual
  host have proxymatch_ip entries, merge the two arrays.
  (remoteip_hook_post_config): Log a warning (APLOGNO 10633) for each
  virtual host whose proxy entries were merged with the main server's.
  (remoteip_cmds): Drop EXEC_ON_READ from RemoteIPTrustedProxyList and
  RemoteIPInternalProxyList so the directives apply in the server/vhost
  scope they are configured in, rather than globally at config read time.

* test/modules/metadata/test_004_remoteip.py: New test.

* test/modules/metadata/env.py
  (MetadataTestSetup.__init__): Add remoteip to the optional modules.

PR: 70207
Submitted by: Arturo Bernal <abernal apache.org>
GitHub: closes #793


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1938908 13f79535-47bb-0310-9956-ffa450edef68
2026-10-08 08:31:23 +00:00
Joe Orton
8dbd2836d0 mod_socache_redis: Fix the unit of the RedisTimeout passed to the Redis
client.

* modules/cache/mod_socache_redis.c
  (RD_DEFAULT_SERVER_RWTO): Define in seconds rather than microseconds.
  (socache_rd_set_timeout): Convert the timeout from apr_time_t to whole
  seconds, rounding up so a positive value does not become 0.

* test/modules/ssl/env.py
  (SSLTestSetup.__init__): Add socache_redis as an optional module.

* test/modules/ssl/test_004_socache_redis.py: New test using a silent
  Redis server to verify that RedisTimeout values are applied with the
  expected whole-second rounding.

Submitted by: Christophe JAILLET, Arturo Bernal <abernal apache.org>
GitHub: closes #790


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1938833 13f79535-47bb-0310-9956-ffa450edef68
2026-10-06 20:16:47 +00:00
Joe Orton
235f9c7cde mod_http2: support the asterisk-form of OPTIONS requests.
* modules/http2/h2_stream.c (h2_stream_create_input): do not reject a
  ':path' of '*' with a ':scheme' present when the method is OPTIONS
  over http/https; pass the asterisk-form through as is.

* test/modules/http2/test_203_rfc9113.py (test_h2_203_03_options_asterisk,
  test_h2_203_04_invalid_path): Add tests.

Submitted by: Arturo Bernal <abernal apache.org>
PR: 70195
GitHub: closes #788


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1938821 13f79535-47bb-0310-9956-ffa450edef68
2026-10-06 14:16:26 +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
Eric Covener
bdd9f76b28 add dav tests for r1938681
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1938684 13f79535-47bb-0310-9956-ffa450edef68
2026-09-29 09:08:43 +00:00
Eric Covener
6ddc724e03 don't use CT as handler
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1938649 13f79535-47bb-0310-9956-ffa450edef68
2026-09-29 08:10:35 +00:00
Joe Orton
9a3dbc068c Add new pyhttpd-based test coverage for mod_cgid:
* modules/generators/mod_cgid.c (cgid_server): Log the daemon's pid
  at TRACE1 (so the tests can kill the daemon).

* test/modules/generators/: New test suite.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
GitHub: closes #772


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1938602 13f79535-47bb-0310-9956-ffa450edef68
2026-09-28 10:49:09 +00:00
Joe Orton
837965fd1e mod_env: Add the SetEnvFromFile directive:
* modules/metadata/mod_env.c (add_env_module_vars_from_file): New.
  (env_module_cmds): Add SetEnvFromFile.

* docs/manual/mod/mod_env.xml: Document SetEnvFromFile.

* test/modules/metadata/env.py (MetadataTestSetup.__init__): Load
  mod_env and mod_include, and enable their logging.

* test/modules/metadata/test_002_setenvfromfile.py: New tests.

Submitted by: Cornel Isbiceanu <cisbiceanu adobe.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
GitHub: closes #750


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1938506 13f79535-47bb-0310-9956-ffa450edef68
2026-09-24 20:55:45 +00:00
Joe Orton
4a5adee12e * test/modules/ssl/test_003_verify_client_perdir.py: New test suite.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
GitHub: closes #770


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1938505 13f79535-47bb-0310-9956-ffa450edef68
2026-09-24 20:32:52 +00:00
Joe Orton
2de7f9f72a * test/modules/md/dns01.py, test/modules/md/dns01_v2.py (curl_bin):
Use the curl binary the test framework is configured with.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
GitHub: PR #768


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1938497 13f79535-47bb-0310-9956-ffa450edef68
2026-09-24 15:32:42 +00:00
Joe Orton
a56dc55069 * test/modules/md/dns01_record.py,
test/modules/md/test_721_dns01.py: New test suite.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
GitHub: PR #768


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1938495 13f79535-47bb-0310-9956-ffa450edef68
2026-09-24 15:32:09 +00:00
Joe Orton
4231ec41f7 * test/modules/filters/test_003_sed.py: New test suite.
* test/modules/filters/env.py (FiltersTestSetup.__init__): Load a CGI
  module.

* test/modules/filters/htdocs/test1/cgi/echo.py,
  test/modules/filters/htdocs/test1/cgi/nobody.py: New.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
GitHub: closes #769


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1938492 13f79535-47bb-0310-9956-ffa450edef68
2026-09-24 14:49:00 +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
7b93fd7027 mod_sed: fix out-of-bounds read when a y/// command has mismatched string lengths
* modules/filters/sed0.c (ycomp): Stop parsing after reporting
  SEDERR_TSNTSS when the destination string is shorter than the
  source string.  Previously the loop kept advancing tsp past the
  closing delimiter and past the NUL terminator of the command
  line, reading beyond the end of linebuf and eventually reporting
  a bogus "ending delimiter missing" error.

Submitted by: Ankit Prateek <ankit offbyquant.com>

* test/modules/filters/test_002_sed_ycomp.py: New test.  Check that
  y/// commands with unequal string lengths are rejected with the
  size-mismatch error rather than the delimiter error, in both
  directions, and that a well-formed y/// still compiles and the
  server starts.  Skipped on Windows, where "httpd -k start" is
  service control and fails before the configuration is read.

* test/modules/filters/env.py (FiltersTestSetup.__init__): Load
  mod_sed.
  (FiltersTestEnv.__init__): Add sed to the logged modules.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
GitHub: closes #766, closes #678


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1938337 13f79535-47bb-0310-9956-ffa450edef68
2026-09-17 21:17:38 +00:00
Joe Orton
6340a316eb mod_http2: log request header limit violations only once per stream.
* modules/http2/h2_stream.c (h2_stream_add_header): Guard the AH10178,
  AH10180 and AH10181 log messages on stream->request_headers_failed
  rather than h2_stream_is_ready().
  (h2_stream_end_headers): Likewise for AH10230.

Submitted by: Michael Kaufmann <mail michael-kaufmann.ch>

* test/modules/http2/test_111_header_limit_log.py: New test, checking
  that AH10181 is logged exactly once for a request with many headers
  over LimitRequestFields.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
GitHub: closes #765, closes #666


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1938328 13f79535-47bb-0310-9956-ffa450edef68
2026-09-17 19:12:18 +00:00
Joe Orton
8983e3a2ce * modules/filters/mod_substitute.c (do_pattmatch): Enforce max line
length on unmatched tail.  Account for the unmatched tail after a 
  successful substitution before emitting the result. This keeps 
  SubstituteMaxLineLength effective for flattened literal substitutions 
  and for both regular-expression paths.

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

Add test coverage:

* test/modules/filters/__init__.py,
  test/modules/filters/conftest.py,
  test/modules/filters/env.py,
  test/modules/filters/test_001_substitute_maxlen.py: New test suite.

GitHub: closes #762
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1938306 13f79535-47bb-0310-9956-ffa450edef68
2026-09-17 06:52:02 +00:00
Joe Orton
9c290da241 Revert r1938297 - mod_md tests now hung / timed out in
https://github.com/apache/httpd/actions/runs/35140492695/job/104943495269

modules/md/test_702_auto.py ................FEFEFE.EFEFEFEFE.EFEssFEFE   [ 81%]
modules/md/test_710_profiles.py FEFEFEFE                                 [ 81%]
Error: The operation was canceled.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1938300 13f79535-47bb-0310-9956-ffa450edef68
2026-09-16 21:26:49 +00:00
Joe Orton
5105d900ef * test/pyhttpd/env.py (apache_fail): Check the exit code of the
"start" result rather than comparing the ExecResult to 0, which
  never matched, so a started server was never waited for and could
  race with the next test.

* test/modules/md/test_300_conf_validate.py (test_md_300_011a,
  test_md_300_021): Expect the server to start, since an unmanaged
  vhost name only logs a warning; this was hidden by the broken
  apache_fail() check.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
GitHub: closes #759


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1938297 13f79535-47bb-0310-9956-ffa450edef68
2026-09-16 19:25:25 +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
d3a6a151c5 * modules/http/http_protocol.c (make_allow): Don't check for the
M_INVALID bit being set in the method mask if unregistered methods
  are allowed. That bit is never set by ap_method_list_add(), and this
  branch adding unregistered methods to Allow: never followed.

* test/pyhttpd/mod_aptest/mod_aptest.c (aptest_allow_methods): New; pass
  the methods named in an AP-Test-Allow-Methods request header to
  ap_allow_methods().

* test/modules/core/test_009_allow_methods.py: New test suite.

GitHub: closes #758, closes #428
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1938291 13f79535-47bb-0310-9956-ffa450edef68
2026-09-16 14:27:37 +00:00