~john-koepi/ubuntu/trusty/golang/default

« back to all changes in this revision

Viewing changes to src/pkg/http/response.go

  • Committer: Bazaar Package Importer
  • Author(s): Ondřej Surý
  • Date: 2011-08-03 17:04:59 UTC
  • mfrom: (14.1.2 sid)
  • Revision ID: james.westby@ubuntu.com-20110803170459-wzd99m3567y80ila
Tags: 1:59-1
* Imported Upstream version 59
* Refresh patches to a new release
* Fix FTBFS on ARM (Closes: #634270)
* Update version.bash to work with Debian packaging and not hg
  repository

Show diffs side-by-side

added added

removed removed

Lines of Context:
40
40
        // Keys in the map are canonicalized (see CanonicalHeaderKey).
41
41
        Header Header
42
42
 
43
 
        // SetCookie records the Set-Cookie requests sent with the response.
44
 
        SetCookie []*Cookie
45
 
 
46
43
        // Body represents the response body.
47
44
        Body io.ReadCloser
48
45
 
71
68
        Request *Request
72
69
}
73
70
 
 
71
// Cookies parses and returns the cookies set in the Set-Cookie headers.
 
72
func (r *Response) Cookies() []*Cookie {
 
73
        return readSetCookies(r.Header)
 
74
}
 
75
 
74
76
// ReadResponse reads and returns an HTTP response from r.  The
75
77
// req parameter specifies the Request that corresponds to
76
78
// this Response.  Clients must call resp.Body.Close when finished
93
95
                }
94
96
                return nil, err
95
97
        }
96
 
        f := strings.Split(line, " ", 3)
 
98
        f := strings.SplitN(line, " ", 3)
97
99
        if len(f) < 2 {
98
100
                return nil, &badStringError{"malformed HTTP response", line}
99
101
        }
127
129
                return nil, err
128
130
        }
129
131
 
130
 
        resp.SetCookie = readSetCookies(resp.Header)
131
 
 
132
132
        return resp, nil
133
133
}
134
134
 
200
200
                return err
201
201
        }
202
202
 
203
 
        if err = writeSetCookies(w, resp.SetCookie); err != nil {
204
 
                return err
205
 
        }
206
 
 
207
203
        // End-of-header
208
204
        io.WriteString(w, "\r\n")
209
205