1
0
mirror of https://github.com/apache/httpd.git synced 2025-09-11 09:30:48 +03:00

145 Commits

Author SHA1 Message Date
Eric Covener
a6b8db04ec improve h2 header error handling
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1927038 13f79535-47bb-0310-9956-ffa450edef68
2025-07-07 11:56:48 +00:00
Stefan Eissing
f3448d02da *) mod_http2: Fix handling of 304 responses from mod_cache. PR 69580.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1924267 13f79535-47bb-0310-9956-ffa450edef68
2025-03-10 10:09:43 +00:00
Stefan Eissing
e1fe1d8505 *) mod_md: update to version 2.0.30
- Fixed bug in handling over long response headers. When the 64 KB limit
       of nghttp2 was exceeded, the request was not reset and the client was
       left hanging, waiting for it. Now the stream is reset.
     - Added new directive `H2MaxHeaderBlockLen` to set the limit on response
       header sizes.
     - Fixed handling of Timeout vs. KeepAliveTimeout when first request on a
       connection was reset.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1924145 13f79535-47bb-0310-9956-ffa450edef68
2025-03-03 12:32:31 +00:00
Stefan Eissing
d94933b89f mod_http2, fix keepalive timeout on reset requests
Count failed requests that are RST'ed, so that the
connection enters keepalive timeout instead of the
regular timeout if the first request fails.

Add tests to verify.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1921805 13f79535-47bb-0310-9956-ffa450edef68
2024-11-07 12:02:41 +00:00
Eric Covener
b646741ff0 bail after too many failed reads
Submitted By: icing



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1916771 13f79535-47bb-0310-9956-ffa450edef68
2024-04-03 11:55:16 +00:00
Stefan Eissing
8943c469eb * mod_http2: improved early cleanup of streams.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1912999 13f79535-47bb-0310-9956-ffa450edef68
2023-10-16 08:57:51 +00:00
Stefan Eissing
84430d7f0b * mod_http2: fixed a bug in handling of stream timeouts.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1912385 13f79535-47bb-0310-9956-ffa450edef68
2023-09-18 07:55:16 +00:00
Stefan Eissing
47514904a3 mod_http2: add aplogno where makefile did not detect it missing?
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1910688 13f79535-47bb-0310-9956-ffa450edef68
2023-06-29 10:38:08 +00:00
Stefan Eissing
71269d0515 mod_http2: optimization for c1 output passing when collecting
next DATA frame for a response.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1910648 13f79535-47bb-0310-9956-ffa450edef68
2023-06-28 08:54:46 +00:00
Stefan Eissing
ac9f458776 *) mod_http2: adding checks for websocket support on platform and
server versions. Give error message accordingly when trying to
     enable websockets in unsupported configurations.
     Add test and code to check the, finally selected, server of
     a request_rec for websocket support or 501 the request.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1910535 13f79535-47bb-0310-9956-ffa450edef68
2023-06-21 12:14:08 +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
Stefan Eissing
ccf4365117 *) mod_http2: fixed a bug that could lead to a crash in main connection
output handling. This occured only when the last request on a HTTP/2
     connection had been processed and the session decided to shut down.
     This could lead to an attempt to send a final GOAWAY while the previous
     write was still in progress. See PR 66646.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1910386 13f79535-47bb-0310-9956-ffa450edef68
2023-06-13 14:36:43 +00:00
Stefan Eissing
1c7a70c9d9 * mod_proxy_http2: fixed using the wrong "bucket_alloc" from the backend
connection when sending data on the frontend one. This caused crashes
   or infinite loops in rare situations.
 * mod_proxy_http2: fixed a bug in retry/response handling that could lead
   to wrong status codes or HTTP messages send at the end of response bodies
   exceeding the announced content-length.
 * mod_proxy_http2: fix retry handling to not leak temporary errors.
   On detecting that that an existing connection was shutdown by the other
   side, a 503 response leaked even though the request was retried on a
   fresh connection.
 * mod_http2: fixed a bug that did cleanup of consumed and pending buckets in
   the wrong order when a bucket_beam was destroyed.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1910157 13f79535-47bb-0310-9956-ffa450edef68
2023-06-01 10:38:53 +00:00
Stefan Eissing
bdd49d3845 *) mod_http2: v2.0.15 with the following fixes and improvements
- 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
2023-05-12 11:28:59 +00:00
Stefan Eissing
ff6b8026ac *) mod_http2: new directive 'H2MaxDataFrameLen n' to limit the maximum
amount of response body bytes put into a single HTTP/2 DATA frame.
     Setting this to 0 places no limit (but the max size allowed by the
     protocol is observed).
     The module, by default, tries to use the maximum size possible, which is
     somewhat around 16KB. This sets the maximum. When less response data is
     available, smaller frames will be sent.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1907697 13f79535-47bb-0310-9956-ffa450edef68
2023-02-16 11:58:45 +00:00
Stefan Eissing
8b68438b2e *) mod_http2: field values (headers and trailers) are stripped of
leading/trailing whitespace (space +htab) before being processed
     or send in a response. This is compatible behaviour to HTTP/1.1
     parsers that strip incoming headers of such characters.
     [Stefan Eissing]

  - removed intermittent "H2HeaderStrictness" directive again.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1904777 13f79535-47bb-0310-9956-ffa450edef68
2022-10-22 11:41:55 +00:00
Stefan Eissing
4701f6f3cc mod_http2: resolving duplicate log tag in #if/#else code copies.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1904590 13f79535-47bb-0310-9956-ffa450edef68
2022-10-14 12:57:24 +00:00
Stefan Eissing
61ebb22bf9 Sync with v2.0.10 from github:
* Extensive testing in production done by Alessandro Bianchi (@alexskynet)
   on the v2.0.x versions for stability. Many thanks!
 * refactored stream response handling to reflect the different phases
   (response/data/trailers) more clearly and help resolving cpu busy loops.
 * Adding more negative tests for handling of errored responses to cover
   edge cases.
 * mod_http2: fixed handling of response where neiter an EOS nor an ERROR was
   received as a cause to reset the stream.
 * mod_proxy_http2: generating error buckets for fault response bodies, to
   signal failure to fron when response header were already sent.

v2.0.9
--------------------------------------------------------------------------------
 * Fixed a bug where errors during reponse body handling did not lead to
   a proper RST_STREAM. Instead processing went into an infinite loop.
   Extended test cases to catch this condition.

v2.0.8
--------------------------------------------------------------------------------
 * Delaying input setup of a stream just before processing starts. This allows
   any EOS indicator arriving from the client before that to take effect.
   Without knowing that a stream has no input, internal processing has to
   simulate chunked encoding. This is not wrong, but somewhat more expensive
   and mod_security has been reported to be allergic to seeing 'chunked'
   on some requests. See <https://bz.apache.org/bugzilla/show_bug.cgi?id=66282>.
 * mod_proxy_http2: fixed #235 by no longer forwarding 'Host:' header when
   request ':authority' is known. Improved test case that did not catch that
   the previous 'fix' was incorrect.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1904522 13f79535-47bb-0310-9956-ffa450edef68
2022-10-11 14:54:08 +00:00
Stefan Eissing
cc77f54228 *) mod_http2: synchronization with github sources.
Building in trunk and against 2.4.x is now supported
     via AP_HAS_RESPONSE_BUCKETS defines.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1904305 13f79535-47bb-0310-9956-ffa450edef68
2022-09-27 13:21:21 +00:00
Stefan Eissing
b88117f602 *) mod_http2: type adjustments and castings for int/apr_uint32_t/apr_size_t/apr_off_t.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1904297 13f79535-47bb-0310-9956-ffa450edef68
2022-09-27 10:53:51 +00:00
Stefan Eissing
8476af1eb6 *) mod_http2: new directive "H2HeaderStrictness" to control the compliance
level of header checks as defined in the HTTP/2 RFCs. Default is 7540.
     9113 activates the checks for forbidden leading/trailing whitespace in
     field values (available from nghttp2 v1.50.0 on).

   - source sync with github version
   - fix for keepalive idle wait in mpm_worker setup
   - ensuring EOS when secondary connection has been handled
   - fixed race in late input EOS arrival when stream was
     already scheduled for execution.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1904269 13f79535-47bb-0310-9956-ffa450edef68
2022-09-26 12:29:47 +00:00
Stefan Eissing
3f9a045f96 *) mod_http2: fixed trailer handling. Empty response bodies
prevented trailers from being sent to a client. See
     <https://github.com/icing/mod_h2/issues/233> for how
     this affected gRPC use.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1902409 13f79535-47bb-0310-9956-ffa450edef68
2022-07-02 09:39:22 +00:00
Stefan Eissing
887ffec712 *) mod_http2: use new ap_sb_get_child_thread() to get child_num
and create unique h2 session identifiers in logging that stay
     unique among re-activations of the master connection.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1900030 13f79535-47bb-0310-9956-ffa450edef68
2022-04-19 10:17:05 +00:00
Stefan Eissing
5d3b2f1f0c *) mod_http2: use the new REQUEST buckets to forward request
on secondary connections. Use the now generic
     ap_process_connection() in h2 workers to process those.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1899802 13f79535-47bb-0310-9956-ffa450edef68
2022-04-13 08:38:12 +00:00
Stefan Eissing
8ce99f9ef1 *) mod_http2: use the new RESPONSE buckets introduced in r1899648.
This replaces the internal H2_HEADERS bucket, removing its
     source file and also obsoletes any interim response parsing
     needs.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1899649 13f79535-47bb-0310-9956-ffa450edef68
2022-04-07 10:55:09 +00:00
Stefan Eissing
5b44e01136 *) mod_http2: small improvements from the http1-separation
branch that apply in general.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1899107 13f79535-47bb-0310-9956-ffa450edef68
2022-03-21 09:54:41 +00:00
Stefan Eissing
6bd9d17e08 *) core: adding a new hook and method to the API:
create_secondary_connection and ap_create_secondary_connection()
     to setup connections related to a "master" one, as used in
     the HTTP/2 protocol implementation.

  *) mod_http2: using the new API calls to get rid of knowledge
     about how the core handles conn_rec specifics.
     Improvements in pollset stream handling to use less sets.
     Using atomic read/writes instead of volatiles now.
     Keeping a reserve of "transit" pools and bucket_allocs for
     use on secondary connections to avoid repeated setup/teardowns.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1899032 13f79535-47bb-0310-9956-ffa450edef68
2022-03-18 09:52:52 +00:00
Yann Ylavic
42c72509fe Follow up to r1897940: APLOGNO()s.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1897948 13f79535-47bb-0310-9956-ffa450edef68
2022-02-10 21:04:12 +00:00
Stefan Eissing
b90220157d *) mod_http2: :scheme pseudo-header values, not matching the
connection scheme, are forwarded via absolute uris to the
     http protocol processing to preserve semantics of the request.
     Checks on combinations of pseudo-headers values/absence
     have been added as described in RFC 7540.
     Fixes <https://github.com/icing/mod_h2/issues/230>.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1897940 13f79535-47bb-0310-9956-ffa450edef68
2022-02-10 10:59:08 +00:00
Yann Ylavic
d2ffee1e04 Follow up to r1897872: New APLOGNO
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1897882 13f79535-47bb-0310-9956-ffa450edef68
2022-02-09 00:21:11 +00:00
Stefan Eissing
4a6bf7f895 *) mod_http2: when a h2 request carries a ':scheme' pseudoheader,
it gives a 400 response if the scheme does not match the
    connection. Fixes <https://github.com/icing/mod_h2/issues/230>.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1897872 13f79535-47bb-0310-9956-ffa450edef68
2022-02-08 13:38:49 +00:00
Stefan Eissing
1a303fdb6f * mod_http2: hopeful (as always) fix for the stalling in 400_20.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1894252 13f79535-47bb-0310-9956-ffa450edef68
2021-10-14 15:26:59 +00:00
Stefan Eissing
a32ff18e4e *) mod_http2: another travis test of the 400_20 and 401_31 tests that produce a timeout
only on travis and never locally. sorry about the cycles.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1894241 13f79535-47bb-0310-9956-ffa450edef68
2021-10-14 12:37:25 +00:00
Stefan Eissing
7891b6f694 *) mod_http2: when pollset signals output, resume a streams data
in nghttp2 every time without checks that response body bytes
     are available. This resolves the situation that a stream may stall
     when 2 consecutive H2HEADER buckets are sent (e.g. 103+200).



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1894228 13f79535-47bb-0310-9956-ffa450edef68
2021-10-14 10:18:17 +00:00
Stefan Eissing
93d3eca86d *) mod_http2: resurrecting the check for older nghttp2 versions.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1894184 13f79535-47bb-0310-9956-ffa450edef68
2021-10-13 08:26:18 +00:00
Stefan Eissing
bf7b392b25 * mod_http2: fixing some compiler warnings.
length of output written now correctly calculated after buckets
    have been read.
    test cases updated.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1894172 13f79535-47bb-0310-9956-ffa450edef68
2021-10-12 19:58:01 +00:00
Stefan Eissing
17471dfb93 updated log tag to resolve duplicate.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1894169 13f79535-47bb-0310-9956-ffa450edef68
2021-10-12 16:25:59 +00:00
Stefan Eissing
6a355db082 *) mod_http2:
- Fixed an issue since 1.15.24 that "Server" headers in proxied requests
       were overwritten instead of preserved. [PR by @daum3ns]
     - Added directove 'H2StreamTimeout' to configure a separate value for HTTP/2
       streams, overriding server's 'Timeout' configuration. [rpluem]
     - HTTP/2 connections now use pollsets to monitor the status of the
       ongoing streams and their main connection when host OS allows this.
     - Removed work-arounds for older versions of libnghttp2 and checking
       during configure that at least version 1.15.0 is present.
     - The HTTP/2 connection state handler, based on an experiment and draft
       at the IETF http working group (abandoned for some time), has been removed.
     - H2SerializeHeaders no longer has an effect. A warning is logged when it is
       set to "on". The switch enabled the internal writing of requests to be parsed
       by the internal HTTP/1.1 protocol handler and was introduced to avoid
       potential incompatibilities during the introduction of HTTP/2.
     - Removed the abort/redo of tasks when mood swings lower the active limit.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1894163 13f79535-47bb-0310-9956-ffa450edef68
2021-10-12 13:34:01 +00:00
Stefan Eissing
f990e5ecad mod_htt2: fix incomplete sync with latest changes in github, adjust version number.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1889119 13f79535-47bb-0310-9956-ffa450edef68
2021-04-23 08:01:56 +00:00
Stefan Eissing
a44bcc9a1e *) mod_http2: Fixed a race condition that could lead to streams being
aborted (RST to the client), although a response had been produced.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1888087 13f79535-47bb-0310-9956-ffa450edef68
2021-03-26 14:55:22 +00:00
Ruediger Pluem
a4fba22366 Process early errors via a dummy HTTP/1.1 request as well
Process early errors via a dummy HTTP/1.1 request as well to ensure
that the request gets logged correctly and possible custom error
pages are considered. The previous way of directly sending a HTTP/2
answer with the HTTP status code appropriate for the error is more
efficient, but does not log the request nor sents a possible custom
error page.

* modules/http2/h2.h: Add http_status to h2_request struct and define
  H2_HTTP_STATUS_UNSET.

* modules/http2/h2_request.c(h2_request_create_rec): Check if
  http_status is set for the request and die with the
  status code it contains if set.

* modules/http2/h2_session.c(on_header_cb): Adjust the error condition
  now that we mark early errors via http_status: Only return an error
  if the status is not success and http_status is not H2_HTTP_STATUS_UNSET.

* modules/http2/h2_stream.c(set_error_response): Set http_status
  on the request instead of creating headers for a response and a
  respective brigade.

Github: closes #137


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1881620 13f79535-47bb-0310-9956-ffa450edef68
2020-09-10 10:45:12 +00:00
Stefan Eissing
971fc8f5b5 *) mod_http2:
Fixes <https://github.com/icing/mod_h2/issues/200>: 
     "LimitRequestFields 0" now disables the limit, as documented.
     Fixes <https://github.com/icing/mod_h2/issues/201>: 
     Do not count repeated headers with same name against the field
     count limit. The are merged internally, as if sent in a single HTTP/1 line.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1879832 13f79535-47bb-0310-9956-ffa450edef68
2020-07-13 15:36:53 +00:00
Stefan Eissing
2cec2d15c9 *) mod_http2: workaround to facilitate use of common internal protocol/method/uri
checks. The module now handles master/secondary connections and has marked
     methods according to use.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1878926 13f79535-47bb-0310-9956-ffa450edef68
2020-06-17 15:10:29 +00:00
Mike Rumph
85760859ca Fix spelling errors found by codespell. [skip ci]
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1873985 13f79535-47bb-0310-9956-ffa450edef68
2020-02-13 18:15:57 +00:00
Christophe Jaillet
34ef2afa8c Add a missing APLOGNO()
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1873927 13f79535-47bb-0310-9956-ffa450edef68
2020-02-12 05:36:31 +00:00
Stefan Eissing
dd8ba20047 *) mod_http2: Fixed interaction with mod_reqtimeout. A loaded mod_http2 was disabling the
ssl handshake timeouts. Also, fixed a mistake of the last version that made `H2Direct` 
     always `on`, irregardless of configuration. Found and reported by
     <Armin.Abfalterer@united-security-providers.ch> and
     <Marcial.Rion@united-security-providers.ch>. [Stefan Eissing] 

  *) mod_http2: Multiple field length violations in the same request no longer cause
     several log entries to be written. [@mkauf]



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1870454 13f79535-47bb-0310-9956-ffa450edef68
2019-11-26 09:36:28 +00:00
Eric Covener
7b7ec0519d followup to r1864733
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1864736 13f79535-47bb-0310-9956-ffa450edef68
2019-08-08 21:24:41 +00:00
Christophe Jaillet
614ca69061 Add missing APLOGNO
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1864733 13f79535-47bb-0310-9956-ffa450edef68
2019-08-08 20:40:49 +00:00
Stefan Eissing
8368bf60dc *) mod_http2: core setting "LimitRequestFieldSize" is not additionally checked on
merged header fields, just as HTTP/1.1 does. [Stefan Eissing, Michael Kaufmann]



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1863276 13f79535-47bb-0310-9956-ffa450edef68
2019-07-18 12:31:01 +00:00
Stefan Eissing
91189ca77a mod_http2: update log tags, log field len errors at INFO level (via mkaufmann)
mod_proxy_http2: udpate log tags



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1863221 13f79535-47bb-0310-9956-ffa450edef68
2019-07-17 13:54:47 +00:00