Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

net/http: Server/Handler/ResponseWriter doesn't allowing sending arbitrary 1xx responses #26089

Open
bradfitz opened this issue Jun 27, 2018 · 3 comments · May be fixed by #42597 or golang/net#87
Open

net/http: Server/Handler/ResponseWriter doesn't allowing sending arbitrary 1xx responses #26089

bradfitz opened this issue Jun 27, 2018 · 3 comments · May be fixed by #42597 or golang/net#87

Comments

@bradfitz
Copy link
Contributor

@bradfitz bradfitz commented Jun 27, 2018

As part of #17739 (properly handling 1xx responses per the HTTP specs), we need to be able to forward 1xx responses in ReverseProxy (#26088)

To forward such responses, we need a way for for an http.Handler in a Server to use the ResponseWriter (or something) to send a 1xx response.

@bradfitz
Copy link
Contributor Author

@bradfitz bradfitz commented Jun 27, 2018

(Notably, to send any number of 1xx responses and then a final non-1xx response)

Maybe we just allow multiple ResponseWriter.WriteHeader calls and say that 1xx writes clear the header for future calls to Header?

dunglas added a commit to dunglas/go that referenced this issue Nov 13, 2020
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.

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.

Fixes golang#26089.
Fixes golang#36734.
Updates golang#26088.
@dunglas dunglas linked a pull request that will close this issue Nov 13, 2020
@gopherbot
Copy link

@gopherbot gopherbot commented Nov 13, 2020

Change https://golang.org/cl/269997 mentions this issue: net/http: allow sending 1xx responses

@dunglas dunglas linked a pull request that will close this issue Nov 14, 2020
@gopherbot
Copy link

@gopherbot gopherbot commented Nov 14, 2020

Change https://golang.org/cl/270157 mentions this issue: http2: allow sending 1xx responses

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

2 participants
You can’t perform that action at this time.