I've got a similar one, but with http 1.0 and partial 1.1 support, multi threaded, etc. in C https://GitHub.com/lionkor/http
Show HN: unsafehttp – tiny web server from scratch in C, running on an orange pi
41–50 of 54 posts
Re: Show HN: unsafehttp – tiny web server from scratch in C, running on an orange pi
#42Nice effort but this isn’t interesting at all. You skipped the most interesting part; parsing http. This is beejs networking tutorial with writing a file to a socket. Harsh? Maybe, but you’re posting this to a site with some of the most talented developers on planet. Real talk, sorry.
Re: Show HN: unsafehttp – tiny web server from scratch in C, running on an orange pi
#43// it doesn't seem to love piping or redirecting output without this, even // with the newlines above fflush(stdout); Ah, the full buffering mode. I believe it can be fixed by calling setvbuf(stdout, NULL, _IOLBF, BUFSIZ); once at the start. On the whole, it actually almost implements the minimally required amount of HTTP/1.1: I would suggest adding support for HEAD requests, it's just a single flag that you need to…
Re: Show HN: unsafehttp – tiny web server from scratch in C, running on an orange pi
#44Earlier quoted context omitted.
Whoops, should be back up now. I'll have to check logs later to see why it went down.
You're going to need a bigger host to support HN traffic :)
Fewer source IPs
Re: Show HN: unsafehttp – tiny web server from scratch in C, running on an orange pi
#45Easiest way to make it safe is 1) Run it in a container 2) Isolate it through a reverse proxy, probably nginx
Re: Show HN: unsafehttp – tiny web server from scratch in C, running on an orange pi
#46Nice effort but this isn’t interesting at all. You skipped the most interesting part; parsing http. This is beejs networking tutorial with writing a file to a socket. Harsh? Maybe, but you’re posting this to a site with some of the most talented developers on planet. Real talk, sorry.
Parsing HTTP is entirely unnecessary. That's the web client's job.
Re: Show HN: unsafehttp – tiny web server from scratch in C, running on an orange pi
#47> This server follows almost none of that.
This made me chuckle :-)
Re: Show HN: unsafehttp – tiny web server from scratch in C, running on an orange pi
#48Re: Show HN: unsafehttp – tiny web server from scratch in C, running on an orange pi
#49Re: Show HN: unsafehttp – tiny web server from scratch in C, running on an orange pi
#50> RFC 9112 is a fantastic document that details the exact format of HTTP 1.1 requests, how servers should respond to those requests ... > This server follows almost none of that. This made me chuckle :-)
> Readers MUST NOT hold this against the project, and SHOULD use this as motivation to keep some of their own side projects fun and short.
That's comedy gold, right there. (Tip: RFC-2119)