1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
const std = @import("std");
pub fn main(init: std.process.Init) !void {
var client: std.http.Client = .{ .allocator = init.gpa, .io = init.io };
defer client.deinit();
for ([_][]const u8{
"https://dv-g3b-emudhra.we-have-a-problem.com/",
"https://dv-g3b-aaa-emudhra.we-have-a-problem.com/",
}) |url| {
if (client.fetch(.{ .location = .{ .url = url }, .keep_alive = false })) |_| {
return error.CompromisedChainAccepted;
} else |err| {
if (err != error.TlsInitializationFailed) return err;
std.debug.print("std.http rejected {s}: {s}\n", .{ url, @errorName(err) });
}
}
const control = try client.fetch(.{ .location = .{ .url = "https://atproto.com/" }, .keep_alive = false });
if (control.status != .ok) return error.ControlFailed;
std.debug.print("std.http atproto.com control: 200\n", .{});
}