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:
authorMartin Baulig <martin.baulig@xamarin.com>2014-04-04 00:43:36 +0400
committerSebastien Pouliot <sebastien@xamarin.com>2014-04-18 22:27:00 +0400
commit526cac9d5a31f994020f7c9b8f57f883d024d063 (patch)
treedc1f8bcee4cda77f77c92d99d11cc6aeacb8e43b
parent193fb706f2e657c968838c9cbacda1a957025101 (diff)
[Http]: Clear the 'SendChunked' flag when redirecting.
-rw-r--r--mcs/class/System/System.Net/HttpWebRequest.cs8
-rw-r--r--mcs/class/System/System.Net/WebConnectionStream.cs7
2 files changed, 14 insertions, 1 deletions
diff --git a/mcs/class/System/System.Net/HttpWebRequest.cs b/mcs/class/System/System.Net/HttpWebRequest.cs
index e21e5ecc4d4..5e1c8529632 100644
--- a/mcs/class/System/System.Net/HttpWebRequest.cs
+++ b/mcs/class/System/System.Net/HttpWebRequest.cs
@@ -56,6 +56,7 @@ namespace System.Net
bool allowBuffering = true;
X509CertificateCollection certificates;
string connectionGroup;
+ bool haveContentLength;
long contentLength = -1;
HttpContinueDelegate continueDelegate;
CookieContainer cookieContainer;
@@ -277,6 +278,7 @@ namespace System.Net
throw new ArgumentOutOfRangeException ("value", "Content-Length must be >= 0");
contentLength = value;
+ haveContentLength = true;
}
}
@@ -1153,6 +1155,10 @@ namespace System.Net
contentLength = -1;
//bodyBufferLength = 0;
//bodyBuffer = null;
+ if (sendChunked) {
+ sendChunked = false;
+ webHeaders.RemoveInternal ("Transfer-Encoding");
+ }
uriString = webResponse.Headers ["Location"];
if (uriString == null)
@@ -1187,7 +1193,7 @@ namespace System.Net
if (contentLength > 0)
continue100 = true;
- if (gotRequestStream || contentLength > 0)
+ if (haveContentLength || gotRequestStream || contentLength > 0)
webHeaders.SetInternal ("Content-Length", contentLength.ToString ());
}
webHeaders.RemoveInternal ("Transfer-Encoding");
diff --git a/mcs/class/System/System.Net/WebConnectionStream.cs b/mcs/class/System/System.Net/WebConnectionStream.cs
index c1b8084bdee..5a34a3d8124 100644
--- a/mcs/class/System/System.Net/WebConnectionStream.cs
+++ b/mcs/class/System/System.Net/WebConnectionStream.cs
@@ -514,6 +514,13 @@ namespace System.Net
Buffer.BlockCopy (buffer, offset, newBuffer, head.Length, size);
Buffer.BlockCopy (crlf, 0, newBuffer, head.Length + size, crlf.Length);
+ if (allowBuffering) {
+ if (writeBuffer == null)
+ writeBuffer = new MemoryStream ();
+ writeBuffer.Write (buffer, offset, size);
+ totalWritten += size;
+ }
+
buffer = newBuffer;
offset = 0;
size = chunkSize;