<div class="gmail_quote">2009/2/7 John Arbash Meinel <span dir="ltr"><<a href="mailto:john@arbash-meinel.com">john@arbash-meinel.com</a>></span><br>...<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
It seems that by default file-like objects support readline(size). I<br>
don't believe we ever use that functionality.<br>
<br>
However, in httplib, the SSLFile that they use to wrap the ssl<br>
connection doesn't have a size parameter.<br>
<br>
We don't ever use the size argument, but if we want to be fully capable,<br>
then the fix would be:<br>
<div class="Ih2E3d"><br>
=== modified file 'bzrlib/transport/http/_urllib2_wrappers.py'<br>
- --- bzrlib/transport/http/_urllib2_wrappers.py 2009-01-29 14:27:28 +0000<br>
</div>+++ bzrlib/transport/http/_urllib2_wrappers.py 2009-02-07 21:38:59 +0000<br>
@@ -80,7 +80,16 @@<br>
<div class="Ih2E3d"> return s<br>
<br>
def readline(self, size=-1):<br>
- - s = self.filesock.readline(size)<br>
</div>+ if size < 0:<br>
+ # Unfortunately in python 2.5 (and others?)<br>
sslsocket.makefile()<br>
+ # returns an SSLFile wrapper which does not support the size<br>
+ # argument to readline. Since most clients don't need it<br>
anyway, we<br>
+ # workaround that fact by only supplying it if the client<br>
actually<br>
+ # requested a specific size. (Which would still fail for<br>
SSLFile,<br>
+ # but that isn't our problem, as we don't use it.)<br>
+ s = self.filesock.readline()<br>
+ else:<br>
+ s = self.filesock.readline(size)<br>
<div class="Ih2E3d"> self._report_activity(len(s), 'read')<br>
return s<br>
<br>
</div>So I'm positive that bzrlib doesn't ever use "readline(size)" because<br>
otherwise https would never have worked, and it is only because<br>
Vincent's recent wrapper always supplies that value that it started<br>
breaking.<br>
<br>
Technically it is a bug in httplib's SSLFile implementation, but it is<br>
one that we can just work around. Personally, I would be fine just<br>
removing the size parameter altogether.</blockquote><div><br>Are you planning to submit something?<br><br>I'm quite surprised that we don't have tests for this.<br>Maybe we should add a http blackbox test (extending http_utils.TestCaseWithWebserver or something else?)<br>
testing some basic workflow actions like<br>info, init, co, up, ci, push, pull, log to make sure that it doesn't break all of a sunday when nobody is looking.<br><br></div></div>regards<br>marius<br>