This updates #18, more correctly this time. This is a new pull requests github didn't pull the latest commit into that one.
Suppress 400 if client disconnected
Allow for error messages that have line numbers
On bad_request, go through _write_psgi_response even if sending nothi…
Just a thought - is it possible to write a unit test for this?
Sure, I've added one (845ceda) that tests that empty or incomplete-header requests followed by a shutdown(2) call cause Twiggy to not respond with anything. This doesn't cover the case where the client calls close(2), but since both events are seen as PIPE signals on the server side, that should be ok. A test that actually watches the wire with tcpdump or something (which is how I noticed this originally) seems rather more complicated than necessary.