it looks like someone broke http:// in dev
John Arbash Meinel
john at arbash-meinel.com
Sat Feb 7 21:40:28 GMT 2009
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
...
> Certainly it is Vincent's new code that is the problem. I wonder if
> 'readline' is ever supposed to take a 'size' argument.
>
>
> maybe a different python version?
No, it seems to be https versus http. I just checked and everything
works just fine for http.
It seems that by default file-like objects support readline(size). I
don't believe we ever use that functionality.
However, in httplib, the SSLFile that they use to wrap the ssl
connection doesn't have a size parameter.
We don't ever use the size argument, but if we want to be fully capable,
then the fix would be:
=== modified file 'bzrlib/transport/http/_urllib2_wrappers.py'
- --- bzrlib/transport/http/_urllib2_wrappers.py 2009-01-29 14:27:28 +0000
+++ bzrlib/transport/http/_urllib2_wrappers.py 2009-02-07 21:38:59 +0000
@@ -80,7 +80,16 @@
return s
def readline(self, size=-1):
- - s = self.filesock.readline(size)
+ if size < 0:
+ # Unfortunately in python 2.5 (and others?)
sslsocket.makefile()
+ # returns an SSLFile wrapper which does not support the size
+ # argument to readline. Since most clients don't need it
anyway, we
+ # workaround that fact by only supplying it if the client
actually
+ # requested a specific size. (Which would still fail for
SSLFile,
+ # but that isn't our problem, as we don't use it.)
+ s = self.filesock.readline()
+ else:
+ s = self.filesock.readline(size)
self._report_activity(len(s), 'read')
return s
So I'm positive that bzrlib doesn't ever use "readline(size)" because
otherwise https would never have worked, and it is only because
Vincent's recent wrapper always supplies that value that it started
breaking.
Technically it is a bug in httplib's SSLFile implementation, but it is
one that we can just work around. Personally, I would be fine just
removing the size parameter altogether.
John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iEYEARECAAYFAkmN/8wACgkQJdeBCYSNAANSpgCePCpXs+cy3oNdDvbCpr2ar2Ba
9iUAoJB/fTmTQjD6TJ8g9W2Jrd3m9pWy
=YI0S
-----END PGP SIGNATURE-----
More information about the bazaar
mailing list