mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 05:44:20 +00:00
lib/std/http/Client.zig: Ignore empty proxy environment variables (#23223)
This fixes #21032 by ignoring proxy environment variables that are empty.
This commit is contained in:
parent
d590b87b6f
commit
1f92b394e9
1 changed files with 5 additions and 1 deletions
|
|
@ -1241,10 +1241,14 @@ pub fn initDefaultProxies(client: *Client, arena: Allocator) !void {
|
|||
|
||||
fn createProxyFromEnvVar(arena: Allocator, env_var_names: []const []const u8) !?*Proxy {
|
||||
const content = for (env_var_names) |name| {
|
||||
break std.process.getEnvVarOwned(arena, name) catch |err| switch (err) {
|
||||
const content = std.process.getEnvVarOwned(arena, name) catch |err| switch (err) {
|
||||
error.EnvironmentVariableNotFound => continue,
|
||||
else => |e| return e,
|
||||
};
|
||||
|
||||
if (content.len == 0) continue;
|
||||
|
||||
break content;
|
||||
} else return null;
|
||||
|
||||
const uri = Uri.parse(content) catch try Uri.parseAfterScheme("http", content);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue