~ knotless Search/
↑↓ move↵ open⇧↵ all results

zat.dev/zttp

mirror of https://tangled.org/zat.dev/zttp

0
0
main
20 lines · 903 B Raw History
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", .{});
}