atproto utils for zig zat.dev
atproto sdk zig

add configurable keep_alive on HttpTransport and DidResolver

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

+13 -1
+11 -1
src/internal/identity/did_resolver.zig
··· 17 17 plc_url: []const u8 = "https://plc.directory", 18 18 19 19 pub fn init(allocator: std.mem.Allocator) DidResolver { 20 + return initWithOptions(allocator, .{}); 21 + } 22 + 23 + pub const Options = struct { 24 + keep_alive: bool = true, 25 + }; 26 + 27 + pub fn initWithOptions(allocator: std.mem.Allocator, options: Options) DidResolver { 28 + var transport = HttpTransport.init(allocator); 29 + transport.keep_alive = options.keep_alive; 20 30 return .{ 21 31 .allocator = allocator, 22 - .transport = HttpTransport.init(allocator), 32 + .transport = transport, 23 33 }; 24 34 } 25 35
+2
src/internal/xrpc/transport.zig
··· 13 13 pub const HttpTransport = struct { 14 14 allocator: std.mem.Allocator, 15 15 http_client: std.http.Client, 16 + keep_alive: bool = true, 16 17 17 18 // 0.16: will add 18 19 // io: ?std.Io = null, ··· 80 81 .payload = options.payload, 81 82 .headers = headers, 82 83 .extra_headers = extra_buf[0..extra_count], 84 + .keep_alive = self.keep_alive, 83 85 }) catch return error.RequestFailed; 84 86 85 87 const body = aw.toArrayList().items;