This should improve the handling of EOF on stdin and adding some new unit tests to malformed requests.