* http3: update documentation for `Hijacker`
The documentation for `Hijacker` seems to be legacy from
[v0.43.0](https://github.com/quic-go/quic-go/releases/tag/v0.43.0). This
commit updates the documentation to reflect the current API use.
* http3: update documentation for `HTTPStreamer`
The documentation for `HTTPStreamer` seems to be legacy from
[v0.43.0](https://github.com/quic-go/quic-go/releases/tag/v0.43.0). This
commit updates the documentation to reflect the current API use.
* 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>
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.
* http3: HEAD method should not have a body
* add tests
* Update http3/server.go
Co-authored-by: Marten Seemann <martenseemann@gmail.com>
* ruduce the size of responseWriter
---------
Co-authored-by: Marten Seemann <martenseemann@gmail.com>
* automatically add date header if not already set
* improve comment for Date header
---------
Co-authored-by: Marten Seemann <martenseemann@gmail.com>
* feat: compatibility with "net/http".ResponseController
* better deadline tests
* don't run deadline tests on Go 1.19
* skip deadline tests on Go 1.19
* add sniff
* add test for sniff
* fix typo in comment
* move bodyAllowedForStatus() to top of the function to aviod calling it twice
* add comments
* format with gofumpt
* fix typo and simplify the code
Currently, it's not possible to send informational responses such as 103 Early Hints or 102 Processing.
This patch allows calling WriteHeader() multiple times in order to send informational responses before the final one.
It follows the patch for HTTP/1 (golang/go#42597) and HTTP/2 (golang/net#96).
In conformance with RFC 8297, if the status code is 103 the current content of the header map is also sent. Its content is not removed after the call to WriteHeader() because the headers must also be included in the final response.
The Chrome and Fastly teams are starting a large-scale experiment to measure the real-life impact of the 103 status code.
Using Early Hints is proposed as a (partial) alternative to Server Push, which are going to be removed from Chrome: https://groups.google.com/a/chromium.org/g/blink-dev/c/K3rYLvmQUBY/m/21anpFhxAQAJ
Being able to send this status code from servers implemented using Go would help to see if implementing it in browsers is worth it.