<div class="gmail_quote">2009/2/7 John Arbash Meinel <span dir="ltr">&lt;<a href="mailto:john@arbash-meinel.com">john@arbash-meinel.com</a>&gt;</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&#39;t believe we ever use that functionality.<br>
<br>
However, in httplib, the SSLFile that they use to wrap the ssl<br>
connection doesn&#39;t have a size parameter.<br>
<br>
We don&#39;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 &#39;bzrlib/transport/http/_urllib2_wrappers.py&#39;<br>
- --- bzrlib/transport/http/_urllib2_wrappers.py &nbsp;2009-01-29 14:27:28 +0000<br>
</div>+++ bzrlib/transport/http/_urllib2_wrappers.py &nbsp;2009-02-07 21:38:59 +0000<br>
@@ -80,7 +80,16 @@<br>
<div class="Ih2E3d"> &nbsp; &nbsp; &nbsp; &nbsp; return s<br>
<br>
 &nbsp; &nbsp; def readline(self, size=-1):<br>
- - &nbsp; &nbsp; &nbsp; &nbsp;s = self.filesock.readline(size)<br>
</div>+ &nbsp; &nbsp; &nbsp; &nbsp;if size &lt; 0:<br>
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;# Unfortunately in python 2.5 (and others?)<br>
sslsocket.makefile()<br>
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;# returns an SSLFile wrapper which does not support the size<br>
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;# argument to readline. Since most clients don&#39;t need it<br>
anyway, we<br>
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;# workaround that fact by only supplying it if the client<br>
actually<br>
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;# requested a specific size. (Which would still fail for<br>
SSLFile,<br>
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;# but that isn&#39;t our problem, as we don&#39;t use it.)<br>
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;s = self.filesock.readline()<br>
+ &nbsp; &nbsp; &nbsp; &nbsp;else:<br>
+ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;s = self.filesock.readline(size)<br>
<div class="Ih2E3d"> &nbsp; &nbsp; &nbsp; &nbsp; self._report_activity(len(s), &#39;read&#39;)<br>
 &nbsp; &nbsp; &nbsp; &nbsp; return s<br>
<br>
</div>So I&#39;m positive that bzrlib doesn&#39;t ever use &quot;readline(size)&quot; because<br>
otherwise https would never have worked, and it is only because<br>
Vincent&#39;s recent wrapper always supplies that value that it started<br>
breaking.<br>
<br>
Technically it is a bug in httplib&#39;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&#39;m quite surprised that we don&#39;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&nbsp; to make sure that it doesn&#39;t break all of a sunday when nobody is looking.<br><br></div></div>regards<br>marius<br>