FAQ
Reviewers: bradfitz, volker.dobler,

Message:
Hello bradfitz@golang.org, dr.volker.dobler@gmail.com (cc:
golang-dev@googlegroups.com, r@golang.org, rsc@golang.org),

I'd like you to review this change to
https://code.google.com/p/go


Description:
net/http: add Cookie fields to satisfy RFC 6265 section 5.3
"Storage Model".

Please review this at http://codereview.appspot.com/6822066/

Affected files:
M src/pkg/net/http/cookie.go


Index: src/pkg/net/http/cookie.go
===================================================================
--- a/src/pkg/net/http/cookie.go
+++ b/src/pkg/net/http/cookie.go
@@ -17,21 +17,30 @@
// http://tools.ietf.org/html/rfc6265

// A Cookie represents an HTTP cookie as sent in the Set-Cookie header of
an
-// HTTP response or the Cookie header of an HTTP request.
+// HTTP response or the Cookie header of an HTTP request, or stored in a
+// CookieJar.
type Cookie struct {
- Name string
- Value string
- Path string
- Domain string
+ Name string
+ Value string
+ Path string
+ Domain string
+
Expires time.Time
RawExpires string

// MaxAge=0 means no 'Max-Age' attribute specified.
// MaxAge<0 means delete cookie now, equivalently 'Max-Age: 0'
// MaxAge>0 means Max-Age attribute present and given in seconds
- MaxAge int
- Secure bool
- HttpOnly bool
+ MaxAge int
+
+ Creation time.Time
+ LastAccess time.Time
+
+ Persistent bool
+ HostOnly bool
+ Secure bool
+ HttpOnly bool
+
Raw string
Unparsed []string // Raw text of unparsed attribute-value pairs
}

Search Discussions

  • Dr Volker Dobler at Nov 1, 2012 at 9:02 am
    Everything is there to implement a RFC 6265
    cookie jar.

    But Cookie is now a complex mixture of Raw/Unparsed
    fields, parsed but unprocessed fields (Domain),
    parsed and processed fields (MaxAge), fields which
    get populated and used only in Jar (Persistent) and
    fields which might be used only by the Jar's underlying
    storage (LastAccess).

    Such a mixture needs substantially amount of docu.

    I am feeling less and less comfortable with reusing
    http.Cookie as the storage model in a cookie jar.






    https://codereview.appspot.com/6822066/diff/4001/src/pkg/net/http/cookie.go
    File src/pkg/net/http/cookie.go (right):

    https://codereview.appspot.com/6822066/diff/4001/src/pkg/net/http/cookie.go#newcode15
    src/pkg/net/http/cookie.go:15: // This implementation is done according
    to RFC 6265:
    This comment might be helpful for Cookie as
    it would document most of Cookies fields.

    https://codereview.appspot.com/6822066/diff/4001/src/pkg/net/http/cookie.go#newcode29
    src/pkg/net/http/cookie.go:29: RawExpires string
    The storage model is a mixture of RFC 6265's
    fields and Raw and Unparsed fields, that looks
    a bit odd.

    https://codereview.appspot.com/6822066/diff/4001/src/pkg/net/http/cookie.go#newcode36
    src/pkg/net/http/cookie.go:36: Creation time.Time
    As Brad mentioned in his review: Some of these fields are
    not used in package http and would deserve some comments, especially as
    they are derived form other fields (e.g.
    HostOnly from Domain) but not during a http response.

    https://codereview.appspot.com/6822066/
  • Rsc at Nov 1, 2012 at 5:19 pm
    LGTM but wait for Brad

    I agree about the need for additional comments.


    https://codereview.appspot.com/6822066/

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-dev @
categoriesgo
postedNov 1, '12 at 4:36a
activeNov 1, '12 at 5:19p
posts3
users3
websitegolang.org

3 users in discussion

Nigeltao: 1 post Rsc: 1 post Dr Volker Dobler: 1 post

People

Translate

site design / logo © 2022 Grokbase