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: docs are wrong for multiple headers with same key #5979

Closed
josharian opened this issue Jul 28, 2013 · 2 comments
Closed

net/http: docs are wrong for multiple headers with same key #5979

josharian opened this issue Jul 28, 2013 · 2 comments
Milestone

Comments

@josharian
Copy link
Contributor

What steps will reproduce the problem?

Run http://play.golang.org/p/SmkSnOoyAC locally. For reference, here is a sample
response from that http server:

HTTP/1.1 200 OK
Custom: a
Custom: b
Content-Type: text/plain; charset=utf-8
Content-Length: 0
Date: Sun, 28 Jul 2013 21:02:11 GMT


What is the expected output?

The documentation for http.Response reads: "If the response had multiple headers
with the same key, they will be concatenated, with comma delimiters.  (Section 4.2 of
RFC 2616 requires that multiple headers be semantically equivalent to a comma-delimited
sequence.)"

Given that, I'd expect to see "[a, b]" (a slice containing a single string,
"a, b").


What do you see instead?

"[a b]" (a slice containing two strings, "a" and "b").


Which compiler are you using (5g, 6g, 8g, gccgo)?

6g


Which operating system are you using?

OS X


Which version are you using?  (run 'go version')

1.1


Please provide any additional information below.

It is not obvious to me whether the behavior or the documentation should be changed.
@rsc
Copy link
Contributor

rsc commented Jul 30, 2013

Comment 1:

The docs are out of date and should be updated. The slice is correct.
Not all servers obey the RFC, so converting to a single entry was losing information.

Labels changed: added priority-later, go1.2, removed priority-triage.

Status changed to Accepted.

@bradfitz
Copy link
Contributor

bradfitz commented Aug 4, 2013

Comment 2:

This issue was closed by revision 910caf9.

Status changed to Fixed.

@rsc rsc added this to the Go1.2 milestone Apr 14, 2015
@rsc rsc removed the go1.2 label Apr 14, 2015
@golang golang locked and limited conversation to collaborators Jun 24, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants