This repo holds my Zig code for the browser implemented in Web Browser Engineering.
You'll need Zig installed.
Clone the project
git clone https://github.com/braheezy/zibra.git
To build the project, run:
zig build
cp zig-out/bin/zibra .
zibra
takes one or more URLs and displays the result in raw text on the command line.
> zibra https://example.org
Connecting to example.org:443
HTTP/1.1 200 OK
Example Domain
body {
background-color: #f0f0f2;
margin: 0;
padding: 0;
font-family: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
}
div {
width: 600px;
...
Example Domain
This domain is for use in illustrative examples in documents. You may use this
domain in literature without prior coordination or asking for permission.
More information...
zibra
is small but supports the basics:
file://
URIsdata:
URIs<div>
becomes <div>
)view-source:
Connection: keep-alive
headerCache-Control
headerContent-Encoding: gzip
and Transfer-Encoding: chunked
headersThere's more Zig commands:
# build and run
zig build run -- https://example.com
# Run rests
zig build test
To test chunked gzip responses, run gzipServer.py
locally.