mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
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:
parent
aac144b120
commit
b14ee23f9b
3 changed files with 119 additions and 23 deletions
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue