mcavage/node-restify — pull request #142 by davepacheco (2012-05-11 22:55:54+00:00)
Title: workaround joyent/node#3257

This change works around this bug:

https://github.com/joyent/node/issues/3257

When running restify over a UDS, I was seeing occasional cases where the JSON client would bomb out with EPIPE because the server closed the socket after it fully received the body (which it can do because it knows content-length and so knows when the request is done) but before the client actually called end(). As described in that issue, Node normally handles this, but there's a race where it doesn't detect that the socket is closed until it does the zero-byte write as part of the end(), at which point the client gets EPIPE. This change avoids that problem by doing the write with the "end".