summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Uko Kokņevičs2024-07-10 10:08:21 +0300
committerGravatar Uko Kokņevičs2024-07-10 10:08:21 +0300
commit14c5c2f4686d260b43d602f0c01ed0b760eabbd1 (patch)
treeaadc2c1679ccb3a21dbde8f28835300ac654bf12
parentMove to git.enes.lv (diff)
downloadzup-14c5c2f4686d260b43d602f0c01ed0b760eabbd1.tar.gz
zup-14c5c2f4686d260b43d602f0c01ed0b760eabbd1.tar.xz
zup-14c5c2f4686d260b43d602f0c01ed0b760eabbd1.zip
Release 0.4.00.4.0
-rw-r--r--README.org2
-rw-r--r--build.zig.zon10
-rw-r--r--src/EasyHttp.zig10
3 files changed, 12 insertions, 10 deletions
diff --git a/README.org b/README.org
index dc07339..7c46082 100644
--- a/README.org
+++ b/README.org
@@ -22,6 +22,8 @@ newer (hopefully the newest!) Zig version that should enable you to compile the
22| 0.10.0 | 0.2.1 | 22| 0.10.0 | 0.2.1 |
23| 0.10.1 | 0.2.1 | 23| 0.10.1 | 0.2.1 |
24| 0.11.0 | 0.3.0 | 24| 0.11.0 | 0.3.0 |
25| 0.12.0 | 0.4.0 |
26| 0.12.1 | 0.4.0 |
25| master | main | 27| master | main |
26 28
27* How 29* How
diff --git a/build.zig.zon b/build.zig.zon
index 1195e7a..aed6a59 100644
--- a/build.zig.zon
+++ b/build.zig.zon
@@ -5,16 +5,16 @@
5 .paths = .{""}, 5 .paths = .{""},
6 .dependencies = .{ 6 .dependencies = .{
7 .clap = .{ 7 .clap = .{
8 .url = "https://git.enes.lv/zig-clap/snapshot/zig-clap-4267b0b60ef6f87cccf3ee6ed481e6d0759180c6.tar.xz", 8 .url = "https://git.enes.lv/zig-clap/snapshot/zig-clap-0.8.0.tar.xz",
9 .hash = "12202fa30d679d821292bcd953458b9e76097a5d16999489125a206db63a53392833", 9 .hash = "1220949d4e88864579067b6d4cdad6476c6176f27e782782c2c39b7f2c4817a10efb",
10 }, 10 },
11 .libarchive = .{ 11 .libarchive = .{
12 .url = "https://git.enes.lv/zig-libarchive/snapshot/zig-libarchive-7d3a63d5e05787847e5a199ffdd5bad99e7dbd7a.tar.xz", 12 .url = "https://git.enes.lv/zig-libarchive/snapshot/zig-libarchive-0.3.0.tar.xz",
13 .hash = "1220d8262d35559168d67d60797829a36958320556b277cd0e701a34eb00880461ab", 13 .hash = "1220d8262d35559168d67d60797829a36958320556b277cd0e701a34eb00880461ab",
14 }, 14 },
15 .xdg = .{ 15 .xdg = .{
16 .url = "https://git.enes.lv/zig-xdg/snapshot/zig-xdg-1e925ee081a4880ad895c3976bd6e1d1061a4040.tar.xz", 16 .url = "https://git.enes.lv/zig-xdg/snapshot/zig-xdg-0.3.0.tar.xz",
17 .hash = "122022d632b2ca6fd959b31748b3a4a7404d391abfae9b297bb3ce29045ae27e5568", 17 .hash = "1220e214475ea8ff31ac110f593be121663eefdca27d19508d0c96bc49f47c31756f",
18 }, 18 },
19 }, 19 },
20} 20}
diff --git a/src/EasyHttp.zig b/src/EasyHttp.zig
index 10dcd0c..28228a7 100644
--- a/src/EasyHttp.zig
+++ b/src/EasyHttp.zig
@@ -3,7 +3,6 @@ const std = @import("std");
3const Allocator = std.mem.Allocator; 3const Allocator = std.mem.Allocator;
4const ArenaAllocator = std.heap.ArenaAllocator; 4const ArenaAllocator = std.heap.ArenaAllocator;
5const Client = std.http.Client; 5const Client = std.http.Client;
6const Headers = std.http.Headers;
7const Reader = Request.Reader; 6const Reader = Request.Reader;
8const Request = Client.Request; 7const Request = Client.Request;
9const Uri = std.Uri; 8const Uri = std.Uri;
@@ -19,13 +18,14 @@ pub fn get(parent_allocator: Allocator, uri: Uri) ![]u8 {
19 }; 18 };
20 defer client.deinit(); 19 defer client.deinit();
21 20
22 var headers = Headers.init(allocator); 21 var server_header_buffer: [4096]u8 = undefined;
23 defer headers.deinit();
24 22
25 var request = try client.open(.GET, uri, headers, .{}); 23 var request = try client.open(.GET, uri, .{
24 .server_header_buffer = &server_header_buffer,
25 });
26 defer request.deinit(); 26 defer request.deinit();
27 27
28 try request.send(.{}); 28 try request.send();
29 try request.wait(); 29 try request.wait();
30 30
31 return request.reader().readAllAlloc(parent_allocator, std.math.maxInt(usize)); 31 return request.reader().readAllAlloc(parent_allocator, std.math.maxInt(usize));