fix for issue 48: custom error pages. Supports -error_file directory as per http://code.google.com/p/mongoose/issues/detail?id=48#c6 . Error files are served via the generic mg_produce_nested_page() API - done that way so custom event callbacks can (re)use the same logic. Since mg_produce_nested_page() uses the internal handle_request() mongoose page serving engine, support for CGI and SSI-based error pages is implicit.

The fix also extends the SSI command set with basic support for the SSI 'echo' command ( http://www.ssi-developer.net/ssi/ssi-echo.shtml ) so that the included sample error pages ( /error/error.shtml and /error/404.html ) can print the HTTP response code and accompanying error message text.

Using $E in the error_file URLs is replaced by the error status code, e.g.
  -error_file=404=/error/fnf.html;0=/error/$E.shtml
would try to serve '/error/fnf.html' for a 404 error, and '/error/501.shtml' for a 501 error.
CGI: revert and correct the 'CGI interpreter with spaces in path' issue: issue 77 indicates that you also may want to specify command line arguments with the CGI interpreter like so: '-I interp.exe -opt1 -op2' so we should be able to support '-I '"path to interp.exe" -r -v', however, Windows does NOT correctly process single quotes that way, so you MUST specify [-I "'path to interp.exe' -opt1 -opt2"] and then the single quotes in there will screw things up very badly at the time of CreateProcess, effectively making every run fail immediately. The 'solution' is to monitor the set_option logic and 'transform' any single quotes to double quotes around any incoming CGI interpreter path.

Of course, this new fix/kludge does NOT solve matters when one of those interpreter commandline options also needs double quotes; in that case the only way forward is using a config file, rather than specifying these directly on the command line.

The previous tweak has been reverted because it would break the possibility to pass arguments with the binary in the CGI interpreter option as it would surround the entire thing with double quotes, which is another wrong.
CGI/SSI echo fix: check whether the CGI env.var collection has been created complete - if not, overflow occurred and we should abort the mission.
we should not be able to produce subpages from within subpages (i.e. nest errors) and producing a subpage (~ custom error page, but it might have other uses) should result in an API error return code when a (nested) error occurred.

Sample scenario: custom error page uses SSI; error page is invoked but the SSI b0rks due to some error, say var.set overflow due to overlarge original request URI and SSI echo var=... in there, so the custom error SSI page production fails; with this fix such is identifiable as the mg_produce_nested_page() API will now return a non-zero value signaling failure.
Meanwhile, the original (outer level) send_http_error(), which started all this, will also detect this error, but it will NOT produce the default simple HTTP reponse instead as the SSI handler already wrote at least part of the page or at least some headers, so the second !mg_have_headers_been_sent(conn) check in there will force the HTTP output skip.

mg_produce_nested_page() itself is also only really useful when nothing has been written to the socket yet, as otherwise you'd end up with a set of HTTP headers halfway through another (outer) response.
introducing the mg_remove_response_header() and mg_add_response_header() APIs as precursors of the chunked transfer logic - we'll need the ability to tweak headers.
second phase of mg_add_response_header() API introduction: now (almost) everybody uses it (refactoring) and performs a mg_write_headers() when done.
CGI: always close both pipe() handles, also when the spawn_process itself fails. (Otherwise you're running out of handles after many requests.) Prepare the FILE instances for each pipe before spawning: the latter is the most costly operation which you don't want to abort/kill because a basic fdopen() failed (probably because you were running out of handles to use ;-) )
replaced mg_write_headers() API with mg_write_http_response_head() which writes the entire HTTP response header if it hasn't been sent already. Also fixed the 100-Continue logic and the 'reason text' logic in send_http_error() when the event callback might have altered the status_code.
inspired by http://code.google.com/p/mongoose/issues/detail?id=244#c1 : mix stderr output of CGI with regular output; only do so when the regular output is plain text or HTML (it's no use echoing stderr error messages into CSS or JS output, f.e., and even worse to insert it into a binary data stream).
ws police
fix a copy-pasta mistake in CGI stderr handling, resolved a 'probably uninitialized p' compiler warning, refactored the CGI stderr-to-log-echo when stderr couldn't be sent to the client --> send_data_to_log()
MSVC2010: turn on full optimization in Release mode targets; shut up compiler warning.
fix for crash in custom error page handler when producing an error page for a completely clobbered request (request_len == 0/-1)
show current directory when document_root check fails; helps the user diagnosing what's wrong.
do NOT go through the effort of providing a custom error page when we know the client connection is totally clobbered already.
optimized error processing (prevents one major DoS attack line: requesting many erroneous pages, queueing the custom error page logic for connections which have already been severed): mark the socket when a read or write error occurred and forego the custom error page creation logic (which MAY be heavy when, for instance, CGI is involved) when the client connection already has a (fatal) I/O error: chances are extremely slim that writing the error data will succeed after such an error, so we try only the most basic (and fast) error response output.
several major bugfixes related to the new mg_add/remove_response_header() APIs. Plus CGI fixes given the new code which always assumes that the three fd_stdin/out/err handles are properly closed by the spawn_process() call.
Using BUFSIZ->16384 buffer size for the headers returned by CGI. BUFSIZ may be too small, e.g. 512
always use ERRNO (macro) instead of errno/GetLastError
add basic md README for github; start off with it being the rendered man page.