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: Document Content-Length behavior for servers #23450

Closed
jsha opened this issue Jan 15, 2018 · 2 comments
Closed

net/http: Document Content-Length behavior for servers #23450

jsha opened this issue Jan 15, 2018 · 2 comments

Comments

@jsha
Copy link

@jsha jsha commented Jan 15, 2018

What version of Go are you using (go version)?

Go 1.9

Does this issue reproduce with the latest release?

Yes.

For a Go HTTP server, we noticed that sometimes it was setting the Content-Length header on responses, and sometimes it was not. The user code for the HTTP server didn't set Content-Length anywhere, so it must be the stdlib code. After some digging in the stdlib code, we found that Content-Length will be automatically set on small response bodies only. It would be good to document this in the net/http godocs.

@mvdan

This comment has been minimized.

Copy link
Member

@mvdan mvdan commented Jan 15, 2018

@titanous titanous added this to the Go1.11 milestone Jan 16, 2018
@titanous titanous added the NeedsFix label Jan 16, 2018
@gopherbot

This comment has been minimized.

Copy link

@gopherbot gopherbot commented May 29, 2018

Change https://golang.org/cl/115040 mentions this issue: net/http: document Server's implicit Content-Length response header

@gopherbot gopherbot closed this in a4330ed May 29, 2018
@golang golang locked and limited conversation to collaborators May 29, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.