
Hi Phil, Thanks for the comments. On 19 May 2010 15:44, Phil Endecott <spam_from_boost_dev@chezphil.org>wrote:
- I think you must have quite a few useful algorithms hidden as implementation details (e.g. URL %-encoding, base64, multipart MIME etc) that would be more useful if they were exposed. I.e. people could use them even if they didn't want to use the rest of the library.
I don't think these really belong in a "CGI" library, it doesn't feel right. boost::url::encode() and boost::url::decode() make more sense to me than boost::cgi::url_encode()... One of my goals is to expose more of the internals of the library to allow users to, for example have fine-grained control over I/O. As you say, there's no reason you should have to use it all.
- Saving uploaded files on the server's filesystem doesn't seem the right approach. Ideally, the handler would start before all of the uploaded file had been received, e.g. if I upload a 100 MB video, the server would check my username and the MIME type for the content and maybe look for a magic number at the start of the data stream so that it could send an error response without waiting for all of the data.
You can do some of what you want like so: fcgi::request request; // accept the request. request.load(fcgi::parse_env | parse_cookies); // check the username / password if (ok) request.load(fcgi::parse_post); // all MIME data has been read and parsed now... drat. I'll try and find some time to add finer-grained control in "parse_post", so mime parts can be interogated and dealt with individually.
- As I've said before, my preferred method when I don't want a process-per-request CGI is to use a stand-alone HTTP daemon and Apache's mod_proxy. It would be great if you could support this. I believe that asio has an HTTP server example; could that be coerced into doing this for you?
This would certainly be nice. I've not used mod_proxy before, I don't support you could send me an example configuration file to get it working? Those working on a HTTP networking library (cpp-netlib) have developed the asio example further, which is intriguing too. Cheers, Darren