Web_view.zig

//Zig Code

const std = @import("std");

pub fn main() !void {

    const gpa = std.heap.c_allocator;

    const host = "example.com";
    const port = 80;
    const sock = try std.net.tcpConnectToHost(gpa, host, port);
    const w = sock.writer();

    try w.print("GET / HTTP/1.1\r\n", .{});
    try w.print("Host: {}:{}\r\n", .{host, port});
    try w.print("Connection: Close\r\n\r\n", .{});

    const stdout = std.io.getStdOut().writer();

    const r = sock.reader();
    var buf: [128]u8 = undefined;
    while (true) {
        const len = try r.read(&buf);
        if (!(len > 0)) {
            break;
        }
        try stdout.writeAll(buf[0..len]);
    }
}