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
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
the executable bit for .cgi scripts as well as .py scripts, so CGI
scripts not named *.py can be run on Windows where the interpreter is
located from the script shebang.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1938687 13f79535-47bb-0310-9956-ffa450edef68
HttpdTestSetup.add_cgi_module): New, so a suite can ask for CGI
without naming mod_cgid.
(HttpdTestSetup._make_modules_conf): Use _cgi_module() for a
requested "cgid" on every platform, not just Windows.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
GitHub: PR #769
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1938491 13f79535-47bb-0310-9956-ffa450edef68
"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
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
* test/pyhttpd/log.py (HttpdErrorLog.current_pos, .wait_for): New
methods, to wait for a line logged after a noted position.
* test/pyhttpd/env.py (HttpdTestEnv._apache_signal_restart): New method:
run "httpd -k restart" or "-k graceful", which only signal the parent,
then wait for the MPM to log "resuming normal operations" before
checking is_live(). Until then the answer may come from the old
generation, with the old config and about to be killed, which showed
up as an empty reply in test_core_008_03_repeated under ASan.
(apache_reload, apache_hard_restart): Use it.
Fixes: 7172909eac ("test/modules/core/test_008_restart.py: New test suite for server restart handling.")
GitHub: see also #733
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
GitHub: closes#737
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1937877 13f79535-47bb-0310-9956-ffa450edef68
Done with the help of Claude Code Opus 4.6
this closes#731
M test/modules/http1/env.py
M test/modules/http2/env.py
M test/modules/http2/test_006_assets.py
M test/modules/http2/test_103_upgrade.py
M test/modules/http2/test_104_padding.py
M test/modules/http2/test_107_frame_lengths.py
M test/modules/http2/test_202_trailer.py
M test/modules/http2/test_400_push.py
M test/modules/http2/test_401_early_hints.py
M test/modules/http2/test_710_load_post_static.py
M test/modules/http2/test_711_load_post_cgi.py
M test/pyhttpd/certs.py
M test/pyhttpd/conf/httpd.conf.template
M test/pyhttpd/env.py
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1937863 13f79535-47bb-0310-9956-ffa450edef68
* test/pyhttpd/env.py (HttpdTestEnv.set_httpd_env, _clean_path_env):
Allow a suite to add variables to the environment httpd is started
with.
* test/pyhttpd/conf/stop.conf.template: Set DefaultRuntimeDir and
PidFile to match httpd.conf, so that "apachectl -k stop" finds the
running server.
* .github/workflows/linux.yml: Enable systemd testing in the reduced
exports job, building mod_systemd shared since one test has to omit
it from the configuration.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
GitHub: PR #723
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1937596 13f79535-47bb-0310-9956-ffa450edef68
* test/conftest.py: Add --archive command-line option. Save per-test
conf snapshots via archive_test_conf after each test. Call archive_logs
at end of each package.
* test/pyhttpd/env.py: Add archive_logs and archive_test_conf to copy
logs and per-test confs to the archive folder, organised by httpd
version and git/svn revision. Add ignore_files to exclude htdocs,
shared confs and sockets from per-module copies. Move shared entries
(ca, ca1, ca2, certs, httpd.conf, mime.types, stop.conf) to _shared/.
Wipe logs dir at module setup to avoid stale files from previous runs.
* test/README.pytest: Document the --archive option, folder structure
and what gets archived.
Assisted-by: Claude Sonnet 4.6 <noreply@anthropic.com>
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1936981 13f79535-47bb-0310-9956-ffa450edef68
o Call location independence
o Fully support pip or uv
o Better reporting of test results when both suites are run
o Support postitional args for test cases in a reliable manner
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1936270 13f79535-47bb-0310-9956-ffa450edef68
Move runtests-pyhttpd.sh from test/ to test/pyhttpd/runtests.sh
to match the pytest_suite/runtests.sh naming convention.
- Update internal paths: $here/pyhttpd/... -> $here/... since $here
now resolves to test/pyhttpd/ itself.
- Update run-all-tests.sh to call ./pyhttpd/runtests.sh.
- Update README.pytest and .claude/settings.local.json references.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1934955 13f79535-47bb-0310-9956-ffa450edef68
The pyproject.toml and uv.lock belong to the pyhttpd test suite, so move
them from test/ into test/pyhttpd/ where the package itself lives.
Update runtests-pyhttpd.sh to use 'uv sync --project pyhttpd/' and
reference the venv at pyhttpd/.venv/. Fix pyhttpd/env.py to look for
the venv at the same level (pyhttpd/.venv/) instead of the parent dir.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1934951 13f79535-47bb-0310-9956-ffa450edef68
* detect statically compiled modules via `httpd -l` and skip
LoadModule for them, fixing startup failure when log_config_module
(or others) are built into the httpd binary
* add pyproject.toml with all required Python dependencies
(cryptography, python-multipart, websockets, pyopenssl, etc.)
* add runtests-pyhttpd.sh that creates/reuses a .venv via uv or
plain python3+pip, mirroring pytest_suite/runtests.sh
* prepend .venv/bin to PATH when launching httpd so CGI scripts
forked by httpd also use the venv's Python and find all packages
* update run-all-tests.sh to delegate pyhttpd runs to the new script
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1934947 13f79535-47bb-0310-9956-ffa450edef68
test_h2_203_02 intentionally triggers AH02430 (illegal response header
char). Over HTTP/2 the error is logged late during stream teardown and
can produce several lines, so the per-case ignore_recent() raced them
and they leaked into a later test's check_error_log(). Move the ignore
to an autouse class fixture (as conftest.py does for AH10400/AH00045)
and add HttpdErrorLog.remove_ignored_lognos() to restore on teardown.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1934891 13f79535-47bb-0310-9956-ffa450edef68
pytest-based tests, and perl-framework-based tests if available.
* test/pyhttpd/env.py (HttpdTestEnv.__init__): Use config.ini from
$PYHTTPD_CONFIG if set.
* configure.in: Check for pytest-3, add check-pytest to $CHECK_TARGETS
if found. Add check-unittests to $CHECK_TARGETS if test/httpdunit is
generated. Add check-test-framework to $CHECK_TARGETS if the Perl test
framework is present. Stop generating WITH_TEST_SUITE.
* Makefile.in (check): Depend on $CHECK_TARGETS.
(check-tree, check/bin/apachectl, check/config.ini, check/modules/stamp):
New targets to fill out the check/ install tree for use with pyhttpd.
(check-pytest): New target to run pytest-based tests.
(check-unittests): New target to run libcheck-based tests.
(check-test-framework): Renamed from "check-yes", runs Perl framework tests.
Github: closes#598
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1932079 13f79535-47bb-0310-9956-ffa450edef68
- When the server starts, it looks for new, staged certificates to
activate. If the staged set of files in 'md/staging/<domain>' is messed
up, this could prevent further renewals to happen. Now, when the staging
set is present, but could not be activated due to an error, purge the
whole directory. [icing]
- Fix certificate retrieval on ACME renewal to not require a 'Location:'
header returned by the ACME CA. This was the way it was done in ACME
before it became an IETF standard. Let's Encrypt still supports this,
but other CAs do not. [icing]
- Restore compatibility with OpenSSL < 1.1. [ylavic]
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1920747 13f79535-47bb-0310-9956-ffa450edef68
- shutdown server at end of h2 tests
- adapt minimum httpd versions for some tests
- add test_700_20 for load on blocked connections,
disabled for now until mpm_event improves
- build websocket client automatically
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1919087 13f79535-47bb-0310-9956-ffa450edef68
Do not count lines like "00:12:26.578220 <= Recv data, 0 bytes (0x0)"
(which happen before the final close) as receiving a real chunk.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1916806 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
described in RFC 8441. A new directive 'H2WebSockets on|off' has been
added. The feature is by default not enabled.
As also discussed in the manual, this feature should work for setups
using "ProxyPass backend-url upgrade=websocket" without further changes.
Special server modules for WebSockets will have to be adapted,
most likely, as the handling if IO events is different with HTTP/2.
HTTP/2 WebSockets are supported on platforms with native pipes. This
excludes Windows.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1910507 13f79535-47bb-0310-9956-ffa450edef68
- New directive 'H2EarlyHint name value' to add headers to a response,
picked up already when a "103 Early Hints" response is sent. 'name' and
'value' must comply to the HTTP field restrictions.
This directive can be repeated several times and header fields of the
same names add. Sending a 'Link' header with 'preload' relation will
also cause a HTTP/2 PUSH if enabled and supported by the client.
- Fixed an issue where requests were not logged and accounted in a timely
fashion when the connection returns to "keepalive" handling, e.g. when
the request served was the last outstanding one.
This led to late appearance in access logs with wrong duration times
reported.
- Accurately report the bytes sent for a request in the '%O' Log format.
This addresses #203, a long outstanding issue where mod_h2 has reported
numbers over-eagerly from internal buffering and not what has actually
been placed on the connection.
The numbers are now the same with and without H2CopyFiles enabled.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1909769 13f79535-47bb-0310-9956-ffa450edef68