Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(17)

Issue 4528086: code review 4528086: http: content-type negotiation and Accept header parsing.

Can't Edit
Can't Publish+Mail
Start Review
Created:
15 years, 1 month ago by ww
Modified:
11 years, 10 months ago
Reviewers:
pascal, dchest, golang-codereviews, andrew.oneil, bradfitz
CC:
golang-codereviews
Visibility:
Public.

Description

http: content-type negotiation and Accept header parsing. This introduces two functions and one type. The type is Accept which represents a clause in an Accept header. The functions are ParseAccept which parses such a header and Negotiate which, given a header and a list of alternatives content types returns the most appropriate result. It is possible that the Negotiate should default by returning the first of the alternative in the case that the provided header is empty. This doesn't appear to happen often in practice and in any case perhaps it is the calling function's job to make sure that the header passed in is valid.

Patch Set 1 #

Patch Set 2 : diff -r 0f59e8fbd2a1 https://go.googlecode.com/hg/ #

Patch Set 3 : diff -r 0f59e8fbd2a1 https://go.googlecode.com/hg/ #

Patch Set 4 : diff -r 0f59e8fbd2a1 https://go.googlecode.com/hg/ #

Total comments: 7

Patch Set 5 : diff -r 0f59e8fbd2a1 https://go.googlecode.com/hg/ #

Unified diffs Side-by-side diffs Delta from patch set Stats (+290 lines, -0 lines) Patch
M src/pkg/http/Makefile View 1 1 chunk +1 line, -0 lines 0 comments Download
A src/pkg/http/autoneg.go View 1 2 3 4 1 chunk +167 lines, -0 lines 0 comments Download
A src/pkg/http/autoneg_test.go View 1 2 3 1 chunk +122 lines, -0 lines 0 comments Download

Messages

Total messages: 26
ww
Hello golang-dev@googlegroups.com (cc: golang-dev@googlegroups.com), I'd like you to review this change to https://go.googlecode.com/hg/
15 years, 1 month ago (2011-05-20 22:50:59 UTC) #1
bradfitz
What do you think about: type Accept struct{} type AcceptList []Accept func (al AcceptList) Negotiate(contentType ...
15 years, 1 month ago (2011-05-20 23:38:29 UTC) #2
ww
Generally I think this would be a nice way to go about it, however there ...
15 years, 1 month ago (2011-05-21 08:37:52 UTC) #3
ww
Hello golang-dev@googlegroups.com, bradfitz@golang.org (cc: golang-dev@googlegroups.com), Please take another look.
15 years, 1 month ago (2011-05-21 09:29:10 UTC) #4
ww
Hello golang-dev@googlegroups.com, bradfitz@golang.org (cc: golang-dev@googlegroups.com), Please take another look.
15 years, 1 month ago (2011-05-21 09:30:46 UTC) #5
dchest
I'd love to have this type somewhere in http package: struct HeaderField type { Value ...
15 years, 1 month ago (2011-05-21 11:08:57 UTC) #6
ww
On 21 May 2011 12:08, <dchest@gmail.com> wrote: > I'd love to have this type somewhere ...
15 years, 1 month ago (2011-05-21 12:48:08 UTC) #7
dchest
On 2011/05/21 12:48:08, ww wrote: > On 21 May 2011 12:08, <mailto:dchest@gmail.com> wrote: > > ...
15 years, 1 month ago (2011-05-21 13:09:38 UTC) #8
ww
> If sorting doesn't apply, we can parse first into the list of > HeaderField ...
15 years, 1 month ago (2011-05-21 13:46:23 UTC) #9
dchest
What I'm trying to say is that it would be better if the parsing stages ...
15 years, 1 month ago (2011-05-21 14:10:49 UTC) #10
ww
The don't parse rule is about "converting an unstructured sequence of commands, in a format ...
15 years, 1 month ago (2011-05-21 14:24:16 UTC) #11
dchest
On 2011/05/21 14:24:16, ww wrote: > All of these headers are quite well structured and ...
15 years, 1 month ago (2011-05-21 14:33:44 UTC) #12
ww
On 21 May 2011 15:33, <dchest@gmail.com> wrote: > On 2011/05/21 14:24:16, ww wrote: >> >> ...
15 years, 1 month ago (2011-05-21 14:41:44 UTC) #13
dchest
On 2011/05/21 14:41:44, ww wrote: > On 21 May 2011 15:33, <mailto:dchest@gmail.com> wrote: > > ...
15 years, 1 month ago (2011-05-21 14:53:01 UTC) #14
ww
> I agree that it's simple, but is it different? > value;q=...;extension=..., * Extension does ...
15 years, 1 month ago (2011-05-21 14:56:51 UTC) #15
dchest
On 2011/05/21 14:56:51, ww wrote: > > I agree that it's simple, but is it ...
15 years, 1 month ago (2011-05-21 15:01:31 UTC) #16
ww
Hello golang-dev@googlegroups.com, bradfitz@golang.org, dchest@gmail.com (cc: golang-dev@googlegroups.com), Please take another look.
15 years, 1 month ago (2011-05-21 15:14:36 UTC) #17
ww
On 21 May 2011 16:01, <dchest@gmail.com> wrote: > On 2011/05/21 14:56:51, ww wrote: >> >> ...
15 years, 1 month ago (2011-05-21 15:16:43 UTC) #18
ww
Actually, discussing unrelated things in IRC, what would be *really* nice is for the ebnf ...
15 years, 1 month ago (2011-05-21 15:34:51 UTC) #19
pascal
Hi William, It seems we have been doing the same thing during the weekend by ...
15 years, 1 month ago (2011-05-23 22:47:28 UTC) #20
bradfitz
On Sat, May 21, 2011 at 8:34 AM, William Waites <wwaites@googlemail.com>wrote: > Actually, discussing unrelated ...
15 years, 1 month ago (2011-05-24 00:25:40 UTC) #21
bradfitz
http://codereview.appspot.com/4528086/diff/9001/src/pkg/http/autoneg.go File src/pkg/http/autoneg.go (right): http://codereview.appspot.com/4528086/diff/9001/src/pkg/http/autoneg.go#newcode163 src/pkg/http/autoneg.go:163: // such a client would be quite broken... isn't ...
15 years, 1 month ago (2011-05-24 00:28:43 UTC) #22
andrew.oneil_99designs.com
Hi, I'm currently looking into parsing Accept-Language headers, and I came across this patch. Is ...
11 years, 10 months ago (2014-08-22 01:35:44 UTC) #23
gobot
Replacing golang-dev with golang-codereviews. To the author of this CL: If you are using 'hg ...
11 years, 10 months ago (2014-08-22 01:37:13 UTC) #24
bradfitz
Until something in the standard library depends on this, it's unlikely we'll add it to ...
11 years, 10 months ago (2014-08-28 15:24:57 UTC) #25
bradfitz
11 years, 10 months ago (2014-09-02 18:49:03 UTC) #26
R=close
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b