Skip to content

Commit

Permalink
refactor(build,download): Remove curl dependency, replace with stdlib…
Browse files Browse the repository at this point in the history
…'s http client (#490)

* Remove curl/use std's http, refactor/enhance

* Don't assert buffer size
Instead, just add a recommendation in a doc comment, and add a warning
if the caller supplied an under-sized buffer for a Gibibyte-sized file.
  • Loading branch information
InKryption authored Jan 13, 2025
1 parent 3c6d049 commit 68e7605
Show file tree
Hide file tree
Showing 4 changed files with 152 additions and 281 deletions.
7 changes: 0 additions & 7 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,6 @@ pub fn build(b: *Build) void {
const zstd_dep = b.dependency("zstd", dep_opts);
const zstd_mod = zstd_dep.module("zstd");

const curl_dep = b.dependency("curl", dep_opts);
const curl_mod = curl_dep.module("curl");

const rocksdb_dep = b.dependency("rocksdb", dep_opts);
const rocksdb_mod = rocksdb_dep.module("rocksdb-bindings");

Expand All @@ -70,7 +67,6 @@ pub fn build(b: *Build) void {
sig_mod.addImport("zig-cli", zig_cli_module);
sig_mod.addImport("httpz", httpz_mod);
sig_mod.addImport("zstd", zstd_mod);
sig_mod.addImport("curl", curl_mod);
switch (blockstore_db) {
.rocksdb => sig_mod.addImport("rocksdb", rocksdb_mod),
.hashmap => {},
Expand All @@ -93,7 +89,6 @@ pub fn build(b: *Build) void {

b.installArtifact(sig_exe);
sig_exe.root_module.addImport("base58-zig", base58_module);
sig_exe.root_module.addImport("curl", curl_mod);
sig_exe.root_module.addImport("httpz", httpz_mod);
sig_exe.root_module.addImport("zig-cli", zig_cli_module);
sig_exe.root_module.addImport("zig-network", zig_network_module);
Expand Down Expand Up @@ -139,7 +134,6 @@ pub fn build(b: *Build) void {
});
b.installArtifact(unit_tests_exe);
unit_tests_exe.root_module.addImport("base58-zig", base58_module);
unit_tests_exe.root_module.addImport("curl", curl_mod);
unit_tests_exe.root_module.addImport("httpz", httpz_mod);
unit_tests_exe.root_module.addImport("zig-network", zig_network_module);
unit_tests_exe.root_module.addImport("zstd", zstd_mod);
Expand Down Expand Up @@ -187,7 +181,6 @@ pub fn build(b: *Build) void {
benchmark_exe.root_module.addImport("zig-network", zig_network_module);
benchmark_exe.root_module.addImport("httpz", httpz_mod);
benchmark_exe.root_module.addImport("zstd", zstd_mod);
benchmark_exe.root_module.addImport("curl", curl_mod);
benchmark_exe.root_module.addImport("prettytable", pretty_table_mod);
switch (blockstore_db) {
.rocksdb => benchmark_exe.root_module.addImport("rocksdb", rocksdb_mod),
Expand Down
4 changes: 0 additions & 4 deletions build.zig.zon
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@
.url = "git+https://github.com/Syndica/zstd.zig#5095f011c1183aa67d696172795440d6a33732c9",
.hash = "122030ebe280b73693963a67ed656226a67b7f00a0a05665155da00c9fcdee90de88",
},
.curl = .{
.url = "https://github.com/jiacai2050/zig-curl/archive/8a3f45798a80a5de4c11c6fa44dab8785c421d27.tar.gz",
.hash = "1220f70ac854b59315a8512861e039648d677feb4f9677bd873d6b9b7074a5906485",
},
.rocksdb = .{
.url = "https://github.com/Syndica/rocksdb-zig/archive/6d4230e131183cccb730a7248bd4ca30c559b8bd.tar.gz",
.hash = "12207766d25ba350d6e2f2153fc74a2b3ff204224e1c08adf211cd9e400075033898",
Expand Down
Loading

0 comments on commit 68e7605

Please sign in to comment.