Repository navigation
Using zig build on macOS fails to fetch remote repositories through a proxy. #25996
Description
Activity
- addedbugObserved behavior contradicts documented or intended behaviorObserved behavior contradicts documented or intended behavior
on Nov 21, 2025 I can't reproduce that locally, but I'm not using a proxy -- how is yours configured?
I can't reproduce that locally, but I'm not using a proxy -- how is yours configured?
Just normally opening the VPN and setting up the proxy on the terminal. look like:
export https_proxy=http://127.0.0.1:7890 http_proxy=http://127.0.0.1:7890 all_proxy=socks5://127.0.0.1:7890In the current environment, only zig shows similar symptoms; other programs all obediently go through the proxy.
🤔To be precise, the HTTP request seems to be working; I tested it and there were no errors.
From zig cookbook
const std = @import("std"); const print = std.debug.print; const http = std.http; pub fn main() !void { var gpa = std.heap.GeneralPurposeAllocator(.{}){}; defer _ = gpa.deinit(); const allocator = gpa.allocator(); var client = http.Client{ .allocator = allocator }; defer client.deinit(); const uri = try std.Uri.parse("http://httpbin.org/get"); var req = try client.request(.GET, uri, .{ .extra_headers = &.{.{ .name = "Custom-header", .value = "Custom Value" }}, }); defer req.deinit(); try req.sendBodiless(); var redirect_buffer: [1024]u8 = undefined; var response = try req.receiveHead(&redirect_buffer); var iter = response.head.iterateHeaders(); while (iter.next()) |header| { std.debug.print("Name:{s}, Value:{s}\n", .{ header.name, header.value }); } try std.testing.expectEqual(response.head.status, .ok); const body = try response.reader(&.{}).allocRemaining(allocator, .unlimited); defer allocator.free(body); print("Body:\n{s}\n", .{body}); }
Request:
Name:Date, Value:Sat, 22 Nov 2025 09:30:48 GMT Name:Content-Type, Value:application/json Name:Content-Length, Value:322 Name:Connection, Value:keep-alive Name:Server, Value:gunicorn/19.9.0 Name:Access-Control-Allow-Origin, Value:* Name:Access-Control-Allow-Credentials, Value:true Body: { "args": {}, "headers": { "Accept-Encoding": "gzip, deflate", "Custom-Header": "Custom Value", "Host": "httpbin.org", "User-Agent": "zig/0.15.2 (std.http)", "X-Amzn-Trace-Id": "Root=1-692182c6-57f76ceb27623ce05bb2be96" }, "origin": "222.187.201.70", "url": "http://httpbin.org/get" }Actually, for a while, dvui could be successfully compiled after I opened the VPN, even though it needed to access the remote repository, but now it doesn't work anymore. This is indeed strange.🤔
I tried compiling pixi again, but it seems that a miracle didn't happen...
( ˘•ω•˘ )
zig build pixi/build.zig.zon:30:20: error: unable to discover remote git server capabilities: HttpConnectionClosing .url = "git+https://github.com/foxnne/dvui-dev#77bded1a0b46fc44879c694bbbfc3f379b55ed68", ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Zig Version
0.15.2 brew, the latest
Steps to Reproduce and Observed Behavior
Just use
zig buildin any Zig project that requires remote packages.Expected Behavior
Just use
zig buildfor anybuild.zig.zon:8:20: error: unable to discover remote git server capabilities: HttpConnectionClosing .url = "git+https://github.com/Hejsil/zig-clap.git#5289e0753cd274d65344bef1c114284c633536ea",I tried to remove https and use http
build.zig.zon:8:20: error: unable to discover remote git server capabilities: HttpConnectionClosing .url = "git+http://github.com/Hejsil/zig-clap.git#5289e0753cd274d65344bef1c114284c633536ea", ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Still not working. This problem has actually existed for a long time, present since the early versions of the package manager. This is also one of the reasons blocking me from learning Zig. I've been trying to solve it, but haven't found a solution. It seems Zig will never use a proxy channel...