Forgot this
authorGonzalo Paniagua Javier <gonzalo.mono@gmail.com>
Wed, 10 Nov 2004 00:33:06 +0000 (00:33 -0000)
committerGonzalo Paniagua Javier <gonzalo.mono@gmail.com>
Wed, 10 Nov 2004 00:33:06 +0000 (00:33 -0000)
svn path=/trunk/mcs/; revision=35935

mcs/class/System/System.Net/WebConnection.cs

index 30b820410cd6cc92deb52db24d131229d13a9101..9c13276b150351b640ba319015f9fa44f2aa1be2 100644 (file)
@@ -667,10 +667,12 @@ namespace System.Net
                                        nbytes = nstream.EndRead (wr.InnerAsyncResult);
 
                                chunkStream.WriteAndReadBack (wr.Buffer, wr.Offset, wr.Size, ref nbytes);
-                               if (nbytes < wr.Size && chunkStream.WantMore) {
+                               while (nbytes == 0 && chunkStream.WantMore) {
                                        int size = chunkStream.ChunkLeft;
-                                       if (size < 0) // not read chunk size yet
+                                       if (size <= 0) // not read chunk size yet
                                                size = 1024;
+                                       else if (size > 16384)
+                                               size = 16384;
 
                                        byte [] morebytes = new byte [size];
                                        int nread;