diff options
| author | Petar Maymounkov <petarm@gmail.com> | 2011-03-06 15:02:06 -0500 |
|---|---|---|
| committer | Russ Cox <rsc@golang.org> | 2011-03-06 15:02:06 -0500 |
| commit | 6afe7eba32c06022ef11ab0307d6b3361b59a8f0 (patch) | |
| tree | 664cb2c72087b1d20ec5470701d5ca7dc38c4698 /src/pkg/http/request.go | |
| parent | eeb8d00c867570a500029cd113e6e34119c54766 (diff) | |
| download | go-6afe7eba32c06022ef11ab0307d6b3361b59a8f0.tar.xz | |
http: add cookie support
R=rsc1, mattn, bradfitzwork, pascal, bradfitzgo
CC=golang-dev
https://golang.org/cl/4214042
Diffstat (limited to 'src/pkg/http/request.go')
| -rw-r--r-- | src/pkg/http/request.go | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/pkg/http/request.go b/src/pkg/http/request.go index 22b19959dd..2f6e33ae9b 100644 --- a/src/pkg/http/request.go +++ b/src/pkg/http/request.go @@ -92,6 +92,9 @@ type Request struct { // following a hyphen uppercase and the rest lowercase. Header Header + // Cookie records the HTTP cookies sent with the request. + Cookie []*Cookie + // The message body. Body io.ReadCloser @@ -249,6 +252,10 @@ func (req *Request) write(w io.Writer, usingProxy bool) os.Error { return err } + if err = writeCookies(w, req.Cookie); err != nil { + return err + } + io.WriteString(w, "\r\n") // Write body and trailer @@ -485,6 +492,8 @@ func ReadRequest(b *bufio.Reader) (req *Request, err os.Error) { return nil, err } + req.Cookie = readCookies(req.Header) + return req, nil } |
