An HTTP/1.0 server for Linux in x86-64 assembly. No libc; every build starts it and curls it.
Smoke test: start the server under Linux and curl it
Browse filesThe build now runs build/tiny-http on a spare port and fails unless GET / answers 200.
failing
3 steps in 3.17 s
2 files changed
+27−0
@@ -13,6 +13,12 @@ run = ["nasm", "-f", "elf64", "-o", "build/server.o", "src/server.asm"]
1313 name = "link"
1414 run = ["ld.lld", "-o", "build/tiny-http", "build/server.o"]
1515
16+[[step]]
17+name = "serve real requests"
18+on = "linux"
19+run = ["sh", "test/smoke.sh"]
20+expect = "smoke: 1 request answered"
21+
1622 [artifact]
1723 path = "build/tiny-http"
1824 max_size = 4096
@@ -0,0 +1,21 @@
1+#!/bin/sh
2+# Starts the server on a spare port, asks it for a page, and checks the
3+# answer. Run from the repository root after a build.
4+set -u
5+port=$((20000 + $$ % 20000))
6+./build/tiny-http "$port" &
7+pid=$!
8+trap 'kill "$pid" 2>/dev/null' EXIT INT TERM
9+url="http://127.0.0.1:$port"
10+
11+for i in 1 2 3 4 5 6 7 8 9 10; do
12+ curl -s -o /dev/null "$url/" && break
13+ sleep 0.1
14+done
15+
16+fail() { echo "FAIL: $*"; exit 1; }
17+
18+curl -s -i "$url/" | head -n 1 | grep -q '200 OK' || fail "GET / did not answer 200"
19+echo "GET / 200"
20+
21+echo "smoke: 1 request answered"