summaryrefslogtreecommitdiff
path: root/src/pkg/http/response.go
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2010-02-24 15:13:39 -0800
committerRuss Cox <rsc@golang.org>2010-02-24 15:13:39 -0800
commitc2e31d7301dc965ff6ebba7993eee62b8ab08113 (patch)
tree05b9e42c868c0140586e9f481853e9f09f96a12c /src/pkg/http/response.go
parent25df35f2c7eda611664834fa15d158482d800de4 (diff)
downloadgolang-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.go10
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)+" ")