[Python-Dev] httplib

Greg Stein gstein@lyra.org
Sat, 3 Jun 2000 16:06:07 -0700 (PDT)


On Sat, 3 Jun 2000, Greg Stein wrote:
> I found the problem. Sneaky...
> 
> sock.makefile() does a dup() on the file descriptor, then opens a FILE*
> with that. See it coming yet? ...
> 
> FILE* is a buffered thingy. stdio chunked in a block of data on the dup'd
> file descriptor. When we went to grab another chunk on the *original*
> descriptor, we missed input [that is now sitting in the FILE* buffer].
> 
> Answer: change the .makefile() in getreply() to:
> 
>     file = self.sock.makefile('rb', 0)
> 
> This problem is going to affect the original httplib, too. IMO, we're
> about to replace the sucker, so no worries...

Oh... actually it won't affect the original since that doesn't pipeline
requests.

-- 
Greg Stein, http://www.lyra.org/