From 8d6a12f57012abec3db7bd7a124ac7551faeef04 Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Thu, 21 Apr 2011 19:57:19 -0700 Subject: [PATCH] http: clarify docs on Request HTTP version Fixes #910 R=adg, rsc1 CC=golang-dev https://golang.org/cl/4439062 --- src/pkg/http/dump.go | 2 ++ src/pkg/http/request.go | 9 ++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/pkg/http/dump.go b/src/pkg/http/dump.go index 306c45bc2c9..358980f7cae 100644 --- a/src/pkg/http/dump.go +++ b/src/pkg/http/dump.go @@ -31,6 +31,8 @@ func drainBody(b io.ReadCloser) (r1, r2 io.ReadCloser, err os.Error) { // DumpRequest is semantically a no-op, but in order to // dump the body, it reads the body data into memory and // changes req.Body to refer to the in-memory copy. +// The documentation for Request.Write details which fields +// of req are used. func DumpRequest(req *Request, body bool) (dump []byte, err os.Error) { var b bytes.Buffer save := req.Body diff --git a/src/pkg/http/request.go b/src/pkg/http/request.go index 633c91e8d20..26039cb623e 100644 --- a/src/pkg/http/request.go +++ b/src/pkg/http/request.go @@ -64,9 +64,12 @@ var reqExcludeHeader = map[string]bool{ // A Request represents a parsed HTTP request header. type Request struct { - Method string // GET, POST, PUT, etc. - RawURL string // The raw URL given in the request. - URL *URL // Parsed URL. + Method string // GET, POST, PUT, etc. + RawURL string // The raw URL given in the request. + URL *URL // Parsed URL. + + // The protocol version for incoming requests. + // Outgoing requests always use HTTP/1.1. Proto string // "HTTP/1.0" ProtoMajor int // 1 ProtoMinor int // 0