diff options
author | Russ Cox <rsc@golang.org> | 2010-02-24 15:13:39 -0800 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2010-02-24 15:13:39 -0800 |
commit | c2e31d7301dc965ff6ebba7993eee62b8ab08113 (patch) | |
tree | 05b9e42c868c0140586e9f481853e9f09f96a12c /src/pkg/http/response.go | |
parent | 25df35f2c7eda611664834fa15d158482d800de4 (diff) | |
download | golang-c2e31d7301dc965ff6ebba7993eee62b8ab08113.tar.gz |
http: fix handling of Close, use Close in http.Post
default to HTTP/1.1
R=petar-m
CC=golang-dev
http://codereview.appspot.com/224041
Diffstat (limited to 'src/pkg/http/response.go')
-rw-r--r-- | src/pkg/http/response.go | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/pkg/http/response.go b/src/pkg/http/response.go index 87ca7f1cd..28f002d9b 100644 --- a/src/pkg/http/response.go +++ b/src/pkg/http/response.go @@ -188,9 +188,13 @@ func (resp *Response) Write(w io.Writer) os.Error { resp.RequestMethod = strings.ToUpper(resp.RequestMethod) // Status line - text, ok := statusText[resp.StatusCode] - if !ok { - text = "status code " + strconv.Itoa(resp.StatusCode) + text := resp.Status + if text == "" { + var ok bool + text, ok = statusText[resp.StatusCode] + if !ok { + text = "status code " + strconv.Itoa(resp.StatusCode) + } } io.WriteString(w, "HTTP/"+strconv.Itoa(resp.ProtoMajor)+".") io.WriteString(w, strconv.Itoa(resp.ProtoMinor)+" ") |