mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-10-29 07:03:29 +00:00
Merge pull request #999 from lightpanda-io/handle_no_certs
Don't panic if no certs are available
This commit is contained in:
@@ -331,8 +331,15 @@ fn loadCerts(allocator: Allocator, arena: Allocator) !c.curl_blob {
|
|||||||
try bundle.rescan(allocator);
|
try bundle.rescan(allocator);
|
||||||
defer bundle.deinit(allocator);
|
defer bundle.deinit(allocator);
|
||||||
|
|
||||||
var it = bundle.map.valueIterator();
|
|
||||||
const bytes = bundle.bytes.items;
|
const bytes = bundle.bytes.items;
|
||||||
|
if (bytes.len == 0) {
|
||||||
|
log.warn(.app, "No system certificates", .{});
|
||||||
|
return .{
|
||||||
|
.len = 0,
|
||||||
|
.flags = 0,
|
||||||
|
.data = bytes.ptr,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
const encoder = std.base64.standard.Encoder;
|
const encoder = std.base64.standard.Encoder;
|
||||||
var arr: std.ArrayListUnmanaged(u8) = .empty;
|
var arr: std.ArrayListUnmanaged(u8) = .empty;
|
||||||
@@ -345,6 +352,7 @@ fn loadCerts(allocator: Allocator, arena: Allocator) !c.curl_blob {
|
|||||||
try arr.ensureTotalCapacity(arena, buffer_size);
|
try arr.ensureTotalCapacity(arena, buffer_size);
|
||||||
var writer = arr.writer(arena);
|
var writer = arr.writer(arena);
|
||||||
|
|
||||||
|
var it = bundle.map.valueIterator();
|
||||||
while (it.next()) |index| {
|
while (it.next()) |index| {
|
||||||
const cert = try std.crypto.Certificate.der.Element.parse(bytes, index.*);
|
const cert = try std.crypto.Certificate.der.Element.parse(bytes, index.*);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user