4 ms·
you may be surprised how easy it is to write a http server that replies with html in C... its all just text going over sockets after all. i did it myself a lot
by jheriko 11y ago
you may be surprised how easy it is to write a http server that replies with html in C... its all just text going over sockets after all.
i did it myself a lot a long time ago by teaching myself, but you are right that using some full featured server and some high level language targetting web development has much more convenience, especially if you care about rich features and security.
- teaearlgraycold 11y agoThey claim it's got no dependencies though - so somehow they've got their own sockets implementation crammed in there.
- jheriko 11y agoi doubt it tbh, i bet he means no /3rd party/ dependencies other than the ones that came with the development environment. the C standard library and the usual set of headers and os functions that you get in most C environments is not what people tend to mean by dependencies....
- fit2rule 11y agoPOSIX? Its quite possible to have a C-based sockets-/signals- handler in a single source file, say .. 48k lines of code or so. I've seen many robust system daemons with just such an implementation. 3rd party dependencies are definitely an issue that very few languages have managed to promote, since languages either want to promote (or demote) such circumstances as mass-package (i.e. mass usage of the language) in a broad commercial/industrial/social context. But its not naive to write such things as a Wiki and a Blog in C. Just .. dangerous. I imagine there are, however, some good 3rd-party C libraries available to do less-dangerous implementations, however...
- jheriko 11y agoit never seems to actually be posix, but yeah that kind of stuff. it is interesting stuff.
- ronsor 11y agoIt's served from another httpd server, no sockets library was used. Just simple file I/O, string.h, and its own implementation of hashing
- emcrazyone 11y agoIt is relatively easy. I've done it myself many moons ago. I've followed Steve off and on over the years. He seems to prefer C++ as a web-app language so much so that he blogs about it and other things. I like his stuff. I discovered Steve through Joel On Software some years ago. If memory serves me, I think at one time he was publishing a Web CMS type engine written in C++ but I could have him confused with someone else (been awhile) Here is his site: http://stevehanov.ca/blog/index.php?id=95 http://stevehanov.ca/blog/index.php?id=95