We have server on Python and client + web service on Ruby. That works only if file from URL is less than 800 k. It seems like "socket.puts data" in a client works, but "output = socket.gets" - not. I think problem is in a Python part. For big files tests run "Connection reset by peer". Is it buffer size variable by default somewhere in a Python?
Could you add a little more information and code to your example?
Are you thinking about sock.recv_into() which takes a buffer and buffer size as arguments?  Alternately, are you hitting a timeout issue by failing to have a keepalive on the Ruby side?
Guessing in advance of knowledge.
File size in Python server