Commit Graph

329 Commits

Author SHA1 Message Date
Marten Seemann
e5693d0ad7 http3: immediately close all connections on Server.Close (#4689)
* http3: immediately close all connections on Server.Close

* http3: document connection closing when using ServeQUICConn
2024-10-09 13:24:13 -07:00
Marten Seemann
b2233591ad http3: fix capsule parsing (#4683)
The current code returns an io.ErrUnexpectedEOF on partial reads of the
capsule content.
2024-10-02 07:12:27 -07:00
Marten Seemann
1ad36eb7b8 http3: avoid re-parsing of the Content-Length header for responses (#4648)
* http3: avoid re-parsing of the Content-Length header for responses

* http3: set http.Response.ContentLength to 0 for certain types of responses
2024-09-08 01:12:33 -07:00
Kevin McDonald
b92bf0c80d http3: initialize trailer map with empty trailer entries when parsing the header (#4656)
* feat: pre-populate trailers on response with empty values

* fix: improve comment/func name
2024-09-06 23:59:07 -07:00
Kevin McDonald
09c2ac8aab http3: add HTTP Trailer support for servers (#4630) 2024-09-06 21:51:54 -07:00
Marten Seemann
26a3525337 http3: reject connection-specific header fields, check value of TE (#4655) 2024-09-01 02:20:35 -07:00
Marten Seemann
7c3544ca34 http3: set ContentLength to -1 if no Content-Length header is set (#4645)
This applies to both the http.Response and the http.Request.
2024-08-30 05:28:06 -07:00
Marten Seemann
229937c503 http3: reject the Transfer-Encoding header field (#4646)
The use of Transfer-Encoding is forbidden in HTTP/3, see section 4.1 of
RFC 9114.
2024-08-28 05:31:58 -07:00
Marten Seemann
920bfb46af http3: reject pseudo header fields in trailers (#4639)
* http3: reject pseudo header fields in trailers

As defined in section 4.3 of RFC 9114.

* http3: improve allocs for trailer map

* http3: rename connection.parseTrailer to decodeTrailers
2024-08-23 03:42:18 -07:00
Kevin McDonald
17fb3b96ba http3: add client-side HTTP Trailer support (#4581)
* http3: add HTTP Trailer support for clients

This change only adds support to read HTTP trailers sent to clients.

* chore: add protection against some out-of-spec behavior + tests

* chore: re-add test accidentally overwtitten

* chore: empty commit to re-trigger ci

* fix: address some review notes (wip)

* fix: simplify code in stream.Read by using a callback from requestStream.ReadResponse

* restructure where trailers are read and parsed

* WIP simplify trailer parsing design

* chore: refactor to use simpler trailer parsing strategy

* make gofumpt happy

* Update http3/headers.go

Co-authored-by: Marten Seemann <martenseemann@gmail.com>

* remove stray TODO

---------

Co-authored-by: Marten Seemann <martenseemann@gmail.com>
2024-08-22 22:25:58 -07:00
Olivier Poitrey
7c471aac74 http3: implement server idle timeout support (#4587)
* http3: implement server idle timeout support

This update introduces the ability for an HTTP/3 server to enforce an idle
timeout on connections. This timeout will trigger when no new requests are
received on a connection, irrespective of any PING frames received at the
QUIC level.

* fix deadlock when http3 idle timeout is not enabled

* fix typo

* Switch to a more efficient implementation

* Avoid a goroutine
* Avoid constent re-adjusting of a timer
* Works with hijacked streams

* Generalize the idle timeout description

* Add an integration test for http server idle timeout

* Attempt to fix other tests impacted by the new idle timeout test
2024-08-04 15:53:33 -07:00
Marten Seemann
2a082f973a http3: allow re-dialing of connection after a dial error (#4573)
* http3: do not cache dial error

* add an integration test

* http3: add a unit test for dial failures

---------

Co-authored-by: 世界 <i@sekai.icu>
2024-06-22 21:38:49 -07:00
Marten Seemann
10f8bd4e06 http3: fix race condition between Server.Serve and Server.Close (#4572) 2024-06-23 01:13:56 +08:00
Marten Seemann
459a6f3df9 fix the server's 0-RTT rejection logic when using GetConfigForClient (#4550) 2024-06-03 03:42:58 -07:00
Marten Seemann
5446b5f912 http3: use the connection, not the stream context, on the server side (#4510) 2024-06-03 10:23:35 +08:00
Marten Seemann
82a3847439 http3: fix another flaky Extended CONNECT test (#4539) 2024-05-28 22:57:43 -07:00
Marten Seemann
ae90c76822 http3: fix flaky Extended CONNECT unit test (#4537) 2024-05-27 21:43:01 -07:00
George
e2fbf3cdcd http3: fix memory leak in stream state tracking (#4523)
* fix(http3): handle streamStateSendAndReceiveClosed in onStreamStateChange

Signed-off-by: George MacRorie <me@georgemac.com>

* refactor(http3): adjust stateTrackingStream to operate over streamClearer and errorSetter

* test(http3): remove duplicate test case

* chore(http3): rename test spies to be mocks

---------

Signed-off-by: George MacRorie <me@georgemac.com>
2024-05-18 19:15:32 -07:00
Z.SX
f3cecf952e http3: rename ListenAndServe to ListenAndServeTLS (#4522)
* http3: rename ListenAndServe to ListenAndServeTLS

* http3: fix golanglint

---------

Co-authored-by: Shunxin Zhang <shunxin.zhang@shopee.com>
2024-05-14 18:32:56 -07:00
Marten Seemann
475b4f02cb http3: ignore deadline errors when tracking QUIC stream states (#4495) 2024-05-06 19:03:41 -07:00
Marten Seemann
5aac43549b http3: fix race condition when creating state tracking stream (#4493) 2024-05-05 06:34:55 -07:00
Marten Seemann
bb6f066aa5 http3: use the stream context to detect when the send side is closed (#4489) 2024-05-04 19:15:35 -07:00
Marten Seemann
c7b58b568f http3: refuse to send datagrams associated with a closed stream (#4488)
It's only valid to send datagrams associated with a stream whose send
direction is not closed.
2024-05-04 17:48:07 -07:00
Marten Seemann
a3d36f1cbb http3: reject reserved frame types (#4467) 2024-05-04 15:23:40 -07:00
Robin Thellend
a5adbd44c7 http3: pass original Conn to ConnContext (#4480)
* http3: Pass original Conn to ConnContext

https://github.com/quic-go/quic-go/issues/4479

* Update test to check conn value
2024-05-03 16:17:39 -07:00
Marten Seemann
3122ca009b http3: avoid allocation when parsing the datagram's quarter stream ID (#4478) 2024-05-03 20:13:38 +08:00
Marten Seemann
8de22b2468 http3: allow io.EOF when parsing a capsule fails on the first byte (#4476) 2024-05-03 04:14:18 -07:00
WeidiDeng
93c4785521 http3: sniff Content-Type when flushing the ResponseWriter (#4412)
* try to sniff content-type as long as the data is not written to the client

* only write when body is allowed

* fix tests

* fix tests

* fix header count

* fix lint

* merge from upstream

* merge updates from master

* Update http3/response_writer.go

Co-authored-by: Marten Seemann <martenseemann@gmail.com>

---------

Co-authored-by: Marten Seemann <martenseemann@gmail.com>
2024-04-27 07:26:21 -07:00
Marten Seemann
34f4d1443f http3: implement on the HTTPStreamer on the ResponseWriter, flush header (#4469)
Currently the HTTPStreamer is implemented on the http.Request.Body. This
complicates usage, since it's not easily possible to flush the HTTP
header, requiring users to manually flash the header before taking over
the stream.

With this change, the HTTP header is now flushed automatically as soon
as HTTPStream is called.
2024-04-27 04:30:39 -07:00
Marten Seemann
083ceb42f2 http3: rename Settings.EnableDatagram to EnableDatagrams (#4466)
This makes it consistent with the quic.Config and the config flag on the
http3.Server and http3.RoundTripper.
2024-04-26 13:35:21 -07:00
Marten Seemann
e1e5b6294d README: link to the new documentation site (#4464) 2024-04-26 11:28:49 -07:00
Marten Seemann
2a37c53143 http3: add support for HTTP Datagrams (RFC 9297) (#4452)
* http3: add support for HTTP Datagrams (RFC 9297)

* README: reference HTTP Datagrams (RFC 9297)
2024-04-26 11:21:04 -07:00
Marten Seemann
11b11594b2 http3: fix race condition in client unit test (#4463) 2024-04-26 10:32:03 -07:00
Marten Seemann
6a4512a6f0 http3: fix race condition when closing the RoundTripper (#4458) 2024-04-23 13:23:48 -07:00
mchtech
86b53a2516 http3: process 1xx status codes (#4437)
* process http 1xx status code

Signed-off-by: mchtech <michu_an@126.com>

* add integration tests

Signed-off-by: mchtech <michu_an@126.com>

* fix tests

---------

Signed-off-by: mchtech <michu_an@126.com>
Co-authored-by: Marten Seemann <martenseemann@gmail.com>
2024-04-21 02:56:45 -07:00
Marten Seemann
3e7ba77a77 http3: check server SETTINGS before sending an Extended CONNECT request (#4450) 2024-04-20 06:21:36 -07:00
Marten Seemann
18422ad1c4 http3: remove RoundTripOpt.CheckSettings (#4416)
The settings can be obtained from the SingleDestinationRoundTripper.
2024-04-20 02:42:33 -07:00
Marten Seemann
9bc7bd84cc http3: use a log/slog.Logger for logging (#4449) 2024-04-20 01:59:58 -07:00
George
248189d252 http3: don't remove clients on RoundTripOpt context canceled (#4448)
* fix(http3): reuse clients on RoundTripOpt context cancelled

Signed-off-by: George MacRorie <me@georgemac.com>

* chore(http3): add comment to context canceled check on roundtrip error

---------

Signed-off-by: George MacRorie <me@georgemac.com>
2024-04-20 01:47:34 -07:00
Marten Seemann
e48e1d465d http3: simplify response header writing (#4441) 2024-04-17 09:44:36 -07:00
Marten Seemann
788b6f4409 http3: fix flaky RoundTripper test (#4442) 2024-04-17 09:44:20 -07:00
Marten Seemann
457ac2c4dc http3: move length limiting logic to the body (#4439)
The length limit is a property of the (request and response) body. As
such, it's better implemented there than by wrapping the HTTP stream.
2024-04-17 01:26:45 -07:00
Marten Seemann
29785b29bf http3: simplify tracking of content length (#4438) 2024-04-16 06:35:31 -07:00
Marten Seemann
afd0b061d5 http3: remove Accept(Uni)Stream methods from the Connection interface (#4435)
Incoming streams are hijacked, not accepted.
2024-04-14 08:37:01 -07:00
Marten Seemann
25cd4b5d24 http3: simplify composition of the HTTP stream and request stream (#4433) 2024-04-13 17:18:51 -07:00
Marten Seemann
90627f6f7c http3: simplify buffering of small responses (#4432) 2024-04-13 16:46:19 -07:00
Marten Seemann
b096e94092 http3: hide SendDatagram and ReceiveDatagram on the Connection (#4427)
HTTP datagrams are bound to streams. It shouldn't be possible to send
datagrams on the http3.Connection.
2024-04-11 14:13:34 -07:00
Marten Seemann
da410a7b59 http3: expose a SingleDestinationRoundTripper (#4424) 2024-04-11 09:55:05 -07:00
Marten Seemann
9efc324637 http3: remove Settingser, StreamCreator, return Connection from Hijacker (#4425) 2024-04-11 08:47:00 -07:00
Marten Seemann
ee698b326f http3: cancel reading on request stream if request processing fails (#4417) 2024-04-09 13:34:00 -07:00