HTTPlib

HTTPlib

This is a simple library that handles HTTP, as described in RFC 2616, and other similar protocols. It is by no means complete, some features are missing, others are partially implemented and there is a good possibility of errors in protocol features. Nevertheless I have used it in a number of projects professionally; it is complete enough to have handled everything I have ever needed of it over the last decade and a half and to do so quite robustly.

A typical use might be to replace SCGI FastCGI or in an existing application so that it uses HTTP directly. The main web server may then be configured as a reverse proxy in the same way as it might be used with, say, Tomcat applications.

I was motivated to write this library since I have struggled to use the FastCGI library in threaded code, the two do not seem to mesh together that well. I also tried SCGI which, although easy to implement in an application, is poorly supported by mainstream HTTP servers.

I believe this code is useful enough to be of benefit to others so I’ve decided to release it, as-is, under the Lesser GPL. Currently the code is undocumented, maybe I will eventually document the API. Hopefully, the code is modular enough to easily understand and be immediately useful. As always, contributions and bug fixes are welcome.

Why not an existing alternative?

Since there are a few similar open source projects available now, one might ask ‘why another HTTP library?’ This code was first written about fifteen years ago; as nothing satisfactory that I could find existed at the time and I needed to embed HTTP access into an application. Since then, I could have moved over to a more established open source project but familiarity meant I stuck with this and so it has been tweaked and evolved since then. Development has been rather arbitrary and haphazard driven by my needs at a given moment in time.

Postscript

My remark about SCGI is no longer true, compared to when I originally wrote this page. And now there is uWSGI too!