Prevent data loss when attaching to container
Prevent data loss when attaching to container

The use of buffering within httplib.HTTPResponse can cause data
to be lost. socket.makefile() is called without a bufsize, which
causes a buffer to be used when recieving data. The attach
methods do a HTTP upgrade to tcp before the raw socket is using
to stream data from the container. The problem is that if the
container starts stream data while httplib/http.client is reading
the response to the attach request part of the data ends will end
up in the buffer of fileobject created within the HTTPResponse
object. This data is lost as after the attach request data is
read directly from the raw socket.

Signed-off-by: Chris Harris <a361e89d1eba6c570561222d75facbbf7aaeeafe@kitware.com>

youhong316/docker-py,funkyfuture/docker-py,vpetersson/docker-py,vdemeester/docker-py,youhong316/docker-py,vdemeester/docker-py,docker/docker-py,funkyfuture/docker-py,docker/docker-py,vpetersson/docker-py