GetResponse() returns 0 when it need more data, not -1
authorGonzalo Paniagua Javier <gonzalo.mono@gmail.com>
Mon, 16 Jul 2012 17:51:17 +0000 (13:51 -0400)
committerGonzalo Paniagua Javier <gonzalo.mono@gmail.com>
Mon, 16 Jul 2012 17:51:17 +0000 (13:51 -0400)
GetResponse() returns 0 to signal that it needs more data to complete
while -1 signals an error processing the data.

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

index 0c828cd30c0b98c42d6f9dc1616255f581036630..33f8dc54cac5f5c56ca2570552321916bd5f8605 100644 (file)
@@ -560,7 +560,7 @@ namespace System.Net
                                if (readState == ReadState.None) {
                                        lineok = ReadLine (buffer, ref pos, max, ref line);
                                        if (!lineok)
-                                               return -1;
+                                               return 0;
 
                                        if (line == null) {
                                                emptyFirstLine = true;
@@ -621,7 +621,7 @@ namespace System.Net
                                        }
 
                                        if (!finished)
-                                               return -1;
+                                               return 0;
 
                                        foreach (string s in headers)
                                                Data.Headers.SetInternal (s);