Ask HN: Resources for Building a Webserver in C?
51–60 of 67 posts
Re: Ask HN: Resources for Building a Webserver in C?
#52You might find my epollserver interesting. It multiplexes multiple clients (sockets) over a thread, so you can write an event loop in each thread and serve far more requests per thread than you could if it was one thread per client or one process per client. (epollserver_threaded.c) It uses a thread safe multiconsumer multiproducer ringbuffer to communicate between threads. https://github.com/samsquire/epoll-server I…
Re: Ask HN: Resources for Building a Webserver in C?
#53Earlier quoted context omitted.
I'm not sure I follow - you want a smart, small webserver that takes in a http request and updates an analytic store based on headers? Sounds like something nginx might handle via lua scripting? Otherwise, maybe you want: https://github.com/lammertb/libhttp Or you might want to look at either of: https://www.acme.com/software/thttpd/ https://github.com/openbsd/src/tree/master/usr.sbin/httpd If you really want to buil…
I want to consume HTTP headers at the lowest possible level. The webserver would output a custom log file for direct consumption. There are certainly off the shelf options, but I enjoy reinventing the wheel and dislike dependencies. I'd like to use C because I have interest in OS level webservers.
https://github.com/nanovms/nanos/blob/master/src/http/http.c
Re: Ask HN: Resources for Building a Webserver in C?
#54I remember using this tutorial to build a web server that handles sockets. Short source code, excludes edge cases, but useful to understand the gist of web servers. https://www.ibm.com/support/pages/how-does-webserver-actuall...
Thanks for the share.
Re: Ask HN: Resources for Building a Webserver in C?
#55Re: Ask HN: Resources for Building a Webserver in C?
#56Re: Ask HN: Resources for Building a Webserver in C?
#57Complete OpenBSD + Sqlite + C + httpd toolkit for building websites. http://bsd.lv/ I recommend swapping out C for a safer&more productive language.
Is there a safe and productive language that produces binaries that run fast? Between the rising energy prices and CO2 pollution it would be very irresponsible to use languages like Python or Ruby.
Re: Ask HN: Resources for Building a Webserver in C?
#58Earlier quoted context omitted.
Is there a safe and productive language that produces binaries that run fast? Between the rising energy prices and CO2 pollution it would be very irresponsible to use languages like Python or Ruby.
Go help you save more CO2 by compiling your code in a blink
Re: Ask HN: Resources for Building a Webserver in C?
#59Re: Ask HN: Resources for Building a Webserver in C?
#60"Write a tiny web server in C" was a standard exercise when I was in high school, and later again in university. I think I did that at least 3 times as an assignment so far. I reused the final version for a different university exercise instead of bothering with Tomcat as I was required, and back in 2015, dumped the end result here: https://github.com/AgentD/websrv where I kept adding to it for a while for fun. The H…