> // Read in HTTP request headers Actually, that's not quite right. The HTTP headers are sent as environment variables. stdin gives you the POST variables - with the encoding given in the HTTP_CONTENT_TYPE envvar iirc. (that's where the Content-Type http header is found).
The most common type is urlencoded, so it's just like parsing the query string. The other one I handle is multipart - the encoding for file upload forms. Getting all that stuff out is the main benefit of a basic cgi library.. it's a bit of a pain to do yourself every time.
