In previous versions of OTP, the following pattern had the expected behavior:
ok = ssl:send(Socket, Data), %% send response to client (block while sending)
ok = ssl:close(Socket). %% close socket after response has been send
It appears that in OTP 21.2 this behavior has changed such that the Data does not get sent to the client prior to closing the socket.
This can be observed in the mochiweb test suite: https://travis-ci.org/mochi/mochiweb/builds/478656646
For this PR https://github.com/mochi/mochiweb/pull/210