<story><title>Show HN: A little web server in C</title><url>https://github.com/robdelacruz/lkwebserver</url><text>A little web server written in C for Linux.&lt;p&gt;Supports: CGI, Reverse Proxy.&lt;p&gt;Single threaded using I&amp;#x2F;O multiplexing (select).</text></story><parent_chain><item><author>skulk</author><text>Cool project, but this project demonstrates the reason I&amp;#x27;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:&lt;p&gt;&lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;github.com&amp;#x2F;robdelacruz&amp;#x2F;lkwebserver&amp;#x2F;blob&amp;#x2F;main&amp;#x2F;lkstring.c&quot;&gt;https:&amp;#x2F;&amp;#x2F;github.com&amp;#x2F;robdelacruz&amp;#x2F;lkwebserver&amp;#x2F;blob&amp;#x2F;main&amp;#x2F;lkstrin...&lt;/a&gt;&lt;p&gt;It&amp;#x27;s fun to write this (and read others&amp;#x27; versions) the first 3 or 4 times, but it gets old quickly.</text></item></parent_chain><comment><author>userbinator</author><text>That&amp;#x27;s the &amp;quot;lazy, dumb&amp;quot; way of doing it --- write another string library. A much better way is to design your algorithms so they need a minimum of string manipulation, which is unfortunately on the more difficult side for text-based protocols like HTTP.&lt;p&gt;Personally, I wish HTTP messages were closer to something like ASN.1 DER; there&amp;#x27;s little in the way of string manipulation necessary for those, and all the lengths are prefixes instead of &amp;quot;try to find the terminator&amp;quot; (and don&amp;#x27;t forget to not run past the end of the buffer...)</text></comment>
<story><title>Show HN: A little web server in C</title><url>https://github.com/robdelacruz/lkwebserver</url><text>A little web server written in C for Linux.&lt;p&gt;Supports: CGI, Reverse Proxy.&lt;p&gt;Single threaded using I&amp;#x2F;O multiplexing (select).</text></story><parent_chain><item><author>skulk</author><text>Cool project, but this project demonstrates the reason I&amp;#x27;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:&lt;p&gt;&lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;github.com&amp;#x2F;robdelacruz&amp;#x2F;lkwebserver&amp;#x2F;blob&amp;#x2F;main&amp;#x2F;lkstring.c&quot;&gt;https:&amp;#x2F;&amp;#x2F;github.com&amp;#x2F;robdelacruz&amp;#x2F;lkwebserver&amp;#x2F;blob&amp;#x2F;main&amp;#x2F;lkstrin...&lt;/a&gt;&lt;p&gt;It&amp;#x27;s fun to write this (and read others&amp;#x27; versions) the first 3 or 4 times, but it gets old quickly.</text></item></parent_chain><comment><author>alex_lav</author><text>This is how I felt writing Go. Writing the same nongeneric functions with slightly different type signatures and&amp;#x2F;or endless interfaces and&amp;#x2F;or interface{} signatures. It&amp;#x27;s 2023.</text></comment>