Function initDefaultProxies [src]
Populates http_proxy and https_proxy via standard proxy environment variables.
Asserts the client has no active connections.
Uses arena for a few small allocations that must outlive the client, or
at least until those fields are set to different values.
Prototype
pub fn initDefaultProxies(client: *Client, arena: Allocator) !void
Parameters
client: *Client
arena: Allocator
Source
pub fn initDefaultProxies(client: *Client, arena: Allocator) !void {
// Prevent any new connections from being created.
client.connection_pool.mutex.lock();
defer client.connection_pool.mutex.unlock();
assert(client.connection_pool.used.first == null); // There are active requests.
if (client.http_proxy == null) {
client.http_proxy = try createProxyFromEnvVar(arena, &.{
"http_proxy", "HTTP_PROXY", "all_proxy", "ALL_PROXY",
});
}
if (client.https_proxy == null) {
client.https_proxy = try createProxyFromEnvVar(arena, &.{
"https_proxy", "HTTPS_PROXY", "all_proxy", "ALL_PROXY",
});
}
}