You can find all details in the RFC:
http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html
--
Gustavo Niemeyer
http://niemeyer.net
http://niemeyer.net/blog
http://niemeyer.net/twitter
Anybody want to write a method on *http.Request that returns this header parsed into a slice of sorted Go structs?
] Anybody want to write a method on *http.Request that returns this header
] parsed into a slice of sorted Go structs?
]
] Would be fun, but I don't think Accept is used too often in practice, sadly.
It's heavily used in semantic-web applications. I've actually
written a package for this, used in production, and sanity
checked by a member of the pedantic-web group whose hobby is
finding (extremely common) bugs in content-type negotiation.
https://bitbucket.org/ww/goautoneg
Contains two functions, ParseAccept which does what it says
on the tin, and Negotiate which choses the most appropriate
from a list of server-provided alternatives.
Cheers,
-w
--
William Waites <mailto:w...@styx.org>
http://river.styx.org/ww/ <sip:w...@styx.org>
F4B3 39BF E775 CF42 0BAB 3DF0 BE40 A6DF B06F FD45
application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
That's what Chrome sends. Read it closely. Yes, given the choice,
Chrome prefers pictures of web pages (image/png; q=1.0) to old
style HTML (text/html; q=0.9).
I reported this bug some time ago but it doesn't seem to have
been fixed yet...
An interesting side note, from one of the test cases:
] You actually only appear to have one TOTAL test case. :-)
hmmm... you're right... I recall others but maybe they were from
the python version that I had written some time before.
] But that aside, this looks pretty nice. You want to submit it for inclusion
] in the standard http library?
Happily. I'll see if I can figure out how to use the code
review (that is what I should do, right?)
* [2011-05-20 15:05:27 -0700] Brad Fitzpatrick <brad...@golang.org> écrit:
] You actually only appear to have one TOTAL test case. :-)
hmmm... you're right... I recall others but maybe they were from
the python version that I had written some time before.
] But that aside, this looks pretty nice. You want to submit it for inclusion
] in the standard http library?Happily. I'll see if I can figure out how to use the code
review (that is what I should do, right?)