<br><br><div class="gmail_quote">On Tue, Apr 15, 2008 at 12:19 AM, Curt Hagenlocher &lt;<a href="mailto:curt@hagenlocher.org">curt@hagenlocher.org</a>&gt; wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="Ih2E3d">On Mon, Apr 14, 2008 at 2:29 PM, Ralf Schmitt &lt;<a href="mailto:schmir@gmail.com">schmir@gmail.com</a>&gt; wrote:<br>
&gt;<br>
&gt; Sorry to reply on the mailing list. But this change is wrong.<br>
&gt; e.g. if you&#39;re using a buffer size of 16 bytes and try to read 256 bytes, it<br>
&gt; should call recv with a value of 256 and not call recv 16 times with a value<br>
&gt; of 16.<br>
&gt; However, there should be an upper limit (as shown by the imap bug).<br>
<br>
</div>There is an upper limit. &nbsp;It&#39;s called &quot;the buffer size&quot;. &nbsp;If someone<br>
specifies a buffer size of 16 bytes, it means &quot;read 16 bytes at a<br>
time&quot;. &nbsp;I don&#39;t know why someone would want such a small buffer size,<br>
but presumably they have their reasons.<br>
</blockquote><div><br>No, I don&#39;t agree. To me buffer size means buffer up to buffer_size bytes in memory.<br>It does not mean that it should read only buffer_size bytes at once when asked to read more bytes than buffer size.<br>
<br>&nbsp;The upper limit I was talking about is the buffer size limit of the operating system, i.e. the operating system will at a maximum return N bytes from recv call. It doesn&#39;t make sense to ask for more then, and the original problem with imaplip asking for 10MB of data and then realloc&#39;ing that buffer would be gone.<br>
<br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
The only reason &quot;min&quot; is a problem is that there&#39;s standard library<br>
code passing a zero to socket.makefile, which gets turned into a<br>
bufsize of 1 by the constructor. &nbsp;I actually agree with Bill Janssen<br>
-- __init__ is where the real problem lies. &nbsp;But I think the change to<br>
read() is safer.<br>
<font color="#888888"></font></blockquote><div><br>again no, if I pass in 4 as buffer size, I don&#39;t expect the system to make 1024 calls to recv when I want to read 4096 bytes.<br><br>Regards,<br>- Ralf<br><br></div>
</div>