X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mcs%2Fclass%2FSystem.Runtime.Remoting%2FMonoHttp%2FHttpListenerResponse.cs;fp=mcs%2Fclass%2FSystem.Runtime.Remoting%2FMonoHttp%2FHttpListenerResponse.cs;h=dc3bdbca5a741d36cb73848ed3e4bc0842b437b9;hb=7c6c3ba73b50ff139cbae3cbb853797fc66c2236;hp=7ddb646266166972defd3c763c6c7ec70128e066;hpb=f1c1d40b445132945ac73c18e2dce1758a19e0b1;p=mono.git diff --git a/mcs/class/System.Runtime.Remoting/MonoHttp/HttpListenerResponse.cs b/mcs/class/System.Runtime.Remoting/MonoHttp/HttpListenerResponse.cs index 7ddb6462661..dc3bdbca5a7 100644 --- a/mcs/class/System.Runtime.Remoting/MonoHttp/HttpListenerResponse.cs +++ b/mcs/class/System.Runtime.Remoting/MonoHttp/HttpListenerResponse.cs @@ -394,10 +394,9 @@ using System; using System.Net; namespace MonoHttp { return false; } - internal void SendHeaders (bool closing) + internal void SendHeaders (bool closing, MemoryStream ms) { //TODO: When do we send KeepAlive? - MemoryStream ms = new MemoryStream (); Encoding encoding = content_encoding; if (encoding == null) encoding = Encoding.Default; @@ -445,11 +444,13 @@ using System; using System.Net; namespace MonoHttp { status_code == 413 || status_code == 414 || status_code == 500 || status_code == 503); - if (conn_close == false) + if (conn_close == false) { conn_close = (context.Request.Headers ["connection"] == "close"); + conn_close |= (v <= HttpVersion.Version10); + } // They sent both KeepAlive: true and Connection: close!? - if (!chunked || conn_close) + if (!keep_alive || conn_close) headers.SetInternal ("Connection", "close"); if (chunked) @@ -482,12 +483,12 @@ using System; using System.Net; namespace MonoHttp { string headers_str = headers.ToString (); writer.Write (headers_str); 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); + /* Assumes that the ms was at position 0 */ + ms.Position = preamble; HeadersSent = true; }