mitmproxy/netlib — pull request #16 by mhils (2013-06-17 15:10:56+00:00)
Title: attempt to fix 'half-duplex' TCP close sequence

A attempt to fix the socket bug I encountered on windows.

To quote RFC 1122: 4.2.2.13
>A host MAY implement a "half-duplex" TCP close sequence, so that an application that has called CLOSE cannot continue to read data from the connection. If such a host issues a CLOSE call **while received data is still pending in TCP**, or if new data is received after CLOSE is called, its TCP SHOULD send a RST to show that data was lost.

This looks like the bug we are observing. I implemented the solution proposed here:
http://blog.netherlabs.nl/articles/2009/01/18/the-ultimate-so_linger-page-or-why-is-my-tcp-not-reliable

@cortesi, does this have any negative impact on OSX or Linux?