[HN Gopher] Show HN: A little web server in C
___________________________________________________________________
Show HN: A little web server in C
A little web server written in C for Linux. Supports: CGI, Reverse
Proxy. Single threaded using I/O multiplexing (select).
Author : robdelacruz
Score : 45 points
Date : 2023-05-16 19:37 UTC (3 hours ago)
(HTM) web link (github.com)
(TXT) w3m dump (github.com)
| mazidodo wrote:
| [flagged]
| whartung wrote:
| I dunno. I haven't written a multiplexing I/O server. I haven't
| written a CGI forking process. I haven't written a reverse
| proxy handler. Heck, I haven't written C in years.
|
| All sorts of reason why someone might want to write one of
| these. There's even a bunch of free tools to help test it (and
| who doesn't like free tests!).
|
| Until you put fingers to keyboard, you just don't know, it's
| all book learnin'.
| tmountain wrote:
| Good for you. Great way to learn!
| skulk wrote:
| Cool project, but this project demonstrates the reason I've
| stopped writing things in C. The standard library has garbage
| string functions and it seems every project has its own version
| of this file:
|
| https://github.com/robdelacruz/lkwebserver/blob/main/lkstrin...
|
| It's fun to write this (and read others' versions) the first 3 or
| 4 times, but it gets old quickly.
| xmonkee wrote:
| I have the same issue, but I blame the absence of good package
| management. If it had that, one of the thousands of these
| libraries would have won out and become quasi-standard.
| lionkor wrote:
| Shameless plug for when I attempted something similar, though
| multithreaded with pthreads: https://github.com/lionkor/http
| sgloutnikov wrote:
| Here's also althttpd [0]. Heard Richard Hipp mention it and
| fossil in an interview.
|
| [0] https://sqlite.org/althttpd/doc/trunk/althttpd.md
| samtho wrote:
| This may sound sort of "old man waves at cloud" of me but one
| thing I've found sad is the gross over-complication of later
| versions of standards such that the sort of project linked here
| may not be as practical for something like HTTP/3 for example.
| Similarly, the large, muddled tool chain that is "required" to
| make modern JavaScript applications makes it hard for newer
| learners to really understand what is going on because the
| minimal code version still needs its own transpiler, build
| system, linter, process managers, etc. Maybe we need all this
| complexity, but I suspect that some of the overzealous, solve-
| everything systems design we have come accustomed to is mainly
| serving to create a larger problem set instead of creating
| elegant abstractions that are agreed upon.
| skaushik92 wrote:
| I see what you're saying and agree that HTTP3 is complicated
| but I would that since it's a backwards compatible standard,
| the added complexities are completely optional. For most use
| cases the basic protocol is perfectly suitable and only as the
| scale evolves does it require the additional complexity.
| samtho wrote:
| I understand what you're saying, but if someone decides to
| post a link to their project that is an HTTP/3 server in
| under X lines of code but only implements HTTP/2 features, is
| it really an HTTP/3 web server?
| rahmeero wrote:
| Interesting. Would be good to get more info, beyond having to
| read the code.
|
| Curious to know how it compares to micro_httpd [1] which is about
| 200 lines of C. Or others like thttpd and tiny_httpd.
|
| [1] https://acme.com/software/thttpd/benchmarks.html
| qwertywert_ wrote:
| The amount of written functions/libs for opening c sockets has to
| be in the 100,000s at this point. And they are all slightly
| different.
| forgotmypw17 wrote:
| Thank you so much for sharing this!
|
| This is exactly the type of web server I'm looking for my
| project.
___________________________________________________________________
(page generated 2023-05-16 23:00 UTC)