Skip to content

Commit

Permalink
2008-11-18 Gonzalo Paniagua Javier <gonzalo@novell.com>
Browse files Browse the repository at this point in the history
	* HttpConnection.cs: remove CWL. When reusing, BeginReadRequest might
	throw if the client closes.
	* HttpListenerResponse.cs: close the connection for 1.0 clients.

	Backported from HEAD. Fixes bug #459432.

svn path=/branches/mono-2-2/mcs/; revision=121830
  • Loading branch information
gonzalop committed Dec 19, 2008
1 parent 3aad6c2 commit 4bf0660
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
7 changes: 7 additions & 0 deletions mcs/class/System/System.Net/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@

2008-11-18 Gonzalo Paniagua Javier <gonzalo@novell.com>

* HttpConnection.cs: remove CWL. When reusing, BeginReadRequest might
throw if the client closes.
* HttpListenerResponse.cs: close the connection for 1.0 clients.

Backported from HEAD. Fixes bug #459432.
2008-11-13 Gonzalo Paniagua Javier <gonzalo@novell.com>

* FtpDataStream.cs: use the socket for reading until the end of a
Expand Down
8 changes: 6 additions & 2 deletions mcs/class/System/System.Net/HttpConnection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,11 @@ public void BeginReadRequest ()
{
if (buffer == null)
buffer = new byte [BufferSize];
stream.BeginRead (buffer, 0, BufferSize, OnRead, this);
try {
stream.BeginRead (buffer, 0, BufferSize, OnRead, this);
} catch {
sock.Close (); // stream disposed
}
}

public RequestStream GetRequestStream (bool chunked, long contentlength)
Expand Down Expand Up @@ -161,7 +165,7 @@ void OnRead (IAsyncResult ares)
nread = stream.EndRead (ares);
ms.Write (buffer, 0, nread);
} catch (Exception e) {
Console.WriteLine (e);
//Console.WriteLine (e);
if (ms.Length > 0)
SendError ();
sock.Close ();
Expand Down
4 changes: 3 additions & 1 deletion mcs/class/System/System.Net/HttpListenerResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -442,8 +442,10 @@ internal void SendHeaders (bool closing, MemoryStream ms)
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 (!keep_alive || conn_close)
Expand Down

0 comments on commit 4bf0660

Please sign in to comment.