Skip to content

Commit 3049bb0

Browse files
committed
Fix async https requests over a http forward proxy
XHR requests to https (which is most XHR requests) currently don't work with the implementation proxy because of this.
1 parent fb58c50 commit 3049bb0

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/http/client.zig

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,10 @@ pub const Client = struct {
240240
const proxy_type = self.proxy_type orelse return false;
241241
return proxy_type == .forward;
242242
}
243+
244+
fn isProxy(self: *const Client) bool {
245+
return self.proxy_type != null;
246+
}
243247
};
244248

245249
const RequestOpts = struct {
@@ -792,8 +796,12 @@ pub const Request = struct {
792796
.conn = .{ .handler = async_handler, .protocol = .{ .plain = {} } },
793797
};
794798

795-
if (self._client.isConnectProxy() and self._proxy_secure) log.warn(.http, "ASYNC TLS CONNECT no impl.", .{});
796-
if (self._request_secure) {
799+
if (self._client.isConnectProxy() and self._proxy_secure) {
800+
log.warn(.http, "not implemented", .{ .feature = "async tls connect" });
801+
}
802+
803+
const is_proxy = self._client.isProxy();
804+
if ((is_proxy and self._proxy_secure) or (!is_proxy and self._request_secure)) {
797805
if (self._connection_from_keepalive) {
798806
// If the connection came from the keepalive pool, than we already
799807
// have a TLS Connection.

0 commit comments

Comments
 (0)