Skip to content

Commit

Permalink
from HEAD
Browse files Browse the repository at this point in the history
svn path=/branches/mono-1-1-13/mcs/; revision=58473
  • Loading branch information
gonzalop committed Mar 24, 2006
1 parent c767545 commit 68b3f88
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 24 deletions.
5 changes: 5 additions & 0 deletions mcs/class/System.Web/System.Web/ChangeLog
@@ -1,3 +1,8 @@
2006-03-23 Gonzalo Paniagua Javier <gonzalo@ximian.com>

* HttpResponse.cs: more fixes for CacheControl: MS allows to set it to
null and "" and the getter value does not completely depend on Cache.

2006-03-22 Robert Jordan <robertj@gmx.net>

* HttpCachePolicy.cs: fix the Cache-control header. Fixes bug #77826.
Expand Down
1 change: 0 additions & 1 deletion mcs/class/System.Web/System.Web/HttpRequest.cs
Expand Up @@ -940,7 +940,6 @@ internal void ReleaseResources ()

if (cached_url == null) {
UriBuilder builder = new UriBuilder (uri_builder.Uri);
builder.Path += path_info;
cached_url = builder.Uri;
}
return cached_url;
Expand Down
35 changes: 12 additions & 23 deletions mcs/class/System.Web/System.Web/HttpResponse.cs
Expand Up @@ -61,7 +61,7 @@ public sealed class HttpResponse {
string charset;
bool charset_set;
CachedRawResponse cached_response;
string user_cache_control;
string user_cache_control = "private";
string redirect_location;

//
Expand Down Expand Up @@ -610,8 +610,6 @@ void AddHeadersNoCache (ArrayList write_headers, bool final_flush)
//
if (cache_policy != null)
cache_policy.SetHeaders (this, headers);
else if (user_cache_control != null)
write_headers.Add (new UnknownResponseHeader ("Cache-Control", user_cache_control));
else
write_headers.Add (new UnknownResponseHeader ("Cache-Control", CacheControl));

Expand Down Expand Up @@ -957,34 +955,25 @@ internal CachedRawResponse GetCachedResponse ()
//
public string CacheControl {
set {
if (String.Compare (value, "public", true, CultureInfo.InvariantCulture) == 0)
if (value == null || value == "") {
Cache.SetCacheability (HttpCacheability.NoCache);
user_cache_control = null;
} else if (String.Compare (value, "public", true, CultureInfo.InvariantCulture) == 0) {
Cache.SetCacheability (HttpCacheability.Public);
else if (String.Compare (value, "private", true, CultureInfo.InvariantCulture) == 0)
user_cache_control = "public";
} else if (String.Compare (value, "private", true, CultureInfo.InvariantCulture) == 0) {
Cache.SetCacheability (HttpCacheability.Private);
else if (String.Compare (value, "no-cache", true, CultureInfo.InvariantCulture) == 0)
user_cache_control = "private";
} else if (String.Compare (value, "no-cache", true, CultureInfo.InvariantCulture) == 0) {
Cache.SetCacheability (HttpCacheability.NoCache);
else
user_cache_control = "no-cache";
} else
throw new ArgumentException ("CacheControl property only allows `public', " +
"`private' or no-cache, for different uses, use " +
"Response.AppendHeader");
user_cache_control = null;
}

get {
switch (Cache.Cacheability) {
case (HttpCacheability)0:
case HttpCacheability.NoCache:
return "no-cache";
case HttpCacheability.Private:
case HttpCacheability.Server:
case HttpCacheability.ServerAndPrivate:
return "private";
case HttpCacheability.Public:
return "public";
default:
throw new Exception ("Unknown internal state: " + Cache.Cacheability);
}
}
get { return (user_cache_control != null) ? user_cache_control : "private"; }
}
#endregion

Expand Down

0 comments on commit 68b3f88

Please sign in to comment.