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 {
5656 }
5757 step.dependOn(&GitExactStep.create(b, "https://github.com/marlersoft/zigwin32", "ec98bb4d9eea532320a8551720a9e3ec6de64994").step);
5858 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);
6159 step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-ansi", "5f89211a749aef6bf518889c0467ceb24825c055").step);
6260 step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-detect-license", "a1a066da88dab50873a56f0349dc12dc76542077").step);
6361 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 {
7573 step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-time", "0f4db4c980146e4a3fc86a9a9070452a25ff9317").step);
7674 step.dependOn(&GitExactStep.create(b, "https://github.com/nektro/zig-tracer", "3a5fdea4ffd387a53ac2a42fb503557cdbe20696").step);
7775 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);
7976 step.dependOn(&GitExactStep.create(b, "https://github.com/madler/zlib", "da607da739fa6047df13e66a2af6b8bec7c2a498").step);
8077 step.dependOn(&GitExactStep.create(b, "https://github.com/yaml/libyaml", "2c891fc7a770e8ba2fec34fc6b545c672beb37e6").step);
8178 step.dependOn(&GitExactStep.create(b, "https://github.com/ziglibs/known-folders", "aa24df42183ad415d10bc0a33e6238c437fc0f59").step);
......@@ -199,11 +196,6 @@ pub const package_data = struct {
199196 .name = "ini",
200197 .entry = "/git/github.com/nektro/arqv-ini/ab427a4de4f875eaa39ee56a29114fc020431546/src/ini.zig",
201198 };
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 };
207199 pub var _s84v9o48ucb0 = Package{
208200 .store = "/git/github.com/nektro/zig-ansi/5f89211a749aef6bf518889c0467ceb24825c055",
209201 .name = "ansi",
......@@ -302,17 +294,6 @@ pub const package_data = struct {
302294 .entry = "/git/github.com/nektro/zig-yaml/00e899bec815bc2b49c6e5a72a7cfeeda673e133/yaml.zig",
303295 .deps = &[_]*Package{ &_8mdbh0zuneb0 },
304296 };
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 };
316297 pub var _0e2d06bb494b = Package{
317298 .store = "/git/github.com/madler/zlib/da607da739fa6047df13e66a2af6b8bec7c2a498",
318299 .c_include_dirs = &.{ "" },
......@@ -333,7 +314,7 @@ pub const package_data = struct {
333314 pub var _89ujp8gq842x = Package{
334315 .name = "zigmod",
335316 .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 },
337318 };
338319 pub var _root = Package{
339320 };
licenses.txt-3
......@@ -3,8 +3,6 @@ MIT:
33- This
44- git https://github.com/marlersoft/zigwin32
55- git https://github.com/nektro/arqv-ini
6- git https://github.com/nektro/iguanaTLS
7- git https://github.com/nektro/zfetch
86- git https://github.com/nektro/zig-ansi
97- git https://github.com/nektro/zig-detect-license
108- git https://github.com/nektro/zig-extras
......@@ -18,7 +16,6 @@ MIT:
1816- git https://github.com/nektro/zig-time
1917- git https://github.com/nektro/zig-tracer
2018- git https://github.com/nektro/zig-yaml
21- git https://github.com/truemedian/hzzp
2219- git https://github.com/yaml/libyaml
2320- git https://github.com/ziglibs/known-folders
2421
src/cmd/zpm.zig+12-3
......@@ -1,7 +1,6 @@
11const std = @import("std");
22const string = []const u8;
33const gpa = std.heap.c_allocator;
4const zfetch = @import("zfetch");
54const extras = @import("extras");
65const json = @import("json");
76const nio = @import("nio");
......@@ -58,9 +57,19 @@ pub fn execute(self_name: []const u8, args: [][:0]u8) !void {
5857}
5958
6059pub 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 });
6268 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;
6473 return json.parse(gpa, "", nio.AnyReadable.fromStd(&req.reader()), .{ .support_trailing_commas = true, .maximum_depth = 100 });
6574}
6675
src/cmd/zpm/add.zig+20-7
......@@ -1,6 +1,5 @@
11const std = @import("std");
22const gpa = std.heap.c_allocator;
3const zfetch = @import("zfetch");
43const extras = @import("extras");
54const nfs = @import("nfs");
65
......@@ -43,19 +42,33 @@ pub fn execute(self_name: []const u8, args: [][:0]u8) !void {
4342 }
4443 }
4544
45 var buf: [4096]u8 = @splat(0);
46 var client: std.http.Client = .{ .allocator = gpa };
47 defer client.deinit();
48
4649 const has_zigdotmod = blk: {
4750 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 });
4955 defer _req.deinit();
50 try _req.do(.GET, null, null);
51 break :blk @intFromEnum(_req.status) == 200;
56 try _req.send();
57 try _req.finish();
58 try _req.wait();
59 break :blk _req.response.status == .ok;
5260 };
5361 const has_zigmodyml = blk: {
5462 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 });
5667 defer _req.deinit();
57 try _req.do(.GET, null, null);
58 break :blk @intFromEnum(_req.status) == 200;
68 try _req.send();
69 try _req.finish();
70 try _req.wait();
71 break :blk _req.response.status == .ok;
5972 };
6073
6174 _, const file = try zigmod.ModFile.openFile(nfs.cwd(), .{ .mode = .read_write });
src/lib.zig+2-3
......@@ -1,5 +1,4 @@
11const std = @import("std");
2const zfetch = @import("zfetch");
32const extras = @import("extras");
43const root = @import("root");
54const build_options = root.build_options;
......@@ -18,11 +17,11 @@ pub const commands = struct {
1817};
1918
2019pub fn init() !void {
21 try zfetch.init();
20 //
2221}
2322
2423pub fn deinit() void {
25 zfetch.deinit();
24 //
2625}
2726
2827pub const Dep = @import("./util/dep.zig").Dep;
zig.mod-1
......@@ -15,7 +15,6 @@ dependencies:
1515 license: MIT
1616 version: commit-aa24df42183ad415d10bc0a33e6238c437fc0f59
1717 - src: git https://github.com/nektro/zig-licenses
18 - src: git https://github.com/nektro/zfetch
1918 - src: git https://github.com/nektro/zig-detect-license
2019 - src: git https://github.com/nektro/zig-inquirer
2120 - src: git https://github.com/nektro/arqv-ini
zigmod.lock-3
......@@ -1,8 +1,6 @@
112
22git https://github.com/marlersoft/zigwin32 commit-ec98bb4d9eea532320a8551720a9e3ec6de64994
33git https://github.com/nektro/arqv-ini commit-ab427a4de4f875eaa39ee56a29114fc020431546
4git https://github.com/nektro/iguanaTLS commit-3450aaf3ca47986540e2b0258c2affc45af64ea2
5git https://github.com/nektro/zfetch commit-40d141bf7db81f05a83cce5f2edc4b14e41a5c34
64git https://github.com/nektro/zig-ansi commit-5f89211a749aef6bf518889c0467ceb24825c055
75git https://github.com/nektro/zig-detect-license commit-a1a066da88dab50873a56f0349dc12dc76542077
86git https://github.com/nektro/zig-extras commit-b3457b31a1d1ea2c19c5d0b007c903d3e80add40
......@@ -20,7 +18,6 @@ git https://github.com/nektro/zig-sys-linux commit-f0b155d3627f8c19868be1b2f15d7
2018git https://github.com/nektro/zig-time commit-0f4db4c980146e4a3fc86a9a9070452a25ff9317
2119git https://github.com/nektro/zig-tracer commit-3a5fdea4ffd387a53ac2a42fb503557cdbe20696
2220git https://github.com/nektro/zig-yaml commit-00e899bec815bc2b49c6e5a72a7cfeeda673e133
23git https://github.com/truemedian/hzzp commit-ab212bd208f0eb54d85861679677c5e3dc9bb543
2421git https://github.com/madler/zlib tag-v1.3.2
2522git https://github.com/yaml/libyaml tag-0.2.5
2623git https://github.com/ziglibs/known-folders commit-aa24df42183ad415d10bc0a33e6238c437fc0f59