Skip to content

Commit 1f92b39

Browse files
authored
lib/std/http/Client.zig: Ignore empty proxy environment variables (#23223)
This fixes #21032 by ignoring proxy environment variables that are empty.
1 parent d590b87 commit 1f92b39

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/std/http/Client.zig

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1241,10 +1241,14 @@ pub fn initDefaultProxies(client: *Client, arena: Allocator) !void {
12411241

12421242
fn createProxyFromEnvVar(arena: Allocator, env_var_names: []const []const u8) !?*Proxy {
12431243
const content = for (env_var_names) |name| {
1244-
break std.process.getEnvVarOwned(arena, name) catch |err| switch (err) {
1244+
const content = std.process.getEnvVarOwned(arena, name) catch |err| switch (err) {
12451245
error.EnvironmentVariableNotFound => continue,
12461246
else => |e| return e,
12471247
};
1248+
1249+
if (content.len == 0) continue;
1250+
1251+
break content;
12481252
} else return null;
12491253

12501254
const uri = Uri.parse(content) catch try Uri.parseAfterScheme("http", content);

0 commit comments

Comments
 (0)