← Back to context

Comment by byuu

11 years ago

> why worry about things like your web server?

I want to do different things that haven't really been done before.

I want to write my site in C++ instead of PHP. In my own case, it's not as much about speed (that's a free benefit), it's more about the language: I favor the strong typing, compile-time checking and stronger inheritance model. What I envision is that I have C++ source files. I upload one, the server sees there is no binary for that page, and invokes Clang to build it when the page is accessed, and caches the binary for future use. Once I upload the source again, and the modified timestamp is newer than the binary, it rebuilds the cached binary.

I also have a lot of parsing built-in to the server itself to do things like Markdown/Stylus, but optimized for what I need (my syntax generates automatic anchors and TOCs for sections, great for documentation.)

I also plan to code up a forum so that I don't have to run phpBB, and thus don't have to run PHP and Apache.

I can also test my server on my local desktop without having to install PHP+Apache. I just open my server binary, and go to localhost in my browser.

> in 2014 if you develop a web server that doesn't work with HTTPS, it's pretty much dead on arrival.

Exactly! That's why I want to support TLS. Yet they've made that as difficult as is humanly possible, it seems.

> This sounds like exactly what you need.

Yes, libtls is exactly what I need, and mentioned before. Its limitations are that it's not available in my package manager, and hasn't had a lot of real-world testing yet (though I trust the OpenBSD team.)

In 6-12 months once this is easily usable on Windows, OS X, Linux and FreeBSD, I'll definitely be giving it a shot.

But isn't it sad that it's 2014 and a library with this level of simplicity only just came out 2-3 weeks ago?

Got it. Well, while I can't see why you'd want C++ of all languages for this (Haskell seems like what you are really looking for), apache might actually be your friend here. At an old $WORK we had a number of web applications written in C++ and C (yup!), as apache modules. This way apache does most of the boring stuff such as header parsing, routing requests, config files, etc. and you do just the functional parts of your site/app. Then again, this was one of the slowest and most error-prone ways to code this up, and the guys working on this were full time C/C++ devs.