From 7aa9bfaaa5d0beeb9d8d25075302960b595bc3f0 Mon Sep 17 00:00:00 2001 From: James South Date: Wed, 21 Jan 2015 15:14:34 +0000 Subject: [PATCH] A better fix. Former-commit-id: 94826dd7401ed7f3b07cf397c1079c563dd1e5ca Former-commit-id: 153a7543f7cd31b1848b6343036c0ecf1780b4e1 --- .../HttpModules/ImageProcessingModule.cs | 26 +++---------------- src/TestWebsites/MVC/Views/Web.config | 3 --- 2 files changed, 4 insertions(+), 25 deletions(-) diff --git a/src/ImageProcessor.Web/HttpModules/ImageProcessingModule.cs b/src/ImageProcessor.Web/HttpModules/ImageProcessingModule.cs index 01bb68828..4db41ee0f 100644 --- a/src/ImageProcessor.Web/HttpModules/ImageProcessingModule.cs +++ b/src/ImageProcessor.Web/HttpModules/ImageProcessingModule.cs @@ -453,35 +453,17 @@ namespace ImageProcessor.Web.HttpModules if (context.Items[CachedResponseFileDependency] == null) { - context.Items[CachedResponseFileDependency] = new List { cachedPath }; - } - - string incomingEtag = context.Request.Headers["If-None-Match"]; - - if (incomingEtag != null && !isNewOrUpdated) - { - // Set the Content-Length header so the client doesn't wait for - // content but keeps the connection open for other requests. - context.Response.AddHeader("Content-Length", "0"); - context.Response.StatusCode = (int)HttpStatusCode.NotModified; - if (isFileLocal) { - // Set the headers and quit. // Some services might only provide filename so we can't monitor for the browser. - this.SetHeaders( - context, - (string)context.Items[CachedResponseTypeKey], - Path.GetFileName(requestPath) == requestPath ? new List { cachedPath } : new List { requestPath, cachedPath }); + context.Items[CachedResponseFileDependency] = Path.GetFileName(requestPath) == requestPath + ? new List { cachedPath } + : new List { requestPath, cachedPath }; } else { - this.SetHeaders(context, (string)context.Items[CachedResponseTypeKey], new List { cachedPath }); + context.Items[CachedResponseFileDependency] = new List { cachedPath }; } - - // Complete the requests but don't abort the thread. - context.ApplicationInstance.CompleteRequest(); - return; } // The cached file is valid so just rewrite the path. diff --git a/src/TestWebsites/MVC/Views/Web.config b/src/TestWebsites/MVC/Views/Web.config index c8101869a..ca2f8f0fb 100644 --- a/src/TestWebsites/MVC/Views/Web.config +++ b/src/TestWebsites/MVC/Views/Web.config @@ -49,9 +49,6 @@ - - -