Skip to content

Expires-field in set cookie not parsed properly (=at all) by http package #1855

@vdobler

Description

@vdobler
Parsing of the "expires" field in a set-cookie fails as
isCookieByte() of cookies.go will mark comma 0x2c and space 0x20
of the value of the expires field as invalid.
To my understanding the value of the expires field of a cookie
is a RFC1123 formatted time like "Sat, 21 May 2011 12:00:00 GMT"
which is allowed to contain spaces and commas without quoting them.
The issue is triggered by trying to validate values for fields
by calling parseCookieValue(val) which is too restrictive for 
expires.

What steps will reproduce the problem?
package main
import (
    "http"
    "fmt"
)

func main() {
    resp, _, _ := http.Get("http://www.google.ch";)
    fmt.Printf("%#v\n", resp.SetCookie[0].Unparsed)
}


What is the expected output?
"Nothing": []string{}

What do you see instead?
[]string{"expires=Sun, 19-May-2013 13:06:39 GMT"}

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

Which operating system are you using?
windows

Which revision are you using?  (hg identify)
r57.1

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions