mirror of
https://github.com/apple/swift-nio-extras.git
synced 2025-05-16 18:16:04 +08:00
review comments
This commit is contained in:
parent
b34607e15a
commit
3b7bd3dcdd
@ -62,7 +62,7 @@ public final class NIOHTTP1ProxyConnectHandler: ChannelDuplexHandler, RemovableC
|
|||||||
targetPort: Int,
|
targetPort: Int,
|
||||||
headers: HTTPHeaders,
|
headers: HTTPHeaders,
|
||||||
deadline: NIODeadline,
|
deadline: NIODeadline,
|
||||||
promise: EventLoopPromise<Void>) {
|
promise: EventLoopPromise<Void>?) {
|
||||||
self.targetHost = targetHost
|
self.targetHost = targetHost
|
||||||
self.targetPort = targetPort
|
self.targetPort = targetPort
|
||||||
self.headers = headers
|
self.headers = headers
|
||||||
@ -349,22 +349,7 @@ public final class NIOHTTP1ProxyConnectHandler: ChannelDuplexHandler, RemovableC
|
|||||||
extension NIOHTTP1ProxyConnectHandler.Error: Hashable {
|
extension NIOHTTP1ProxyConnectHandler.Error: Hashable {
|
||||||
// compare only the kind of error, not the associated response head
|
// compare only the kind of error, not the associated response head
|
||||||
public static func == (lhs: Self, rhs: Self) -> Bool {
|
public static func == (lhs: Self, rhs: Self) -> Bool {
|
||||||
switch (lhs.store.details, rhs.store.details) {
|
return lhs.errorCode == rhs.errorCode
|
||||||
case (.proxyAuthenticationRequired, .proxyAuthenticationRequired):
|
|
||||||
return true
|
|
||||||
case (.invalidProxyResponseHead, .invalidProxyResponseHead):
|
|
||||||
return true
|
|
||||||
case (.invalidProxyResponse, .invalidProxyResponse):
|
|
||||||
return true
|
|
||||||
case (.remoteConnectionClosed, .remoteConnectionClosed):
|
|
||||||
return true
|
|
||||||
case (.httpProxyHandshakeTimeout, .httpProxyHandshakeTimeout):
|
|
||||||
return true
|
|
||||||
case (.noResult, .noResult):
|
|
||||||
return true
|
|
||||||
default:
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public func hash(into hasher: inout Hasher) {
|
public func hash(into hasher: inout Hasher) {
|
||||||
@ -375,7 +360,7 @@ extension NIOHTTP1ProxyConnectHandler.Error: Hashable {
|
|||||||
|
|
||||||
extension NIOHTTP1ProxyConnectHandler.Error: CustomStringConvertible {
|
extension NIOHTTP1ProxyConnectHandler.Error: CustomStringConvertible {
|
||||||
public var description: String {
|
public var description: String {
|
||||||
self.store.details.description
|
"\(self.store.details.description) (\(self.store.file): \(self.store.line))"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -384,8 +369,8 @@ extension NIOHTTP1ProxyConnectHandler.Error.Details: CustomStringConvertible {
|
|||||||
switch self {
|
switch self {
|
||||||
case .proxyAuthenticationRequired:
|
case .proxyAuthenticationRequired:
|
||||||
return "Proxy Authentication Required"
|
return "Proxy Authentication Required"
|
||||||
case .invalidProxyResponseHead:
|
case .invalidProxyResponseHead(let head):
|
||||||
return "Invalid Proxy Response Head"
|
return "Invalid Proxy Response Head: \(head)"
|
||||||
case .invalidProxyResponse:
|
case .invalidProxyResponse:
|
||||||
return "Invalid Proxy Response"
|
return "Invalid Proxy Response"
|
||||||
case .remoteConnectionClosed:
|
case .remoteConnectionClosed:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user