authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2026-05-30 02:32:29 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2026-05-30 02:32:29 -07:00
log58a16988c07c79a81598ace7b11975a6b4243a30
tree9480db8175ef29f6ee123a466a2bd55860806c50
parent773b09ff745c30c0e02b6d4717e0da9cb10b2978
signaturebadge-check Signed by SSH key SHA256:4hHJbtBRU58AYXwjL7fkz2fnQHdiye8x1QpTCQ0sHNw

replace zfetch with std.http client


7 files changed, 35 insertions(+), 40 deletions(-)

deps.zig+1-20
...@@ -56,8 +56,6 @@ pub fn fetch(exe: *std.Build.Step.Compile) *std.Build.Step {...@@ -56,8 +56,6 @@ pub fn fetch(exe: *std.Build.Step.Compile) *std.Build.Step {
56 }56 }
57 step.dependOn(&GitExactStep.create(b, "https://github.com/marlersoft/zigwin32", "ec98bb4d9eea532320a8551720a9e3ec6de64994").step);57 step.dependOn(&GitExactStep.create(b, "https://github.com/marlersoft/zigwin32", "ec98bb4d9eea532320a8551720a9e3ec6de64994").step);
58 step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/arqv-ini", "ab427a4de4f875eaa39ee56a29114fc020431546").step);58 step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/arqv-ini", "ab427a4de4f875eaa39ee56a29114fc020431546").step);
59 step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/iguanaTLS", "3450aaf3ca47986540e2b0258c2affc45af64ea2").step);
60 step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zfetch", "40d141bf7db81f05a83cce5f2edc4b14e41a5c34").step);
61 step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-ansi", "5f89211a749aef6bf518889c0467ceb24825c055").step);59 step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-ansi", "5f89211a749aef6bf518889c0467ceb24825c055").step);
62 step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-detect-license", "a1a066da88dab50873a56f0349dc12dc76542077").step);60 step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-detect-license", "a1a066da88dab50873a56f0349dc12dc76542077").step);
63 step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-extras", "b3457b31a1d1ea2c19c5d0b007c903d3e80add40").step);61 step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-extras", "b3457b31a1d1ea2c19c5d0b007c903d3e80add40").step);
...@@ -75,7 +73,6 @@ pub fn fetch(exe: *std.Build.Step.Compile) *std.Build.Step {...@@ -75,7 +73,6 @@ pub fn fetch(exe: *std.Build.Step.Compile) *std.Build.Step {
75 step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-time", "0f4db4c980146e4a3fc86a9a9070452a25ff9317").step);73 step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-time", "0f4db4c980146e4a3fc86a9a9070452a25ff9317").step);
76 step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-tracer", "3a5fdea4ffd387a53ac2a42fb503557cdbe20696").step);74 step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-tracer", "3a5fdea4ffd387a53ac2a42fb503557cdbe20696").step);
77 step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-yaml", "00e899bec815bc2b49c6e5a72a7cfeeda673e133").step);75 step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-yaml", "00e899bec815bc2b49c6e5a72a7cfeeda673e133").step);
78 step.dependOn(&GitExactStep.create(b, "https://github.com/truemedian/hzzp", "ab212bd208f0eb54d85861679677c5e3dc9bb543").step);
79 step.dependOn(&GitExactStep.create(b, "https://github.com/madler/zlib", "da607da739fa6047df13e66a2af6b8bec7c2a498").step);76 step.dependOn(&GitExactStep.create(b, "https://github.com/madler/zlib", "da607da739fa6047df13e66a2af6b8bec7c2a498").step);
80 step.dependOn(&GitExactStep.create(b, "https://github.com/yaml/libyaml", "2c891fc7a770e8ba2fec34fc6b545c672beb37e6").step);77 step.dependOn(&GitExactStep.create(b, "https://github.com/yaml/libyaml", "2c891fc7a770e8ba2fec34fc6b545c672beb37e6").step);
81 step.dependOn(&GitExactStep.create(b, "https://github.com/ziglibs/known-folders", "aa24df42183ad415d10bc0a33e6238c437fc0f59").step);78 step.dependOn(&GitExactStep.create(b, "https://github.com/ziglibs/known-folders", "aa24df42183ad415d10bc0a33e6238c437fc0f59").step);
...@@ -199,11 +196,6 @@ pub const package_data = struct {...@@ -199,11 +196,6 @@ pub const package_data = struct {
199 .name = "ini",196 .name = "ini",
200 .entry = "/git/github.com/nektro/arqv-ini/ab427a4de4f875eaa39ee56a29114fc020431546/src/ini.zig",197 .entry = "/git/github.com/nektro/arqv-ini/ab427a4de4f875eaa39ee56a29114fc020431546/src/ini.zig",
201 };198 };
202 pub var _csbnipaad8n7 = Package{
203 .store = "/git/github.com/nektro/iguanaTLS/3450aaf3ca47986540e2b0258c2affc45af64ea2",
204 .name = "iguanaTLS",
205 .entry = "/git/github.com/nektro/iguanaTLS/3450aaf3ca47986540e2b0258c2affc45af64ea2/src/main.zig",
206 };
207 pub var _s84v9o48ucb0 = Package{199 pub var _s84v9o48ucb0 = Package{
208 .store = "/git/github.com/nektro/zig-ansi/5f89211a749aef6bf518889c0467ceb24825c055",200 .store = "/git/github.com/nektro/zig-ansi/5f89211a749aef6bf518889c0467ceb24825c055",
209 .name = "ansi",201 .name = "ansi",
...@@ -302,17 +294,6 @@ pub const package_data = struct {...@@ -302,17 +294,6 @@ pub const package_data = struct {
302 .entry = "/git/github.com/nektro/zig-yaml/00e899bec815bc2b49c6e5a72a7cfeeda673e133/yaml.zig",294 .entry = "/git/github.com/nektro/zig-yaml/00e899bec815bc2b49c6e5a72a7cfeeda673e133/yaml.zig",
303 .deps = &[_]*Package{ &_8mdbh0zuneb0 },295 .deps = &[_]*Package{ &_8mdbh0zuneb0 },
304 };296 };
305 pub var _9k24gimke1an = Package{
306 .store = "/git/github.com/truemedian/hzzp/ab212bd208f0eb54d85861679677c5e3dc9bb543",
307 .name = "hzzp",
308 .entry = "/git/github.com/truemedian/hzzp/ab212bd208f0eb54d85861679677c5e3dc9bb543/src/main.zig",
309 };
310 pub var _ejw82j2ipa0e = Package{
311 .store = "/git/github.com/nektro/zfetch/40d141bf7db81f05a83cce5f2edc4b14e41a5c34",
312 .name = "zfetch",
313 .entry = "/git/github.com/nektro/zfetch/40d141bf7db81f05a83cce5f2edc4b14e41a5c34/src/main.zig",
314 .deps = &[_]*Package{ &_9k24gimke1an, &_csbnipaad8n7 },
315 };
316 pub var _0e2d06bb494b = Package{297 pub var _0e2d06bb494b = Package{
317 .store = "/git/github.com/madler/zlib/da607da739fa6047df13e66a2af6b8bec7c2a498",298 .store = "/git/github.com/madler/zlib/da607da739fa6047df13e66a2af6b8bec7c2a498",
318 .c_include_dirs = &.{ "" },299 .c_include_dirs = &.{ "" },
...@@ -333,7 +314,7 @@ pub const package_data = struct {...@@ -333,7 +314,7 @@ pub const package_data = struct {
333 pub var _89ujp8gq842x = Package{314 pub var _89ujp8gq842x = Package{
334 .name = "zigmod",315 .name = "zigmod",
335 .entry = "/../..//src/lib.zig",316 .entry = "/../..//src/lib.zig",
336 .deps = &[_]*Package{ &_g982zq6e8wsv, &_s84v9o48ucb0, &_2ta738wrqbaq, &_0npcrzfdlrvk, &_ejw82j2ipa0e, &_2ovav391ivak, &_c1xirp1ota5p, &_u7sysdckdymi, &_iecwp4b3bsfm, &_f7dubzb7cyqe, &_0k64oe2nuzvj, &_ocmr9rtohgcc, &_kscsl0145t7x, &_vph9l0hxpeze },317 .deps = &[_]*Package{ &_g982zq6e8wsv, &_s84v9o48ucb0, &_2ta738wrqbaq, &_0npcrzfdlrvk, &_2ovav391ivak, &_c1xirp1ota5p, &_u7sysdckdymi, &_iecwp4b3bsfm, &_f7dubzb7cyqe, &_0k64oe2nuzvj, &_ocmr9rtohgcc, &_kscsl0145t7x, &_vph9l0hxpeze },
337 };318 };
338 pub var _root = Package{319 pub var _root = Package{
339 };320 };
licenses.txt-3
...@@ -3,8 +3,6 @@ MIT:...@@ -3,8 +3,6 @@ MIT:
3- This3- This
4- git https://github.com/marlersoft/zigwin324- git https://github.com/marlersoft/zigwin32
5- git https://github.com/nektro/arqv-ini5- git https://github.com/nektro/arqv-ini
6- git https://github.com/nektro/iguanaTLS
7- git https://github.com/nektro/zfetch
8- git https://github.com/nektro/zig-ansi6- git https://github.com/nektro/zig-ansi
9- git https://github.com/nektro/zig-detect-license7- git https://github.com/nektro/zig-detect-license
10- git https://github.com/nektro/zig-extras8- git https://github.com/nektro/zig-extras
...@@ -18,7 +16,6 @@ MIT:...@@ -18,7 +16,6 @@ MIT:
18- git https://github.com/nektro/zig-time16- git https://github.com/nektro/zig-time
19- git https://github.com/nektro/zig-tracer17- git https://github.com/nektro/zig-tracer
20- git https://github.com/nektro/zig-yaml18- git https://github.com/nektro/zig-yaml
21- git https://github.com/truemedian/hzzp
22- git https://github.com/yaml/libyaml19- git https://github.com/yaml/libyaml
23- git https://github.com/ziglibs/known-folders20- git https://github.com/ziglibs/known-folders
2421
src/cmd/zpm.zig+12-3
...@@ -1,7 +1,6 @@...@@ -1,7 +1,6 @@
1const std = @import("std");1const std = @import("std");
2const string = []const u8;2const string = []const u8;
3const gpa = std.heap.c_allocator;3const gpa = std.heap.c_allocator;
4const zfetch = @import("zfetch");
5const extras = @import("extras");4const extras = @import("extras");
6const json = @import("json");5const json = @import("json");
7const nio = @import("nio");6const nio = @import("nio");
...@@ -58,9 +57,19 @@ pub fn execute(self_name: []const u8, args: [][:0]u8) !void {...@@ -58,9 +57,19 @@ pub fn execute(self_name: []const u8, args: [][:0]u8) !void {
58}57}
5958
60pub fn server_fetch(url: string) !json.Document {59pub fn server_fetch(url: string) !json.Document {
61 const req = try zfetch.Request.init(gpa, url, null);60 var buf: [4096]u8 = @splat(0);
61 var client: std.http.Client = .{ .allocator = gpa };
62 defer client.deinit();
63
64 var req = try client.open(.GET, try std.Uri.parse(url), .{
65 .server_header_buffer = &buf,
66 .redirect_behavior = .not_allowed,
67 });
62 defer req.deinit();68 defer req.deinit();
63 try req.do(.GET, null, null);69 try req.send();
70 try req.finish();
71 try req.wait();
72 if (req.response.status == .ok) return error.HttpExpected200;
64 return json.parse(gpa, "", nio.AnyReadable.fromStd(&req.reader()), .{ .support_trailing_commas = true, .maximum_depth = 100 });73 return json.parse(gpa, "", nio.AnyReadable.fromStd(&req.reader()), .{ .support_trailing_commas = true, .maximum_depth = 100 });
65}74}
6675
src/cmd/zpm/add.zig+20-7
...@@ -1,6 +1,5 @@...@@ -1,6 +1,5 @@
1const std = @import("std");1const std = @import("std");
2const gpa = std.heap.c_allocator;2const gpa = std.heap.c_allocator;
3const zfetch = @import("zfetch");
4const extras = @import("extras");3const extras = @import("extras");
5const nfs = @import("nfs");4const nfs = @import("nfs");
65
...@@ -43,19 +42,33 @@ pub fn execute(self_name: []const u8, args: [][:0]u8) !void {...@@ -43,19 +42,33 @@ pub fn execute(self_name: []const u8, args: [][:0]u8) !void {
43 }42 }
44 }43 }
4544
45 var buf: [4096]u8 = @splat(0);
46 var client: std.http.Client = .{ .allocator = gpa };
47 defer client.deinit();
48
46 const has_zigdotmod = blk: {49 const has_zigdotmod = blk: {
47 const _url = try std.mem.join(gpa, "/", &.{ found.git, "blob", "HEAD", "zig.mod" });50 const _url = try std.mem.join(gpa, "/", &.{ found.git, "blob", "HEAD", "zig.mod" });
48 const _req = try zfetch.Request.init(gpa, _url, null);51 var _req = try client.open(.GET, try std.Uri.parse(_url), .{
52 .server_header_buffer = &buf,
53 .redirect_behavior = .not_allowed,
54 });
49 defer _req.deinit();55 defer _req.deinit();
50 try _req.do(.GET, null, null);56 try _req.send();
51 break :blk @intFromEnum(_req.status) == 200;57 try _req.finish();
58 try _req.wait();
59 break :blk _req.response.status == .ok;
52 };60 };
53 const has_zigmodyml = blk: {61 const has_zigmodyml = blk: {
54 const _url = try std.mem.join(gpa, "/", &.{ found.git, "blob", "HEAD", "zigmod.yml" });62 const _url = try std.mem.join(gpa, "/", &.{ found.git, "blob", "HEAD", "zigmod.yml" });
55 const _req = try zfetch.Request.init(gpa, _url, null);63 var _req = try client.open(.GET, try std.Uri.parse(_url), .{
64 .server_header_buffer = &buf,
65 .redirect_behavior = .not_allowed,
66 });
56 defer _req.deinit();67 defer _req.deinit();
57 try _req.do(.GET, null, null);68 try _req.send();
58 break :blk @intFromEnum(_req.status) == 200;69 try _req.finish();
70 try _req.wait();
71 break :blk _req.response.status == .ok;
59 };72 };
6073
61 _, const file = try zigmod.ModFile.openFile(nfs.cwd(), .{ .mode = .read_write });74 _, const file = try zigmod.ModFile.openFile(nfs.cwd(), .{ .mode = .read_write });
src/lib.zig+2-3
...@@ -1,5 +1,4 @@...@@ -1,5 +1,4 @@
1const std = @import("std");1const std = @import("std");
2const zfetch = @import("zfetch");
3const extras = @import("extras");2const extras = @import("extras");
4const root = @import("root");3const root = @import("root");
5const build_options = root.build_options;4const build_options = root.build_options;
...@@ -18,11 +17,11 @@ pub const commands = struct {...@@ -18,11 +17,11 @@ pub const commands = struct {
18};17};
1918
20pub fn init() !void {19pub fn init() !void {
21 try zfetch.init();20 //
22}21}
2322
24pub fn deinit() void {23pub fn deinit() void {
25 zfetch.deinit();24 //
26}25}
2726
28pub const Dep = @import("./util/dep.zig").Dep;27pub const Dep = @import("./util/dep.zig").Dep;
zig.mod-1
...@@ -15,7 +15,6 @@ dependencies:...@@ -15,7 +15,6 @@ dependencies:
15 license: MIT15 license: MIT
16 version: commit-aa24df42183ad415d10bc0a33e6238c437fc0f5916 version: commit-aa24df42183ad415d10bc0a33e6238c437fc0f59
17 - src: git https://github.com/nektro/zig-licenses17 - src: git https://github.com/nektro/zig-licenses
18 - src: git https://github.com/nektro/zfetch
19 - src: git https://github.com/nektro/zig-detect-license18 - src: git https://github.com/nektro/zig-detect-license
20 - src: git https://github.com/nektro/zig-inquirer19 - src: git https://github.com/nektro/zig-inquirer
21 - src: git https://github.com/nektro/arqv-ini20 - src: git https://github.com/nektro/arqv-ini
zigmod.lock-3
...@@ -1,8 +1,6 @@...@@ -1,8 +1,6 @@
1212
2git https://github.com/marlersoft/zigwin32 commit-ec98bb4d9eea532320a8551720a9e3ec6de649942git https://github.com/marlersoft/zigwin32 commit-ec98bb4d9eea532320a8551720a9e3ec6de64994
3git https://github.com/nektro/arqv-ini commit-ab427a4de4f875eaa39ee56a29114fc0204315463git https://github.com/nektro/arqv-ini commit-ab427a4de4f875eaa39ee56a29114fc020431546
4git https://github.com/nektro/iguanaTLS commit-3450aaf3ca47986540e2b0258c2affc45af64ea2
5git https://github.com/nektro/zfetch commit-40d141bf7db81f05a83cce5f2edc4b14e41a5c34
6git https://github.com/nektro/zig-ansi commit-5f89211a749aef6bf518889c0467ceb24825c0554git https://github.com/nektro/zig-ansi commit-5f89211a749aef6bf518889c0467ceb24825c055
7git https://github.com/nektro/zig-detect-license commit-a1a066da88dab50873a56f0349dc12dc765420775git https://github.com/nektro/zig-detect-license commit-a1a066da88dab50873a56f0349dc12dc76542077
8git https://github.com/nektro/zig-extras commit-b3457b31a1d1ea2c19c5d0b007c903d3e80add406git https://github.com/nektro/zig-extras commit-b3457b31a1d1ea2c19c5d0b007c903d3e80add40
...@@ -20,7 +18,6 @@ git https://github.com/nektro/zig-sys-linux commit-f0b155d3627f8c19868be1b2f15d7...@@ -20,7 +18,6 @@ git https://github.com/nektro/zig-sys-linux commit-f0b155d3627f8c19868be1b2f15d7
20git https://github.com/nektro/zig-time commit-0f4db4c980146e4a3fc86a9a9070452a25ff931718git https://github.com/nektro/zig-time commit-0f4db4c980146e4a3fc86a9a9070452a25ff9317
21git https://github.com/nektro/zig-tracer commit-3a5fdea4ffd387a53ac2a42fb503557cdbe2069619git https://github.com/nektro/zig-tracer commit-3a5fdea4ffd387a53ac2a42fb503557cdbe20696
22git https://github.com/nektro/zig-yaml commit-00e899bec815bc2b49c6e5a72a7cfeeda673e13320git https://github.com/nektro/zig-yaml commit-00e899bec815bc2b49c6e5a72a7cfeeda673e133
23git https://github.com/truemedian/hzzp commit-ab212bd208f0eb54d85861679677c5e3dc9bb543
24git https://github.com/madler/zlib tag-v1.3.221git https://github.com/madler/zlib tag-v1.3.2
25git https://github.com/yaml/libyaml tag-0.2.522git https://github.com/yaml/libyaml tag-0.2.5
26git https://github.com/ziglibs/known-folders commit-aa24df42183ad415d10bc0a33e6238c437fc0f5923git https://github.com/ziglibs/known-folders commit-aa24df42183ad415d10bc0a33e6238c437fc0f59