Only 3.4k of C code for a full http and https server? I honestly thought you would need a lot more for it to be fully compliant with the spec.
It’s fun and not that bad really.
Hell if you’re really lazy you can forgo responding with the http headers and just socket.write(“hello world”) as the response and all the major browsers will render “hello world” to the user. Properly formatted http headers are just a text string extra and the html is just text. There’s not much to it.
Everybody speaks HTTP/1.0 and it is even simpler.
$ wc -l *
31 Makefile
910 config.c
314 control.c
34 css.h.in
257 http.h
100 httpd.8
1262 httpd.c
882 httpd.conf.5
843 httpd.h
19 js.h.in
218 log.c
319 logger.c
2563 parse.y
309 patterns.7
713 patterns.c
46 patterns.h
829 proc.c
1484 server.c
849 server_fcgi.c
826 server_file.c
1997 server_http.c
10 toheader.sed
14815 total
[1]: https://man.openbsd.org/httpd.8