@@ -210,20 +210,21 @@ public final class NIOHTTP1ProxyConnectHandler: ChannelDuplexHandler, RemovableC
210
210
public struct Error : Swift . Error , Equatable {
211
211
fileprivate enum Storage : Equatable , Hashable {
212
212
case proxyAuthenticationRequired
213
- case invalidProxyResponseHead( head: HTTPResponseHead )
213
+ indirect case invalidProxyResponseHead( head: HTTPResponseHead )
214
214
case invalidProxyResponse
215
215
case remoteConnectionClosed
216
216
case httpProxyHandshakeTimeout
217
217
case noResult
218
218
219
+ // compare only the kind of error, not the associated response head
219
220
@inlinable
220
221
static func == ( lhs: Self , rhs: Self ) -> Bool {
221
- return Kind ( from : lhs) == Kind ( from : rhs)
222
+ Kind ( lhs) == Kind ( rhs)
222
223
}
223
224
224
225
@inlinable
225
226
public func hash( into hasher: inout Hasher ) {
226
- hasher. combine ( Kind ( from : self ) )
227
+ hasher. combine ( Kind ( self ) )
227
228
}
228
229
}
229
230
@@ -235,7 +236,7 @@ public final class NIOHTTP1ProxyConnectHandler: ChannelDuplexHandler, RemovableC
235
236
case httpProxyHandshakeTimeout
236
237
case noResult
237
238
238
- init ( from storage: Storage ) {
239
+ init ( _ storage: Storage ) {
239
240
switch storage {
240
241
case . proxyAuthenticationRequired:
241
242
self = . proxyAuthenticationRequired
@@ -253,15 +254,26 @@ public final class NIOHTTP1ProxyConnectHandler: ChannelDuplexHandler, RemovableC
253
254
}
254
255
}
255
256
256
- fileprivate let error : Storage
257
+ final class Location : Sendable {
258
+ public let file : String
259
+ public let line : UInt
260
+ init ( file: String , line: UInt ) {
261
+ self . file = file
262
+ self . line = line
263
+ }
264
+ }
257
265
258
- public var file : String
259
- public var line : Int
266
+ fileprivate let error : Storage
267
+ let location : Location
260
268
261
- fileprivate init ( error: Storage , file: String = #file, line: Int = #line) {
269
+ fileprivate init ( error: Storage , file: String = #file, line: UInt = #line) {
262
270
self . error = error
263
- self . file = file
264
- self . line = line
271
+ self . location = Location ( file: file, line: line)
272
+ }
273
+
274
+ public static func == ( lhs: NIOHTTP1ProxyConnectHandler . Error , rhs: NIOHTTP1ProxyConnectHandler . Error ) -> Bool {
275
+ // ignore *where* the error was thrown
276
+ lhs. error == rhs. error
265
277
}
266
278
267
279
/// Proxy response status `407` indicates that authentication is required
0 commit comments