Kristján Valur Jónsson <krist...@ccpgames.com> added the comment: Hi, I'm reawakening this because http://bugs.python.org/issue4879 needs to be ported to py3k. In py3k, a socket.fileobject() is still created with bufsize(0), although now the reasoning is different:
def __init__(self, sock, debuglevel=0, strict=0, method=None): # XXX If the response includes a content-length header, we # need to make sure that the client doesn't read more than the # specified number of bytes. If it does, it will block until # the server times out and closes the connection. (The only # applies to HTTP/1.1 connections.) Since some clients access # self.fp directly rather than calling read(), this is a little # tricky. self.fp = sock.makefile("rb", 0) I think that this is just a translation of the old comment, i.e. a warning that some people may choose to call .recv() on the underlying socket. Now, this should be far more difficult now, with the newfangled IO library and all, and since the sock.makefile() is now a SocketIO object which inherits from RawIOBase and all that. It's tricky to excracth the socket to do .recv() on it. So, I don't think we need to fear buffering for readline() anymore. Or, is the comment about someone doing a HTTPResponse.fp.read() in stead of a HTTPResponse.read()? In that case, I don't see the problem. Of course, anyone reading N characters from a socket stream may cause blocking. My proposal is to remove the comment above and use default buffering for the fileobject. Any thoughts? ---------- versions: +Python 3.1 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue4448> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com