-
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for builtin libcurl and some other fixes (#4)
* Fix crash on easy.do() which does not pass the proper type to curl * Fix compile on latest zig * Use standard optimize options in built.zig * Fix typo in errors.zig * Allow the use of certificates in std.crypto.Certificate.Bundle instead of default one * Include builtin libcurl compiled against mbedTls, the use of std.crypto.Certificate.Bundle is required, or CURLOPT_CAINFO should be used to point to cacert bundle. --------- Co-authored-by: jiacai2050 <[email protected]>
- Loading branch information
1 parent
cc4c5db
commit 659c139
Showing
8 changed files
with
121 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
.{ | ||
.name = "zig-curl", | ||
.version = "0.1.0", | ||
.paths = .{ | ||
"src", | ||
"build.zig", | ||
"build.zig.zon", | ||
"LICENSE", | ||
}, | ||
.dependencies = .{ | ||
.libcurl = .{ | ||
.url = "https://github.com/Cloudef/zigcurl/archive/e9e726131d3eb80c02d20b7ee5ca6935324d6697.tar.gz", | ||
.hash = "1220970ad7d9b96b3464fc12c1e67998881bc4d07c03b8b7d75a5367e4c9991ef099", | ||
}, | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
const std = @import("std"); | ||
const Allocator = std.mem.Allocator; | ||
|
||
const Encoder = std.base64.standard.Encoder; | ||
|
||
pub fn encode_base64(allocator: Allocator, input: []const u8) ![]const u8 { | ||
const encoded_len = Encoder.calcSize(input.len); | ||
const dest = try allocator.alloc(u8, encoded_len); | ||
|
||
return Encoder.encode(dest, input); | ||
} |