bool allowBuffering = true;
X509CertificateCollection certificates;
string connectionGroup;
+ bool haveContentLength;
long contentLength = -1;
HttpContinueDelegate continueDelegate;
CookieContainer cookieContainer;
throw new ArgumentOutOfRangeException ("value", "Content-Length must be >= 0");
contentLength = value;
+ haveContentLength = true;
}
}
contentLength = -1;
//bodyBufferLength = 0;
//bodyBuffer = null;
+ if (sendChunked) {
+ sendChunked = false;
+ webHeaders.RemoveInternal ("Transfer-Encoding");
+ }
uriString = webResponse.Headers ["Location"];
if (uriString == null)
if (contentLength > 0)
continue100 = true;
- if (gotRequestStream || contentLength > 0)
+ if (haveContentLength || gotRequestStream || contentLength > 0)
webHeaders.SetInternal ("Content-Length", contentLength.ToString ());
}
webHeaders.RemoveInternal ("Transfer-Encoding");
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;