(cs *clientStream, f *MetaHeadersFrame)
| 2624 | } |
| 2625 | |
| 2626 | func (rl *clientConnReadLoop) processTrailers(cs *clientStream, f *MetaHeadersFrame) error { |
| 2627 | if cs.pastTrailers { |
| 2628 | // Too many HEADERS frames for this stream. |
| 2629 | return ConnectionError(ErrCodeProtocol) |
| 2630 | } |
| 2631 | cs.pastTrailers = true |
| 2632 | if !f.StreamEnded() { |
| 2633 | // We expect that any headers for trailers also |
| 2634 | // has END_STREAM. |
| 2635 | return ConnectionError(ErrCodeProtocol) |
| 2636 | } |
| 2637 | if len(f.PseudoFields()) > 0 { |
| 2638 | // No pseudo header fields are defined for trailers. |
| 2639 | // TODO: ConnectionError might be overly harsh? Check. |
| 2640 | return ConnectionError(ErrCodeProtocol) |
| 2641 | } |
| 2642 | |
| 2643 | trailer := make(http.Header) |
| 2644 | for _, hf := range f.RegularFields() { |
| 2645 | key := canonicalHeader(hf.Name) |
| 2646 | trailer[key] = append(trailer[key], hf.Value) |
| 2647 | } |
| 2648 | cs.trailer = trailer |
| 2649 | |
| 2650 | rl.endStream(cs) |
| 2651 | return nil |
| 2652 | } |
| 2653 | |
| 2654 | // transportResponseBody is the concrete type of Transport.RoundTrip's |
| 2655 | // Response.Body. It is an io.ReadCloser. |
no test coverage detected