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

2122 Commits

Author SHA1 Message Date
Jim Jagielski
d86f3d11d9 mod_proxy: add a worker status bit for mod_proxy_beacon members
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1939350 13f79535-47bb-0310-9956-ffa450edef68
2026-10-23 15:02:44 +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
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
Joe Orton
1422c19ea3 * include/httpd.h (request_rec): Rename "allowed_xmethods" field to
"unused" - this field has been present in request_rec since r86043
  (702dd42de, August 2000) but any use of it was removed in r86210
  (5d50a3e27, September 2000) which predates any stable 2.0 release.

Done WITHOUT an MMN major bump and we could probably get away with
doing the same in 2.4.x as well (where adding fields to request_rec
breaks mod_wsgi).


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1938284 13f79535-47bb-0310-9956-ffa450edef68
2026-09-16 07:30:33 +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
Eric Covener
0bc2ece957 restrict per-dir file funcs centrally
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1935016 13f79535-47bb-0310-9956-ffa450edef68
2026-06-05 10:27:34 +00:00
Eric Covener
52cb79b19e ap_regname: restrict to reasonable captures
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1935014 13f79535-47bb-0310-9956-ffa450edef68
2026-06-05 10:17:58 +00:00
Michael Osipov
0876ba4297 Use HTTP_* and ap_is_*() macros instead of literals
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1934913 13f79535-47bb-0310-9956-ffa450edef68
2026-06-03 09:07:51 +00:00
Joe Orton
7f5de0aebf Add ap_*_timingsafe() constant-time comparison functions:
* include/httpd.h: Declare ap_memeq_timingsafe(),
  ap_streq_timingsafe(), ap_strneq_timingsafe().

* server/util.c: Implement, wrapping apr_*_timingsafe() if
  APR >= 1.8, with a fallback to copied-in versions.

* modules/aaa/mod_auth_digest.c: Replace apr_crypto_equals()
  with ap_memeq_timingsafe(). Remove apr_crypto.h include.

* modules/session/mod_session_crypto.c: Replace local
  ap_crypto_equals() with ap_memeq_timingsafe(). Remove
  the local implementation and macro alias.

Github: closes #638


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1933389 13f79535-47bb-0310-9956-ffa450edef68
2026-04-27 12:54:48 +00:00
Joe Orton
48e9e82540 Remove apreq from trunk per PMC vote:
https://lists.apache.org/thread/hlvtnmg8qq1m10xlmgvyn12wrw4z3gp3

Revert \"Added apreq to NetWare build.\" r1201918

Revert \"add apreq in Win32\" r1825396

Remove references to apreq from CHANGES, httpd.spec.in.

Partial revert of r1825400.

Revert apreq support from cmake.

GitHub: closes #637


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1933271 13f79535-47bb-0310-9956-ffa450edef68
2026-04-23 16:08:21 +00:00
Joe Orton
c4e47bc0be Add missing module_index in the APLOG_MARK note for ap_log_error
Submitted by: Vladimír Chlup <vchlup ibm.com>
Github: closes #606


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1932078 13f79535-47bb-0310-9956-ffa450edef68
2026-02-28 13:07:27 +00:00
Joe Orton
d56527579e core: Add millisecond support to ErrorLogFormat time specifiers
%{m} prints the timestamp in millisecond-resolution.

* include/util_time.h:
  Define new AP_CTIME_OPTION_MSEC option for printing time in milliseconds
  format.

* server/util_time.c (ap_recent_ctime_ex):
  Handle AP_CTIME_OPTION_MSEC to print time in a millisecond format.

* server/log.c (log_ctime):
  Recognize the m time option in both fast-path and composite %{...}t formats.

Submitted by: Luboš Uhliarik <luhliari redhat.com>
Github: closes #597


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1931452 13f79535-47bb-0310-9956-ffa450edef68
2026-01-21 11:05:12 +00:00
Joe Orton
c8a53d147c Add --enable-sigusr2 to use SIGUSR2 rather than SIGWINCH for graceful
stop, which requires APR 1.7+.

* configure.in: Add --enable-sigusr2; define AP_SIG_GRACEFUL_STOP* in
  ap_config.h.

* include/mpm_common.h: Define AP_SIG_GRACEFUL_STOP* conditionally.

* server/mpm/prefork/prefork.c (child_main): Don't mention SIGWINCH.

PR: 50669
Github: closes #595


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1931418 13f79535-47bb-0310-9956-ffa450edef68
2026-01-19 11:05:38 +00:00
Rainer Jung
f65e13b890 Happy New Year 2026
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1931104 13f79535-47bb-0310-9956-ffa450edef68
2026-01-04 15:11:13 +00:00
Ruediger Pluem
b917376bdb * include/httpd.h: Define HTTP_EARLY_HINTS (103) per RFC 8297.
* modules/http/http_protocol.c (status_lines): Add 103 response.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1927935 13f79535-47bb-0310-9956-ffa450edef68
2025-08-21 07:04:46 +00:00
Ruediger Pluem
713100ca6a Make the value set for the socket option TCP_DEFER_ACCEPT configurable
* include/ap_listen.h:
  - Add prototype for include/ap_listen.heraccept
  - Wire in new directive ListenTCPDeferAccept

* include/mpm_common.h:
  Define the previous static value as default value via DEFAULT_TCP_DEFER_ACCEPT

* server/listen.c:
  - Add static int ap_listentcpdeferaccept
  - ap_apply_accept_filter: Use value of ap_listenbacklog for setting TCP_DEFER_ACCEPT
  - ap_listen_pre_config: Set default value
  - Add ap_set_listentcpdeferaccept



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1927885 13f79535-47bb-0310-9956-ffa450edef68
2025-08-19 12:45:15 +00:00
Eric Covener
dd98030cb3 expand UNC checking
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1927033 13f79535-47bb-0310-9956-ffa450edef68
2025-07-07 11:49:48 +00:00
Stefan Eissing
e3d014c009 *) scoreboard/mod_http2: record durations of HTTP/2 requests.
PR 69579 [Pierre Brochard <pierre.brochard.1982@m4x.org>]



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1923754 13f79535-47bb-0310-9956-ffa450edef68
2025-02-12 09:43:40 +00:00
Joe Orton
1db5c2359a Add API exposing the DavBasePath setting for use by DAV repository
backend modules (mod_dav_svn needs this for POST method handling).

* modules/dav/main/mod_dav.c (dav_get_base_path): New function.

* include/ap_mmn.h: Bump MMN minor.

Github: closes #513


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1923639 13f79535-47bb-0310-9956-ffa450edef68
2025-02-07 11:09:25 +00:00
Rainer Jung
aee4aafa1a Happy New Year 2025
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1922818 13f79535-47bb-0310-9956-ffa450edef68
2025-01-01 11:12:22 +00:00
Joe Orton
4915c21524 Add Multipath TCP (MPTCP) support (Proxy)
Multipath TCP (MPTCP), standardized in RFC8684 [1],
is a TCP extension that enables a TCP connection to
use different paths.

Multipath TCP has been used for several use cases.
On smartphones, MPTCP enables seamless handovers between
cellular and Wi-Fi networks while preserving established
connections. This use-case is what pushed Apple to use
MPTCP since 2013 in multiple applications [2]. On dual-stack
hosts, Multipath TCP enables the TCP connection to
automatically use the best performing path, either IPv4
or IPv6. If one path fails, MPTCP automatically uses
the other path.

To benefit from MPTCP, both the client and the server
have to support it. Multipath TCP is a backward-compatible
TCP extension that is enabled by default on recent
Linux distributions (Debian, Ubuntu, Redhat, ...). Multipath
TCP is included in the Linux kernel since version 5.6 [3].
To use it on Linux, an application must explicitly enable
it when creating the socket. No need to change anything
else in the application.

Adding the possibility to create MPTCP sockets would thus
be a really fine addition to httpd, by allowing clients
to make use of their different interfaces.

This patch introduces the possibilty to connect to backend
servers using MPTCP. Note however that these changes are
only available on Linux, as IPPROTO_MPTCP is Linux specific
for the time being.

For proxies, we can connect using MPTCP by passing the
\"multipathtcp\" parameter:

ProxyPass \"/example\" \"http://backend.example.com\" multipathtcp=On

We then store this information in the worker and create sockets
appropriately according to this value.

Link: https://www.rfc-editor.org/rfc/rfc8684.html [1]
Link: https://www.tessares.net/apples-mptcp-story-so-far/ [2]
Link: https://www.mptcp.dev [3]
Add Multipath TCP (MPTCP) support (Core)

Multipath TCP (MPTCP), standardized in RFC8684 [1],
is a TCP extension that enables a TCP connection to
use different paths.

Multipath TCP has been used for several use cases.
On smartphones, MPTCP enables seamless handovers between
cellular and Wi-Fi networks while preserving established
connections. This use-case is what pushed Apple to use
MPTCP since 2013 in multiple applications [2]. On dual-stack
hosts, Multipath TCP enables the TCP connection to
automatically use the best performing path, either IPv4
or IPv6. If one path fails, MPTCP automatically uses
the other path.

To benefit from MPTCP, both the client and the server
have to support it. Multipath TCP is a backward-compatible
TCP extension that is enabled by default on recent
Linux distributions (Debian, Ubuntu, Redhat, ...). Multipath
TCP is included in the Linux kernel since version 5.6 [3].
To use it on Linux, an application must explicitly enable
it when creating the socket. No need to change anything
else in the application.

Adding the possibility to create MPTCP sockets would thus
be a really fine addition to httpd, by allowing clients
to make use of their different interfaces.

This patch introduces the possibility to listen with MPTCP
sockets. Note however that these changes are only available
on Linux, as IPPROTO_MPTCP is Linux specific for the time being.

To do so, we extended the Listen directive to include
a \"multipathtcp\" option, allowing to create MPTCP sockets
instead of regular TCP ones:

Listen 80 options=multipathtcp

We then store this information in flags for the listen directive
and create sockets appropriately according to this value.

Link: https://www.rfc-editor.org/rfc/rfc8684.html [1]
Link: https://www.tessares.net/apples-mptcp-story-so-far/ [2]
Link: https://www.mptcp.dev [3]

Submitted by: Aperence <anthony.doeraene hotmail.com>
Github: closes #476


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1920586 13f79535-47bb-0310-9956-ffa450edef68
2024-09-12 07:59:22 +00:00
Yann Ylavic
2f1f9c5df0 mod_proxy: Fix selection of ProxyPassMatch workers with host/port substitution. PR 69233.
With "ProxyPassMatch ^/([^/]+)/(.*)$ https://$1/$2", ap_proxy_get_worker_ex()
should not consider the length of scheme://host part of the given URL because
of the globbing match on the host part.

Fix it by setting worker->s>is_host_matchable when creating a worker with host
substitution and avoiding the min_match check in worker_matches() in this case.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1919617 13f79535-47bb-0310-9956-ffa450edef68
2024-08-01 11:35:26 +00:00
Yann Ylavic
07c5019564 core: Improve AP_REQUEST_ #defines.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1919290 13f79535-47bb-0310-9956-ffa450edef68
2024-07-16 15:56:54 +00:00
Eric Covener
f2db411286 factor out IS_SLASH, perdir fix
in per-dir, the filename will be internally redirected, so / is OK too.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1918651 13f79535-47bb-0310-9956-ffa450edef68
2024-06-26 10:09:29 +00:00
Yann Ylavic
6937b985ae mod_proxy: Fixup UDS filename for mod_proxy called through r->handler.
* modules/proxy/proxy_util.c:
  Export ap_proxy_fixup_uds_filename() from fix_uds_filename.
  Call it from ap_proxy_pre_request() even for rewritten balancer workers.

* modules/proxy/mod_proxy.h:
  Declare ap_proxy_fixup_uds_filename()

* modules/proxy/mod_proxy.c:
  Fixup UDS filename from r->handler in proxy_handler().

* include/ap_mmn.h:
  Bump MMN minor for ap_proxy_fixup_uds_filename()



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1918626 13f79535-47bb-0310-9956-ffa450edef68
2024-06-25 23:49:09 +00:00
Eric Covener
fe939ff386 MMN bump for recent additions
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1918554 13f79535-47bb-0310-9956-ffa450edef68
2024-06-24 17:32:26 +00:00
Eric Covener
925b6f0ceb add ap_set_content_type_ex to differentiate
trusted sources


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1918551 13f79535-47bb-0310-9956-ffa450edef68
2024-06-24 17:22:51 +00:00
Eric Covener
12542a8032 add UNCList directive on Windows
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1918549 13f79535-47bb-0310-9956-ffa450edef68
2024-06-24 17:19:44 +00:00
Yann Ylavic
67c65983d5 mpm_event,mod_http2,mod_status: Follow up to r1918257: CONN_STATE_ASYNC_WAITIO.
Per discussion on PR #449, have a separate state for returning the connection
to the MPM to wait for an IO (namely CONN_STATE_ASYNC_WAITIO), rather than
(ab)using CONN_STATE_PROCESSING.

This removes the need for AGAIN added in r1918257 (for now), and AP_MPMQ_CAN_AGAIN
is renamed to AP_MPMQ_CAN_WAITIO.

This is also the state that mod_status accounts for, so rename ->processing
to ->wait_io in process_score (shows as "wait-io" in mod_status and mod_lua).



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1918482 13f79535-47bb-0310-9956-ffa450edef68
2024-06-21 09:48:12 +00:00
Joe Orton
a834c8b88e * include/httpd.h: Fix comment.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1918297 13f79535-47bb-0310-9956-ffa450edef68
2024-06-13 14:44:50 +00:00
Yann Ylavic
0d71da4bdf mpm_event,mod_http2: Keep compatibility with CONN_STATE_PROCESSING + OK
Before r1918022, returning OK with CONN_STATE_PROCESSING to mpm_event was
handled like/by CONN_STATE_LINGER "to not break old or third-party modules
which might return OK w/o touching the state and expect lingering close,
like with worker or prefork MPMs".

So we need a new return code to be allowed to apply the new POLLIN/POLLOUT
behaviour for CONN_STATE_PROCESSING, thus revive AGAIN as introduced by
Graham some times ago for a nonblocking WIP (moved to a branch/PR since then).

MPM event will advertise its ability to handle CONN_STATE_PROCESSING + AGAIN
with AP_MPMQ_CAN_AGAIN, and mod_http2 can use that to know how to return to
the MPM as expected. When !AP_MPMQ_CAN_AGAIN modules/mod_http2 can still use
CONN_STATE_WRITE_COMPLETION + CONN_SENSE_WANT_READ + c->clogging_input_filters
which will work in mpm_even-2.4.x still.

* include/ap_mmn.h:
  Bump MMN minor for AP_MPMQ_CAN_AGAIN and AGAIN.

* include/ap_mpm.h:
  Define AP_MPMQ_CAN_AGAIN.

* include/httpd.h:
  Define AGAIN.

* modules/http2/h2.h:
  No need for H2_USE_STATE_PROCESSING anymore with AP_MPMQ_CAN_AGAIN.

* modules/http2/h2_c1.c:
  For !keepalive case return to the MPM using CONN_STATE_PROCESSING + AGAIN
  or CONN_STATE_WRITE_COMPLETION + c->clogging_input_filters depending on
  AP_MPMQ_CAN_AGAIN only.

* modules/http2/h2_session.c:
  Can return to the MPM for h2_send_flow_blocked() provided it's async only.

* server/mpm/event/event.c:
  Rework process_socket()'s CONN_STATE_PROCESSING to handle AGAIN and preserve
  compatibility. Have a lingering_close label to goto there faster when
  process_lingering_close() is to be called. Improve relevant comments.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1918257 13f79535-47bb-0310-9956-ffa450edef68
2024-06-11 14:46:29 +00:00
Yann Ylavic
c09f4ffdbb Follow up to r1918098 (and r1918022): Actually bump the MMN.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1918100 13f79535-47bb-0310-9956-ffa450edef68
2024-06-01 16:03:58 +00:00
Yann Ylavic
d821182d76 mpm_event, mod_status: Separate processing and write completion queues.
As a follow up to r1918022 which handled the new CONN_STATE_PROCESS(ing) and
existing CONN_STATE_WRITE_COMPLETION in the same async queue, let's now have
two separates ones which allows more relevant async accounting in mod_status.

Rename CONN_STATE_PROCESS to CONN_STATE_PROCESSING as it's how it will be
called in mod_status.

* include/ap_mmn.h:
  MMN minor bump for process_score->processing counter.

* include/httpd.h:
  Rename CONN_STATE_PROCESS to CONN_STATE_PROCESSING.

* include/scoreboard.h:
  Add process_score->processing field.

* include/httpd.h, modules/http/http_core.c, modules/http2/h2_c1.c,
    server/mpm/event/event.c, server/mpm/motorz/motorz.c,
    server/mpm/simple/simple_io.c:
  Rename CONN_STATE_PROCESS to CONN_STATE_PROCESSING.

* server/mpm/event/event.c:
  Restore write_completion_q to handle connections in CONN_STATE_WRITE_COMPLETION.
  Use processing_q (renamed from process_q) solely for CONN_STATE_PROCESSING.
  Update process_score->processing according to the length of processing_q.
  
* modules/generators/mod_status.c:
  Show the value of process_score->processing in the stats.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1918098 13f79535-47bb-0310-9956-ffa450edef68
2024-06-01 15:08:46 +00:00
Yann Ylavic
0af4059050 Follow up to r1918022: MMN minor bump and checks for the new conn_state_e aliases' usability.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1918035 13f79535-47bb-0310-9956-ffa450edef68
2024-05-29 09:41:25 +00:00
Yann Ylavic
c0a30141ca mpm_event,core: Handle async POLLIN/POLLOUT in CONN_STATE_PROCESS state.
* include/httpd.h:
  Rename CONN_STATE_CHECK_REQUEST_LINE_READABLE to CONN_STATE_KEEPALIVE
  and CONN_STATE_READ_REQUEST_LINE to CONN_STATE_PROCESS, keeping the
  old enums as aliases. Rework comments about each state.

* server/mpm/event/event.c:
  Use the new states names.
  Let the process_connection hooks return CONN_STATE_PROCESS for mpm_event
  to POLLIN or POLLOUT depending on c->cs->sense being CONN_SENSE_WANT_READ
  or CONN_SENSE_WANT_WRITE respectively.
  Remove (ab)use of CONN_STATE_WRITE_COMPLETION with CONN_SENSE_WANT_READ to
  mean poll() for read (and the need for the obscure c->clogging_input_filters
  to make it work as expected). This is what CONN_STATE_PROCESS is for now.
  Update the comment about the states that can be returned by process_connection
  hooks (and their usage).
  Use the same queue (process_q renamed from write_completion_q) for polling
  connections in both CONN_STATE_PROCESS and CONN_STATE_WRITE_COMPLETION
  states since they both use the same (server_rec's) Timeout. This implies
  that both states are accounted as "write-completion" in mod_status for now.

* server/mpm/motorz/motorz.c, server/mpm/simple/simple_io.c, modules/http/http_core.c:
  Use the new states names (only).

* include/scoreboard.h:
  Change comment about process_score->write_completion to note that the
  counter refers to CONN_STATE_PROCESS connections returned to the MPM
  too.

* modules/http2/h2_c1.c:
  Return the c1 connection with the CONN_STATE_PROCESS state rather than
  CONN_STATE_WRITE_COMPLETION when waiting for a window update (i.e. ask
  the MPM to poll for read directly). This avoids the transition to
  CONN_STATE_KEEPALIVE which could kill the connection under high load.


Github: closes #448



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1918022 13f79535-47bb-0310-9956-ffa450edef68
2024-05-28 14:10:43 +00:00
Eric Covener
61645eaac8 let httpd handle CL/TE for non-http handlers
Submitted By: ylavic, covener



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1916769 13f79535-47bb-0310-9956-ffa450edef68
2024-04-03 11:49:53 +00:00
Rainer Jung
9730945e39 Update copyright year
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1916669 13f79535-47bb-0310-9956-ffa450edef68
2024-03-30 21:10:59 +00:00
Yann Ylavic
97a1873332 regex: Add AP_REG_NOTEMPTY_ATSTART maching option.
* include/ap_mmn.h:
  Bump MMN minor.

* include/ap_regex.h:
  Define AP_REG_NOTEMPTY_ATSTART bit.

* server/util_pcre.c(ap_regexec_ex):
  Map AP_REG_NOTEMPTY_ATSTART to native PCRE_NOTEMPTY_ATSTART.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1915268 13f79535-47bb-0310-9956-ffa450edef68
2024-01-16 16:56:58 +00:00
Yann Ylavic
e52a206008 regex: Add ap_regexec_ex() which can take a starting offset to match from.
* include/ap_mmn.h:
  Bump MMN minor.

* include/ap_regex.h:
  Declare ap_regexec_ex().

* server/util_pcre.c(ap_regexec, ap_regexec_len, ap_regexec_ex):
  Reuse existing ap_regexec_len() code to implement ap_regexec_ex() where the
  offset is given instead of zero, then implement ap_regexec{,len}() in terms
  of ap_regexec_ex().



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1915267 13f79535-47bb-0310-9956-ffa450edef68
2024-01-16 16:51:03 +00:00
Joe Orton
6781ce90af * include/ap_socache.h: Update comment only, to remove reference to
session cache. [skip ci]


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1914035 13f79535-47bb-0310-9956-ffa450edef68
2023-11-22 09:03:34 +00:00
Yann Ylavic
29fb603784 mod_proxy: Add ap_proxy_worker_get_name() and deprecate ap_proxy_worker_name().
The latter requires a pool and returns a non constant string although it may
return worker shared data.

By computing the worker "UDS" name at init time we can return a constant name
in any case with no need for a pool, that's the new ap_proxy_worker_get_name().



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1912461 13f79535-47bb-0310-9956-ffa450edef68
2023-09-21 13:31:15 +00:00
Yann Ylavic
3c7f67fa2a mod_proxy: Handle backend address renewal with address_ttl= parameter.
Define a new proxy_address struct holding the current/latest sockaddr in use
by each proxy worker and conn. Since backend addresses can be updated when
their TTL expires and while connections are being processed, each address is
refcounted and freed only when the last worker (or conn) using it grabs the
new one.

The lifetime of the addresses is handled at a single place by the new
ap_proxy_determine_address() function. It guarantees to bind the current/latest
backend address to the passed in conn (or do nothing if it's up to date already).
The function is called indirectly by ap_proxy_determine_connection() for the
proxy modules that use it, or directly by mod_proxy_ftp and mod_proxy_hcheck.
It also is called eventually by ap_proxy_connect_backend() when connect()ing all
the current addresses fails, to check (PROXY_DETERMINE_ADDRESS_CHECK) if some
new addrs are available.

This commit is also a rework of the lifetime of conn->addr, conn->hostname
and conn->forward, using the conn->uds_pool and conn->fwd_pool for the cases
where the backend is connected through a UDS socket and a remote CONNECT proxy
respectively.

* include/ap_mmn.h:
  Minor bump for new function/fields.

* modules/proxy/mod_proxy.h (struct proxy_address,
                             ap_proxy_determine_addresss()):
  Declare ap_proxy_determine_addresss() and opaque struct proxy_address,
  new fields to structs proxy_conn_rec/proxy_worker_shared/proxy_worker.

* modules/proxy/mod_proxy.c (set_worker_param):
  Parse/set the new worker->address_ttl parameter.

* modules/proxy/proxy_util.c (proxy_util_register_hooks(),
                              ap_proxy_initialize_worker(),
                              ap_proxy_connection_reusable(),
                              ap_proxyerror(), proxyerror_core(),
                              init_conn_pool(), make_conn_subpool(),
                              connection_make(), connection_cleanup(),
                              connection_constructor()):
 Initialize *proxy_start_time in proxy_util_register_hooks() as the epoch
 from which expiration times are relative (i.e. seconds stored in an uint32_t
 for atomic changes).
 Make sure worker->s->is_address_reusable and worker->s->disablereuse are
 consistant in ap_proxy_initialize_worker(), thus no need to check for both
 in ap_proxy_connection_reusable().
 New proxyerror_core() helper taking an apr_status_t to log, wrap in
 ap_proxyerror().
 New make_conn_subpool() to create worker->cp->{pool,dns} with their own
 allocator.
 New connection_make() helper to factorize code in connection_cleanup() and
 connection_constructor().

* modules/proxy/proxy_util.c (proxy_address_inc(), proxy_address_dec(),
                              proxy_address_cleanup(), proxy_address_set_expired(),
                              worker_address_get(), worker_address_set(),
                              worker_address_resolve(), proxy_addrs_equal(),
                              ap_proxy_determine_address(),
                              ap_proxy_determine_connection(),
                              ap_proxy_connect_backend()):
 Implement ap_proxy_determine_address() using the above helpers for atomic changes,
 and call it from ap_proxy_determine_connection() and ap_proxy_connect_backend().

* modules/proxy/mod_proxy_ftp.c (proxy_ftp_handler):
  Use ap_proxy_determine_address() and use the returned backend->addr.

* modules/proxy/mod_proxy_hcheck.c (hc_determine_connection, hc_get_backend,
                                    hc_init_worker, hc_watchdog_callback):
  Use ap_proxy_determine_address() in hc_determine_connection() and call the
  latter from hc_get_backend(), replace hc_init_worker() by hc_init_baton()
  which now calls hc_get_hcworker() and hc_get_backend() to resolve the first
  address at init time.

* modules/proxy/mod_proxy_http.c (proxy_http_handler):
  Use backend->addr and ->hostname instead of worker->cp->addr and
  worker->s->hostname_ex respectively.

* modules/proxy/mod_proxy_ajp.c (ap_proxy_ajp_request):
  Use backend->addr and ->hostname instead of worker->cp->addr and
  worker->s->hostname_ex respectively.


Closes #367



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1912459 13f79535-47bb-0310-9956-ffa450edef68
2023-09-21 13:15:35 +00:00
Yann Ylavic
df5a2628cc request_rec: Single bit for body_indeterminate (while it's not in 2.4.x yet).
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1910573 13f79535-47bb-0310-9956-ffa450edef68
2023-06-23 14:10:07 +00:00
Stefan Eissing
3ed9d65b05 *) mod_http2: added support for bootstrapping WebSockets via HTTP/2, as
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
2023-06-20 12:01:09 +00:00
Ruediger Pluem
ba808b06f3 * Fix copy and paste error
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1910324 13f79535-47bb-0310-9956-ffa450edef68
2023-06-09 11:18:02 +00:00
Stefan Eissing
ed69ae3384 *) core: add final_resp_passed flag to request_rec to allow
ap_die() to judge if it can send out a response. Bump mmn.
     Enable test cases that check errors during response body to
     appear as error on client side.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1910161 13f79535-47bb-0310-9956-ffa450edef68
2023-06-01 12:21:03 +00:00
Graham Leggett
3e638ff283 core: Add the token_checker hook, that allows authentication to take
place using mechanisms other than username/password, such as bearer
tokens.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1909409 13f79535-47bb-0310-9956-ffa450edef68
2023-04-25 17:35:08 +00:00
Graham Leggett
e6647e0dcb Include header file for the explicit regex.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1909136 13f79535-47bb-0310-9956-ffa450edef68
2023-04-14 14:03:03 +00:00
Graham Leggett
1925882d55 core: Be explicit if an enclosing directive contains a path or a
regex.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1909135 13f79535-47bb-0310-9956-ffa450edef68
2023-04-14 14:02:11 +00:00
Yann Ylavic
63d0e49490 Follow up to r1908380: MMN minor bump for AP_CTIME_OPTION_GMTOFF.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1908557 13f79535-47bb-0310-9956-ffa450edef68
2023-03-20 10:48:07 +00:00