fix Win2K/XP support for srwlocks: applying patch by bel2125 ( http://code.google.com/p/mongoose/issues/detail?id=349#c54 ) with a slight adaptation: when USE_SRWLOCK #define ha been defined before, e.g. in makefile or project, than that will override the logic in the porting header.
SSI test pages: add header to show what they test (otherwise you're just left staring at ssi_start/_end words without comprehension when you're not wide awake and remembering the 'source code' of those ssi test pages exactly.
a bit of work on the custom error pages; the <base> tag in there is all-important as they can be served as replacement of any other page/request in any directory; when you see the biohazard image (SVG) then you'll at least know that the browser caught on to that <base> in there. (This makes these demo pages suitable for use as a base for custom error pages in real web sites. All you'll have to do is edit the content & styling then.)
fix bug in logfile path creation/formatting function - uncovered by unit_test.
fixup for a Windows thread-related race condition (see comments & official _beginthread() documentation) & barf a hairball when an illegal MAX_REQUEST_SIZE is specified.
add length to %[] logpath template formatter so that components can be restricted / widened through template configuration. Also fixups the path component sanitation for illegal formatters, etc. Added extra unit test cases to verify correct ~ desirable operation.
fix logic error in read_request() which would produce INVALID failure reports when the remote would send enough data to flood the entire buffer in one pull(): get_request_len() would not be called and hence no HTTP header would be detected, while there /would/ be one in the buffer.
fixed malfunction of the mg_README.html() logic when processing a connection where the peer isn't fully HTTP/1.1 compliant AND/OR did not send a Content-Length header along; incidentally the fix simplifies the mg_connect() logic a bit as we no longer need the 'magic value' INT64_MAX in conn::content_len to signal the read routine that an arbitrary, yet unknown, amount of data must be read from the socket.

Note that mg_read() will behave like pull() when in non-'Content-Length'-driven mode, i.e. read only as much data as is available or becomes available after a single wait. This means that mg_README.html() will wait for data to arrive if there's none yet, but once there is, it doesn't wait around any more to completely fill the buffer. This is only relevant for MG_NEW_REQUEST user code which expects mg_read() to always produce the number of bytes specified in its third argument, e.g. code like
  if (len != mg_README.html(conn, buf, len)) goto failure;
will fail for the afore-mentioned HTTP/1.0 or non-compliant HTTP/1.1 clients.
further fixes for the 'unspecified MAX_REQUEST_SIZE' issue.
tiny adjustment of the nested page production state, a.k.a. custom error page production code
improved error log message for when read_headers() fails.
fix: mg_write_http_response_head() should determine the proper 'Connection' header to send along, as this call may set/alter the Status Code so it's the point-of-no-return in terms of deciding whether to keep-alive or close.
couple of comment fixes, and extra sanity checks