summaryrefslogtreecommitdiff
path: root/src/pkg/http/request.go
diff options
context:
space:
mode:
authorBrad Fitzpatrick <brad@danga.com>2010-06-16 10:15:39 -0700
committerBrad Fitzpatrick <brad@danga.com>2010-06-16 10:15:39 -0700
commit7b235fb5e7b01c8ff901dfe4547f50c0cd25feda (patch)
treed45543c42b239a6d1d32f2c4641d3269fcff3c75 /src/pkg/http/request.go
parent25736a613c7bb0c4e74d40261193329f8ddbb7a3 (diff)
downloadgolang-7b235fb5e7b01c8ff901dfe4547f50c0cd25feda.tar.gz
http: reply to Expect 100-continue requests automatically
This CL replaces my earlier http://codereview.appspot.com/1640044/show in which Continue handling was explicit. Instead, this CL makes it automatic. Reading from Body() is an implicit acknowledgement that the request headers were fine and the body is wanted. In that case, the 100 Continue response is written automatically when the request continues the "Expect: 100-continue" header. R=rsc, adg CC=golang-dev http://codereview.appspot.com/1610042 Committer: Russ Cox <rsc@golang.org>
Diffstat (limited to 'src/pkg/http/request.go')
-rw-r--r--src/pkg/http/request.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/pkg/http/request.go b/src/pkg/http/request.go
index c01b2dd26..b1aface46 100644
--- a/src/pkg/http/request.go
+++ b/src/pkg/http/request.go
@@ -635,3 +635,8 @@ func (r *Request) FormValue(key string) string {
}
return ""
}
+
+func (r *Request) expectsContinue() bool {
+ expectation, ok := r.Header["Expect"]
+ return ok && strings.ToLower(expectation) == "100-continue"
+}