@@ -181,7 +181,6 @@ type writeResHeaders struct {
181181 httpResCode int // 0 means no ":status" line
182182 h http.Header // may be nil
183183 trailers []string // if non-nil, which keys of h to write. nil means all.
184- noBody bool // if true, Content-Length and Transfer-Encoding will not be set
185184 endStream bool
186185
187186 date string
@@ -215,12 +214,7 @@ func (w *writeResHeaders) writeFrame(ctx writeContext) error {
215214 encKV (enc , ":status" , httpCodeString (w .httpResCode ))
216215 }
217216
218- var excludedKeys map [string ]bool
219- if w .noBody {
220- excludedKeys = map [string ]bool {"Content-Length" : true , "Transfer-Encoding" : true }
221- }
222-
223- encodeHeaders (enc , w .h , w .trailers , excludedKeys )
217+ encodeHeaders (enc , w .h , w .trailers )
224218
225219 if w .contentType != "" {
226220 encKV (enc , "content-type" , w .contentType )
@@ -279,7 +273,7 @@ func (w *writePushPromise) writeFrame(ctx writeContext) error {
279273 encKV (enc , ":scheme" , w .url .Scheme )
280274 encKV (enc , ":authority" , w .url .Host )
281275 encKV (enc , ":path" , w .url .RequestURI ())
282- encodeHeaders (enc , w .h , nil , nil )
276+ encodeHeaders (enc , w .h , nil )
283277
284278 headerBlock := buf .Bytes ()
285279 if len (headerBlock ) == 0 {
@@ -335,9 +329,8 @@ func (wu writeWindowUpdate) writeFrame(ctx writeContext) error {
335329}
336330
337331// encodeHeaders encodes an http.Header. If keys is not nil, then (k, h[k])
338- // is encoded only if k is in keys. If excludeKeys is not nil, then
339- // (k, k[h]) is encoded only if k is not true in excludeKeys.
340- func encodeHeaders (enc * hpack.Encoder , h http.Header , keys []string , excludeKeys map [string ]bool ) {
332+ // is encoded only if k is in keys.
333+ func encodeHeaders (enc * hpack.Encoder , h http.Header , keys []string ) {
341334 if keys == nil {
342335 sorter := sorterPool .Get ().(* sorter )
343336 // Using defer here, since the returned keys from the
@@ -347,10 +340,6 @@ func encodeHeaders(enc *hpack.Encoder, h http.Header, keys []string, excludeKeys
347340 keys = sorter .Keys (h )
348341 }
349342 for _ , k := range keys {
350- if excludeKeys [k ] {
351- continue
352- }
353-
354343 vv := h [k ]
355344 k , ascii := lowerHeader (k )
356345 if ! ascii {
0 commit comments