Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Web dev in C

Name: Anonymous 2014-10-13 2:44

Who needs a huge server and scripting environment to run a simple site? Just open a socket, read until the second space, dump the requested file and close the socket.

Just think about all the electricity and time wasted because of wastefully starting Apache, parsing a complex config file each time, sending the script to PHP where it is parsed for the millionth time, generate the output, apply transformations to the headers, sending it out, keeping the socket open just in case there is another request, all for the convenience of not having to compile a script.

Name: Anonymous 2014-10-14 3:03

It's pretty fun.

I wrote a toy webapp with C and SQLite, but eventually got bogged down in Greenspun's Tenth.

I think that Plan 9 C could make it even nicer.

>>2
CGI
Who says you need to use CGI? Just listen on a socket and parse HAX /anus HTTP/1.1\r\n, it's not hard.

I've done exactly that in Java and C, and if anything it was easier than writing a CGI since I didn't have to dick around with environment variables.

process startup
So long as you use static linking, this will be pretty cheap because the image will be cached.

keep-alive
This is a valid point. I've never bothered, but it shouldn't be too much trouble to keep the thread/process handling each client alive to serve another request.

Of course, if you weren't careful about reaping them you could open yourself up to DoS.

>>6

My face when I wrote the world's shittiest half-of-a-textboard in C because I didn't trust myself to get all the shell expansions right.

It was terrible, but I'm pretty sure it was secure.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List