From 900212c169d2c59bb52dfa4dfbab4ec88fd89272 Mon Sep 17 00:00:00 2001 From: Lluis Sanchez Date: Wed, 6 Jul 2005 11:18:31 +0000 Subject: [PATCH] 2005-07-06 Lluis Sanchez Gual * HttpServer.cs: Close the connection after processing the request. Based on a patch by Brion Vibber. Fixes bug #75467. svn path=/trunk/mcs/; revision=46990 --- .../ChangeLog | 5 ++ .../HttpServer.cs | 60 +++++++++++-------- 2 files changed, 40 insertions(+), 25 deletions(-) diff --git a/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Http/ChangeLog b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Http/ChangeLog index f8b81476dc6..b8e6cc85df0 100644 --- a/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Http/ChangeLog +++ b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Http/ChangeLog @@ -1,3 +1,8 @@ +2005-07-06 Lluis Sanchez Gual + + * HttpServer.cs: Close the connection after processing the request. + Based on a patch by Brion Vibber. Fixes bug #75467. + 2005-05-18 Lluis Sanchez Gual * HttpServerChannel.cs: Catch exceptions thrown in the server thread. diff --git a/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Http/HttpServer.cs b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Http/HttpServer.cs index 47fdc3e7130..ba05ee29b1e 100644 --- a/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Http/HttpServer.cs +++ b/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Http/HttpServer.cs @@ -77,6 +77,12 @@ namespace System.Runtime.Remoting.Channels.Http } } + public void Close() + { + Stream.Close(); + socket.Close(); + } + public int Id; public Stream Stream; public HttpServerTransportSink Sink; @@ -86,34 +92,38 @@ namespace System.Runtime.Remoting.Channels.Http { public static void ProcessRequest (RequestArguments reqArg) { - //Step (1) Start Reciceve the header - ArrayList Headers = RecieveHeader (reqArg); - - //Step (2) Start Parse the header - IDictionary HeaderFields = new Hashtable(); - IDictionary CustomHeaders = new Hashtable(); - if (!ParseHeader (reqArg, Headers, HeaderFields, CustomHeaders)) - return; - - //Step (3) - if (!CheckRequest (reqArg, HeaderFields, CustomHeaders)) - return; + try { + //Step (1) Start Reciceve the header + ArrayList Headers = RecieveHeader (reqArg); + + //Step (2) Start Parse the header + IDictionary HeaderFields = new Hashtable(); + IDictionary CustomHeaders = new Hashtable(); + if (!ParseHeader (reqArg, Headers, HeaderFields, CustomHeaders)) + return; - //Step (4) Recieve the entity body - - byte[] buffer; - object len = HeaderFields["content-length"]; - if (len != null) - { - buffer = new byte [(int)len]; - if (!RecieveEntityBody (reqArg, buffer)) + //Step (3) + if (!CheckRequest (reqArg, HeaderFields, CustomHeaders)) return; - } - else - buffer = new byte [0]; + + //Step (4) Recieve the entity body - //Step (5) - SendRequestForChannel (reqArg, HeaderFields, CustomHeaders, buffer); + byte[] buffer; + object len = HeaderFields["content-length"]; + if (len != null) + { + buffer = new byte [(int)len]; + if (!RecieveEntityBody (reqArg, buffer)) + return; + } + else + buffer = new byte [0]; + + //Step (5) + SendRequestForChannel (reqArg, HeaderFields, CustomHeaders, buffer); + } finally { + reqArg.Close (); + } } private static ArrayList RecieveHeader (RequestArguments reqArg) -- 2.25.1