Skip to content

Commit 3b7bd3d

Browse files
committed
review comments
1 parent b34607e commit 3b7bd3d

File tree

1 file changed

+5
-20
lines changed

1 file changed

+5
-20
lines changed

Sources/NIOExtras/HTTP1ProxyConnectHandler.swift

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public final class NIOHTTP1ProxyConnectHandler: ChannelDuplexHandler, RemovableC
6262
targetPort: Int,
6363
headers: HTTPHeaders,
6464
deadline: NIODeadline,
65-
promise: EventLoopPromise<Void>) {
65+
promise: EventLoopPromise<Void>?) {
6666
self.targetHost = targetHost
6767
self.targetPort = targetPort
6868
self.headers = headers
@@ -349,22 +349,7 @@ public final class NIOHTTP1ProxyConnectHandler: ChannelDuplexHandler, RemovableC
349349
extension NIOHTTP1ProxyConnectHandler.Error: Hashable {
350350
// compare only the kind of error, not the associated response head
351351
public static func == (lhs: Self, rhs: Self) -> Bool {
352-
switch (lhs.store.details, rhs.store.details) {
353-
case (.proxyAuthenticationRequired, .proxyAuthenticationRequired):
354-
return true
355-
case (.invalidProxyResponseHead, .invalidProxyResponseHead):
356-
return true
357-
case (.invalidProxyResponse, .invalidProxyResponse):
358-
return true
359-
case (.remoteConnectionClosed, .remoteConnectionClosed):
360-
return true
361-
case (.httpProxyHandshakeTimeout, .httpProxyHandshakeTimeout):
362-
return true
363-
case (.noResult, .noResult):
364-
return true
365-
default:
366-
return false
367-
}
352+
return lhs.errorCode == rhs.errorCode
368353
}
369354

370355
public func hash(into hasher: inout Hasher) {
@@ -375,7 +360,7 @@ extension NIOHTTP1ProxyConnectHandler.Error: Hashable {
375360

376361
extension NIOHTTP1ProxyConnectHandler.Error: CustomStringConvertible {
377362
public var description: String {
378-
self.store.details.description
363+
"\(self.store.details.description) (\(self.store.file): \(self.store.line))"
379364
}
380365
}
381366

@@ -384,8 +369,8 @@ extension NIOHTTP1ProxyConnectHandler.Error.Details: CustomStringConvertible {
384369
switch self {
385370
case .proxyAuthenticationRequired:
386371
return "Proxy Authentication Required"
387-
case .invalidProxyResponseHead:
388-
return "Invalid Proxy Response Head"
372+
case .invalidProxyResponseHead(let head):
373+
return "Invalid Proxy Response Head: \(head)"
389374
case .invalidProxyResponse:
390375
return "Invalid Proxy Response"
391376
case .remoteConnectionClosed:

0 commit comments

Comments
 (0)