We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
0.14.0-dev.2198+e5f5229fd
I'm using this function to download files, which is probably not ideal but it seems to work for the most part.
https://github.com/torvalds/linux/archive/refs/tags/v6.11.tar.gz works successfully https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-6.11.7.tar.xz results in a tls decode error
It would be nice to be able to support downloading from cdn.kernel.org imo.
Opening a specific issue for this url as per #14172 (comment)
pub fn downloadFile(allocator: std.mem.Allocator, uri: std.Uri, destSubPath: []const u8) !void { var client: std.http.Client = .{ .allocator = allocator }; defer client.deinit(); try client.ca_bundle.rescan(allocator); var serverHeaderBuffer: [8192]u8 = undefined; var req = try client.open(.GET, uri, .{ .server_header_buffer = &serverHeaderBuffer, }); defer req.deinit(); try req.send(); try req.finish(); std.log.info("downloading {}", .{uri}); try req.wait(); switch (req.response.status) { .ok => {}, else => { return FetchError.BadResponse; }, } const bodyBufferSize = 4096; // create br with bodyBufferSize? var br = std.io.bufferedReader(req.reader()); const r = br.reader(); var bodyBuf: [bodyBufferSize]u8 = undefined; var readBytes = try r.read(&bodyBuf); if (readBytes <= 0) { return FetchError.NoData; } const file = try std.fs.cwd().createFile(destSubPath, .{}); defer file.close(); var bw = std.io.bufferedWriter(file.writer()); while (readBytes > 0) { _ = try bw.write(bodyBuf[0..readBytes]); readBytes = try r.read(&bodyBuf); } try bw.flush(); }
For the http client to negotiate and download the file using the kernel.org url as it does for the github url.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Zig Version
0.14.0-dev.2198+e5f5229fd
Steps to Reproduce and Observed Behavior
I'm using this function to download files, which is probably not ideal but it seems to work for the most part.
https://github.com/torvalds/linux/archive/refs/tags/v6.11.tar.gz works successfully
https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-6.11.7.tar.xz results in a tls decode error
It would be nice to be able to support downloading from cdn.kernel.org imo.
Opening a specific issue for this url as per #14172 (comment)
Expected Behavior
For the http client to negotiate and download the file using the kernel.org url as it does for the github url.
The text was updated successfully, but these errors were encountered: