website
git clone https://git.pyrossh.dev/website
木 Personal website of pyrossh. Built with astrojs, shiki, vite.
tests/hurl/git-dumb-protocol.hurl
# Sanity checks for the git dumb-HTTP protocol served straight out of the
# "git" R2 bucket (git.pyrossh.dev) — there's no server-side git process behind
# it, just static file serving, so these checks make sure the bucket layout
# still looks like a valid dumb-protocol repo: HEAD/info/refs/objects in the
# shapes `git clone`'s dumb-http client expects, range requests (used to
# resume fetches), and 404s for repos/objects that don't exist.
#
# Run with: npm run test:hurl
# Override the target with: hurl --test --variable base_url=http://localhost:PORT tests/hurl/*.hurl
GET {{base_url}}/website/HEAD
HTTP 200
[Asserts]
header "Content-Type" == "application/octet-stream"
header "Accept-Ranges" == "bytes"
body matches "^ref: refs/heads/[^\n]+\n$"
[Captures]
head_ref: regex "ref: (refs/heads/\\S+)"
# info/refs lists every ref as "<40-hex-sha>\t<ref name>", one per line — the
# format `git clone`'s dumb-http client parses to discover what it can fetch.
GET {{base_url}}/website/info/refs
HTTP 200
[Asserts]
header "Content-Type" == "application/octet-stream"
body matches "(?m)^[0-9a-f]{40}\\t{{head_ref}}$"
# A smart-http server would respond to `?service=git-upload-pack` with a
# pkt-line "# service=git-upload-pack" advertisement and a different content
# type. R2 has no server logic to do that, so the query string is just
# ignored and the plain dumb-protocol refs list comes back unchanged — this
# is what makes it a dumb (not smart) git server.
GET {{base_url}}/website/info/refs?service=git-upload-pack
HTTP 200
[Asserts]
header "Content-Type" == "application/octet-stream"
body matches "(?m)^[0-9a-f]{40}\\trefs/heads/"
# objects/info/packs lists available packfiles as "P <pack name>" — dumb
# clients read this to know which packs to download instead of walking
# loose objects one by one.
GET {{base_url}}/website/objects/info/packs
HTTP 200
[Asserts]
body matches "^P pack-[0-9a-f]{40}\\.pack\\n"
[Captures]
pack_sha: regex "P pack-([0-9a-f]{40})\\.pack"
GET {{base_url}}/website/objects/pack/pack-{{pack_sha}}.idx
HTTP 200
[Asserts]
header "Content-Type" == "application/octet-stream"
bytes count > 0
GET {{base_url}}/website/objects/pack/pack-{{pack_sha}}.pack
HTTP 200
[Asserts]
header "Accept-Ranges" == "bytes"
bytes count > 0
# Dumb-http clients fetch packfiles with Range requests so an interrupted
# clone can resume instead of restarting — this only works if R2 honors them.
GET {{base_url}}/website/objects/pack/pack-{{pack_sha}}.pack
Range: bytes=0-99
HTTP 206
[Asserts]
header "Content-Range" matches "^bytes 0-99/\\d+$"
bytes count == 100
GET {{base_url}}/this-repo-does-not-exist-xyz/HEAD
HTTP 404
GET {{base_url}}/website/objects/00/0000000000000000000000000000000000
HTTP 404