1
0
mirror of https://github.com/apple/swift-nio-extras.git synced 2025-05-20 12:22:24 +08:00

Use oldHeaders.count when reserving capacity in HTTPFields ()

This commit is contained in:
Joannis Orlandos 2024-05-20 14:05:55 +02:00 committed by GitHub
parent efd416ee15
commit ef36e67dbb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -136,7 +136,7 @@ extension HTTPHeaders {
extension HTTPFields {
public init(_ oldHeaders: HTTPHeaders, splitCookie: Bool) {
self.init()
self.reserveCapacity(count)
self.reserveCapacity(oldHeaders.count)
var firstHost = true
for field in oldHeaders {
if firstHost && field.name.lowercased() == "host" {