cppsp: minor bugfixes

* properly handle 0-length responses
* close connection immediately when write errors occur