mirror of
https://github.com/swift-server/async-http-client.git
synced 2026-06-02 07:37:34 +00:00
Add an HTTP/1.1 connection pool (#105)
motivation: Better performance thanks to connection reuse changes: - Added a connection pool for HTTP/1.1 - All requests automatically use the connection pool - Up to 8 parallel connections per (scheme, host, port) - Multiple additional unit tests
This commit is contained in:
@@ -69,6 +69,7 @@ internal final class HTTPClientProxyHandler: ChannelDuplexHandler, RemovableChan
|
||||
case awaitingResponse
|
||||
case connecting
|
||||
case connected
|
||||
case failed
|
||||
}
|
||||
|
||||
private let host: String
|
||||
@@ -102,6 +103,7 @@ internal final class HTTPClientProxyHandler: ChannelDuplexHandler, RemovableChan
|
||||
// blank line that concludes the successful response's header section
|
||||
break
|
||||
case 407:
|
||||
self.readState = .failed
|
||||
context.fireErrorCaught(HTTPClientError.proxyAuthenticationRequired)
|
||||
default:
|
||||
// Any response other than a successful response
|
||||
@@ -119,6 +121,8 @@ internal final class HTTPClientProxyHandler: ChannelDuplexHandler, RemovableChan
|
||||
self.readBuffer.append(data)
|
||||
case .connected:
|
||||
context.fireChannelRead(data)
|
||||
case .failed:
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user