From 7b235fb5e7b01c8ff901dfe4547f50c0cd25feda Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Wed, 16 Jun 2010 10:15:39 -0700 Subject: 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 --- src/pkg/http/request.go | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/pkg/http/request.go') 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" +} -- cgit v1.2.3