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:
authorGonzalo Paniagua Javier <gonzalo.mono@gmail.com>2006-05-07 00:47:15 +0400
committerGonzalo Paniagua Javier <gonzalo.mono@gmail.com>2006-05-07 00:47:15 +0400
commitb71dfbe5bf0430129a4e3b5c0e001e1b8b2e3f24 (patch)
treef9e7a2e6d1b00253bba823779fee27bea788301c
parent54775ae1a156960c60b8a0610cb9eec16742e882 (diff)
2006-05-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* ResponseStream.cs: * HttpListenerResponse.cs: allow 0 length POST. Patch by Horst Reiterer. Closes bug #78316. svn path=/branches/mono-1-1-13/mcs/; revision=60366
-rw-r--r--mcs/class/System/System.Net/ChangeLog6
-rw-r--r--mcs/class/System/System.Net/HttpListenerResponse.cs16
-rw-r--r--mcs/class/System/System.Net/ResponseStream.cs7
3 files changed, 24 insertions, 5 deletions
diff --git a/mcs/class/System/System.Net/ChangeLog b/mcs/class/System/System.Net/ChangeLog
index b97a75b2dc9..5795ffce0ce 100644
--- a/mcs/class/System/System.Net/ChangeLog
+++ b/mcs/class/System/System.Net/ChangeLog
@@ -1,3 +1,9 @@
+2006-05-06 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * ResponseStream.cs:
+ * HttpListenerResponse.cs: allow 0 length POST. Patch by Horst Reiterer.
+ Closes bug #78316.
+
2006-04-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* WebConnection.cs: reset the challenge and the status code when
diff --git a/mcs/class/System/System.Net/HttpListenerResponse.cs b/mcs/class/System/System.Net/HttpListenerResponse.cs
index 20785e92e1c..a12d0173195 100644
--- a/mcs/class/System/System.Net/HttpListenerResponse.cs
+++ b/mcs/class/System/System.Net/HttpListenerResponse.cs
@@ -393,7 +393,7 @@ namespace System.Net {
return false;
}
- internal void SendHeaders ()
+ internal void SendHeaders (bool closing)
{
//TODO: When do we send KeepAlive?
//TODO: send cookies
@@ -418,8 +418,15 @@ namespace System.Net {
if (headers ["Date"] == null)
headers.SetInternal ("Date", DateTime.UtcNow.ToString ("r", inv));
- if (!chunked && cl_set)
- headers.SetInternal ("Content-Length", content_length.ToString (inv));
+ if (!chunked) {
+ if (!cl_set && closing) {
+ cl_set = true;
+ content_length = 0;
+ }
+
+ if (cl_set)
+ headers.SetInternal ("Content-Length", content_length.ToString (inv));
+ }
Version v = context.Request.ProtocolVersion;
if (!cl_set && !chunked && v >= HttpVersion.Version11)
@@ -465,6 +472,9 @@ namespace System.Net {
writer.Flush ();
// Perf.: use TCP_CORK if we're writing more?
int preamble = encoding.GetPreamble ().Length;
+ if (output_stream == null)
+ output_stream = context.Connection.GetResponseStream ();
+
output_stream.InternalWrite (ms.GetBuffer (), 0 + preamble, (int) ms.Length - preamble);
HeadersSent = true;
}
diff --git a/mcs/class/System/System.Net/ResponseStream.cs b/mcs/class/System/System.Net/ResponseStream.cs
index 7cddd017143..104aef3173d 100644
--- a/mcs/class/System/System.Net/ResponseStream.cs
+++ b/mcs/class/System/System.Net/ResponseStream.cs
@@ -74,6 +74,9 @@ namespace System.Net {
{
if (disposed == false) {
disposed = true;
+ if (response.HeadersSent == false)
+ response.SendHeaders (true);
+
if (response.SendChunked && !trailer_sent) {
WriteChunkSize (0, true);
trailer_sent = true;
@@ -111,7 +114,7 @@ namespace System.Net {
throw new ObjectDisposedException (GetType ().ToString ());
if (response.HeadersSent == false)
- response.SendHeaders ();
+ response.SendHeaders (false);
bool chunked = response.SendChunked;
try {
@@ -132,7 +135,7 @@ namespace System.Net {
throw new ObjectDisposedException (GetType ().ToString ());
if (response.HeadersSent == false)
- response.SendHeaders ();
+ response.SendHeaders (false);
try {
if (response.SendChunked)