http: support Trailers in ReadRequest

Available after closing Request.Body.

R=adg, rsc
CC=golang-dev
https://golang.org/cl/5348041
This commit is contained in:
Brad Fitzpatrick 2011-11-04 09:17:46 -07:00
parent aac144b120
commit b14ee23f9b
3 changed files with 119 additions and 23 deletions

View file

@ -142,6 +142,8 @@ type Request struct {
// Trailer maps trailer keys to values. Like for Header, if the
// response has multiple trailer lines with the same key, they will be
// concatenated, delimited by commas.
// For server requests, Trailer is only populated after Body has been
// closed or fully consumed.
// Trailer support is only partially complete.
Trailer Header
@ -464,16 +466,6 @@ func (cr *chunkedReader) beginChunk() {
return
}
if cr.n == 0 {
// trailer CRLF
for {
line, cr.err = readLine(cr.r)
if cr.err != nil {
return
}
if line == "" {
break
}
}
cr.err = io.EOF
}
}