Merge pull request #1411 from lightpanda-io/more_SSO

more small strings (string.String)
This commit is contained in:
Karl Seguin
2026-01-27 13:18:56 +08:00
committed by GitHub
54 changed files with 625 additions and 424 deletions

View File

@@ -271,17 +271,21 @@ pub const Header = struct {
};
pub const Headers = struct {
headers: *c.curl_slist,
headers: ?*c.curl_slist,
cookies: ?[*c]const u8,
pub fn init(user_agent: [:0]const u8) !Headers {
const header_list = c.curl_slist_append(null, user_agent);
if (header_list == null) return error.OutOfMemory;
if (header_list == null) {
return error.OutOfMemory;
}
return .{ .headers = header_list, .cookies = null };
}
pub fn deinit(self: *const Headers) void {
c.curl_slist_free_all(self.headers);
if (self.headers) |hdr| {
c.curl_slist_free_all(hdr);
}
}
pub fn add(self: *Headers, header: [*c]const u8) !void {