Correctly close connection and trigger exception on malformed HTTP reque...

...st