[Mono-dev] [PATCH] BUG in System.Web.HttpResponse

Edward C. Eisenbrey nede at aliquant.com
Wed Feb 15 13:24:43 EST 2006


The attached patch takes care of the following issue.

-----Original Message-----
From: Edward C. Eisenbrey 
Sent: Monday, February 13, 2006 11:05 AM
To: mono-devel-list at lists.ximian.com
Subject: [Mono-dev] BUG in System.Web.HttpResponse

Please bear with me since this is my first post to this list.  If I do
something wrong or forget something, let me know so I can learn.

I've encountered a bug moving an MS .NET Framework v1.1 web application
to Mono.  We use the following call:

Response.AddHeader("Cache-Control", "no-cache, no-store");

Which works fine in MS's Framework.  In Mono, however, it gives an error
saying "CacheControl property only allows `public', `private' or
no-cache, for different uses, use Response.AppendHeader".  First, this
is an incompatibility with MS.  Secondly, Response.AddHeader calls
Response.AppendHeader in Mono, which sets the CacheControl property,
which throws this exception.  So there is a logic loop.  I propose the
following change to the AppendHeader method, starting on line 419:

//
// AppendHeader:
//    Special case for Content-Length, Content-Type and
Transfer-Encoding
//
//
public void AppendHeader (string name, string value)
{
	if (headers_sent)
		throw new HttpException ("headers have been already
sent");
	
	if (String.Compare (name, "content-length", true,
CultureInfo.InvariantCulture) == 0){
		content_length = (long) UInt64.Parse (value);
		use_chunked = false;
		return;
	}

	if (String.Compare (name, "content-type", true,
CultureInfo.InvariantCulture) == 0){
		ContentType = value;
		return;
	}

	if (String.Compare (name, "transfer-encoding", true,
CultureInfo.InvariantCulture) == 0){
		transfer_encoding = value;
		use_chunked = false;
		return;
	}

	headers.Add (new UnknownResponseHeader (name, value));
}

I just removed the "if" checking for a header name of "cache-control".

_______________________________________________
Mono-devel-list mailing list
Mono-devel-list at lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list



-------------- next part --------------
A non-text attachment was scrubbed...
Name: file1.diff
Type: application/octet-stream
Size: 739 bytes
Desc: file1.diff
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20060215/ff8049e7/attachment.obj 


More information about the Mono-devel-list mailing list