Skip to content

Commit

Permalink
Fix issues with caching
Browse files Browse the repository at this point in the history
	When the 't' parameter was specified, we returned a 304 if the
	timestamp matched the assembly timestamp, even if the client
	needed the entire body. We were also setting the 304 response
	cachebility as public to further mess things up.

	Fixes the treeview in the class status pages.
  • Loading branch information
gonzalop committed Apr 14, 2012
1 parent ef1823a commit dc75067
Showing 1 changed file with 0 additions and 21 deletions.
21 changes: 0 additions & 21 deletions mcs/class/System.Web/System.Web.Handlers/AssemblyResourceLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -336,19 +336,6 @@ static string CreateResourceUrl (KeyedHashAlgorithm kha, string assemblyName, st
return href;
}

bool HasCacheControl (HttpRequest request, NameValueCollection queryString, out long atime)
{
if (String.Compare (request.Headers ["Cache-Control"], "max-age=0", StringComparison.Ordinal) != 0) {
atime = 0;
return false;
}

if (Int64.TryParse (request.QueryString ["t"], out atime))
return true;

return false;
}

bool HasIfModifiedSince (HttpRequest request, out DateTime modified)
{
string modif_since = request.Headers ["If-Modified-Since"];
Expand All @@ -373,7 +360,6 @@ void RespondWithNotModified (HttpContext context)
response.Clear ();
response.StatusCode = 304;
response.ContentType = null;
response.CacheControl = "public"; // easier to set it to public as MS than remove it
context.ApplicationInstance.CompleteRequest ();
}

Expand All @@ -400,13 +386,6 @@ void SendEmbeddedResource (HttpContext context, out EmbeddedResource res, out As
assembly = Assembly.Load (entry.AssemblyName);

long atime;
if (HasCacheControl (request, queryString, out atime)) {
if (atime == File.GetLastWriteTimeUtc (assembly.Location).Ticks) {
RespondWithNotModified (context);
return;
}
}

DateTime modified;
if (HasIfModifiedSince (request, out modified)) {
if (File.GetLastWriteTimeUtc (assembly.Location) <= modified) {
Expand Down

0 comments on commit dc75067

Please sign in to comment.