File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -510,22 +510,25 @@ package struct StaticQPACKEncoder {
510510 package init ( ) { }
511511 package func encode( headers: [ HTTPField ] ) -> FieldSection {
512512 let base = 0 // base 0 is the cheapest way when no dynamic entries
513- let encodeResults = headers. map { header in
513+ var lines = [ FieldLine] ( )
514+ lines. reserveCapacity ( headers. count)
515+ for header in headers {
514516 let requireLiteralRepresentation =
515517 switch header. indexingStrategy {
516518 case . prefer, . automatic, . avoid: false
517519 case . disallow: true
518520 default : false
519521 }
520- return self . encodeSingleHeader (
521- header,
522- requireLiteralRepresentation: requireLiteralRepresentation
522+ lines. append (
523+ self . encodeSingleHeader (
524+ header,
525+ requireLiteralRepresentation: requireLiteralRepresentation
526+ ) . asFieldLine ( base: base)
523527 )
524528 }
525529 let prefix = FieldSectionPrefix ( requiredInsertCount: 0 , base: base)
526530 let encodedPrefix = prefix. encode ( maxCapacity: 0 )
527531
528- let lines = encodeResults. map { $0. asFieldLine ( base: base) }
529532 return . init( prefix: encodedPrefix, lines: lines)
530533 }
531534
You can’t perform that action at this time.
0 commit comments