Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'mcs/class/System/System.Net/WebConnectionStream.cs')
-rw-r--r--mcs/class/System/System.Net/WebConnectionStream.cs15
1 files changed, 13 insertions, 2 deletions
diff --git a/mcs/class/System/System.Net/WebConnectionStream.cs b/mcs/class/System/System.Net/WebConnectionStream.cs
index 703f35d42b4..c609455f32f 100644
--- a/mcs/class/System/System.Net/WebConnectionStream.cs
+++ b/mcs/class/System/System.Net/WebConnectionStream.cs
@@ -57,6 +57,7 @@ namespace System.Net
byte [] headers;
bool disposed;
bool headersSent;
+ bool forceCompletion;
public WebConnectionStream (WebConnection cnc)
{
@@ -113,9 +114,15 @@ namespace System.Net
get { return (int) writeBuffer.Length; }
}
+ internal void ForceCompletion ()
+ {
+ forceCompletion = true;
+ }
+
internal void CheckComplete ()
{
- if (!nextReadCalled && readBufferSize - readBufferOffset == contentLength) {
+ bool nrc = nextReadCalled;
+ if (forceCompletion || (!nrc && readBufferSize - readBufferOffset == contentLength)) {
nextReadCalled = true;
cnc.NextRead ();
}
@@ -151,8 +158,12 @@ namespace System.Net
} else {
new_size = contentLength - totalRead;
b = new byte [new_size];
- if (readBuffer != null && diff > 0)
+ if (readBuffer != null && diff > 0) {
+ if (diff > new_size)
+ diff = new_size;
+
Buffer.BlockCopy (readBuffer, readBufferOffset, b, 0, diff);
+ }
int remaining = new_size - diff;
int r = -1;