-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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: no way for Server to set Trailer headers #7759
Comments
For streaming responses (e.g. 'ipfs add -r /path/to/root/directory'), we may hit errors later on in the stream, after we've already written the initial 200 response and started in on the streaming body (e.g. /path/to/root/directory/a/b/c is an unsupported file type). We should check for that sort of error, and set a trailer [1] if there were any errors. Unfortunately, it's a bit awkward to set these headers in Go 1.4 and earlier [2], but [2] does have a workaround for Go 1.4 (it's not clear if the workaround is compatible with Go 1.3). [1]: http://tools.ietf.org/html/rfc2616#section-14.40 [2]: golang/go#7759 License: MIT Signed-off-by: W. Trevor King <wking@tremily.us>
For streaming responses (e.g. 'ipfs add -r /path/to/root/directory'), we may hit errors later on in the stream, after we've already written the initial 200 response and started in on the streaming body (e.g. /path/to/root/directory/a/b/c is an unsupported file type). We should check for that sort of error, and set a trailer [1] if there were any errors. Unfortunately, it's a bit awkward to set these headers in Go 1.4 and earlier [2], but [2] does have a workaround for Go 1.4 (it's not clear if the workaround is compatible with Go 1.3). [1]: http://tools.ietf.org/html/rfc2616#section-14.40 [2]: golang/go#7759 License: MIT Signed-off-by: W. Trevor King <wking@tremily.us>
For streaming responses (e.g. 'ipfs add -r /path/to/root/directory'), we may hit errors later on in the stream, after we've already written the initial 200 response and started in on the streaming body (e.g. /path/to/root/directory/a/b/c is an unsupported file type). We should check for that sort of error, and set a trailer [1] if there were any errors. Unfortunately, it's a bit awkward to set these headers in Go 1.4 and earlier [2], but [2] does have a workaround for Go 1.4 (it's not clear if the workaround is compatible with Go 1.3). [1]: http://tools.ietf.org/html/rfc2616#section-14.40 [2]: golang/go#7759 License: MIT Signed-off-by: W. Trevor King <wking@tremily.us>
For streaming responses (e.g. 'ipfs add -r /path/to/root/directory'), we may hit errors later on in the stream, after we've already written the initial 200 response and started in on the streaming body (e.g. /path/to/root/directory/a/b/c is an unsupported file type). We should check for that sort of error, and set a trailer [1] if there were any errors. Unfortunately, it's a bit awkward to set these headers in Go 1.4 and earlier [2], but [2] does have a workaround for Go 1.4 (it's not clear if the workaround is compatible with Go 1.3). [1]: http://tools.ietf.org/html/rfc2616#section-14.40 [2]: golang/go#7759 License: MIT Signed-off-by: W. Trevor King <wking@tremily.us>
Does this mean the example at http://golang.org/pkg/net/http/#example_ResponseWriter_trailers does not actually work? |
@drcrallen, what gives you that impression? See the most recent comment. https://go-review.googlesource.com/2157 added support. It's in Go 1.5. |
@bradfitz Misreading of docs on my part. Found out I have 1.4.2 installed but was using tutorials from prior URL, which are built for go1.5 (in the page footer which I missed). My bad |
The text was updated successfully, but these errors were encountered: