@@ -181,7 +181,6 @@ type writeResHeaders struct {
181
181
httpResCode int // 0 means no ":status" line
182
182
h http.Header // may be nil
183
183
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
185
184
endStream bool
186
185
187
186
date string
@@ -215,12 +214,7 @@ func (w *writeResHeaders) writeFrame(ctx writeContext) error {
215
214
encKV (enc , ":status" , httpCodeString (w .httpResCode ))
216
215
}
217
216
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 )
224
218
225
219
if w .contentType != "" {
226
220
encKV (enc , "content-type" , w .contentType )
@@ -279,7 +273,7 @@ func (w *writePushPromise) writeFrame(ctx writeContext) error {
279
273
encKV (enc , ":scheme" , w .url .Scheme )
280
274
encKV (enc , ":authority" , w .url .Host )
281
275
encKV (enc , ":path" , w .url .RequestURI ())
282
- encodeHeaders (enc , w .h , nil , nil )
276
+ encodeHeaders (enc , w .h , nil )
283
277
284
278
headerBlock := buf .Bytes ()
285
279
if len (headerBlock ) == 0 {
@@ -335,9 +329,8 @@ func (wu writeWindowUpdate) writeFrame(ctx writeContext) error {
335
329
}
336
330
337
331
// 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 ) {
341
334
if keys == nil {
342
335
sorter := sorterPool .Get ().(* sorter )
343
336
// Using defer here, since the returned keys from the
@@ -347,10 +340,6 @@ func encodeHeaders(enc *hpack.Encoder, h http.Header, keys []string, excludeKeys
347
340
keys = sorter .Keys (h )
348
341
}
349
342
for _ , k := range keys {
350
- if excludeKeys [k ] {
351
- continue
352
- }
353
-
354
343
vv := h [k ]
355
344
k , ascii := lowerHeader (k )
356
345
if ! ascii {
0 commit comments