Show HN: unsafehttp – tiny web server from scratch in C, running on an orange pi

10 GSGBen 10 8/16/2025, 8:46:15 PM unsafehttp.benren.au ↗
Hey HN, I wanted to get more familiar with C programming, *nix socket programming and C compilation, so I wrote this "web" ""server"". It's running on a tiny SBC in my office, and there's as little as possible between you and it.

Happy for you to try and break it, hopefully with something more interesting than a DoS though :) Please let me know if you find any issues.

Comments (10)

MelvinButtsESQ · 14m ago
Consider it broke. You are getting hugged to death by HN. Throw Cloudlfare in front.
p0w3n3d · 16m ago
I would expect GitHub page. The server seems down
201984 · 15m ago
It had a link to the GitHub page while it was still up.

https://github.com/GSGBen/unsafehttp

joncfoo · 35m ago
Doesn't seem to be up =\
GSGBen · 11m ago
Found the issue - a use after free in send_response() if I close the session early due to an error. Was continuing to the next bit. Put a temp fix in place, will push a proper one later.
GSGBen · 4m ago
Still seems to have an issue, but no output before the crash. Will have to do some more debugging. Thanks for the test HN!

Source is here btw: https://github.com/GSGBen/unsafehttp/blob/main/src/main.c

GSGBen · 27m ago
Whoops, should be back up now. I'll have to check logs later to see why it went down.
eyjafjallajokul · 19m ago
You're going to need a bigger host to support HN traffic :)
201984 · 13m ago
What is it about HN that overwhelms small servers like this? It was a small static page so I wouldn't think it'd be that much load on the server itself, even for an OrangePi like this one.

Too many simultaneous connections for his router maybe? Or too much bandwidth for his internet connection?

binaryturtle · 6m ago
If they are behind a NAT/ stateful firewall there is just so much connections it will handle at once. I think OpenWRT has like 16K max by default, f.ex. So for less than 16K requests by different users/IPs… each is kept for about 1 minute I think… it quickly will go down, I guess. :)

cat /proc/sys/net/netfilter/nf_conntrack_max

Should give some details.