From c2dff2b859bf43bcdc4d9404fdef265627d9538a Mon Sep 17 00:00:00 2001 From: Kabir Oberai Date: Wed, 9 Sep 2026 01:54:09 -0400 Subject: [PATCH] http: add some debugging knobs --- .../AsyncHTTPClient+HTTP.swift | 16 ++++++++++++++++ .../HTTPClientProtocol/URLSession+HTTP.swift | 12 ++++++++++++ 2 files changed, 28 insertions(+) diff --git a/Sources/XKit/HTTPClientProtocol/AsyncHTTPClient+HTTP.swift b/Sources/XKit/HTTPClientProtocol/AsyncHTTPClient+HTTP.swift index 0091980c..fd294e66 100644 --- a/Sources/XKit/HTTPClientProtocol/AsyncHTTPClient+HTTP.swift +++ b/Sources/XKit/HTTPClientProtocol/AsyncHTTPClient+HTTP.swift @@ -22,12 +22,27 @@ extension HTTPClientDependencyKey: DependencyKey { } private struct Client: HTTPClientProtocol { + private static var proxyConfiguration: HTTPClient.Configuration.Proxy? { + // e.g. `XTL_HTTP_PROXY=localhost:8080` + guard let value = ProcessInfo.processInfo.environment["XTL_HTTP_PROXY"], + let separator = value.lastIndex(of: ":"), + let port = Int(value[value.index(after: separator)...]) else { + return nil + } + + let host = String(value[.. (URLSession.AuthChallengeDisposition, URLCredential?) { + if ProcessInfo.processInfo.environment["XTL_DISABLE_TLS_VALIDATION"] == "1", + let trust = challenge.protectionSpace.serverTrust { + return (.useCredential, URLCredential(trust: trust)) + } else { + return (.performDefaultHandling, nil) + } + } } private let clientDelegate = ClientDelegate()