[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677

trey trey at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 07:33:24 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 85b53b091f1061b4a1d00b5592e2c244f1c6b216
Author: trey <trey at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Apr 2 18:54:27 2003 +0000

    	3174227 - aggressive caching of generated pages causes problems with WIKI
    
    	We decided to fix half the observed behavior, as all the bad behavior is
    	arguably due to a mis-configured server (that sets a max-age=60 on
    	all its pages).
    
    	The fix is that when a redirect comes in response to a POST we force a
    	load from origin, since this is a common technique sites do to prevent
    	a post from ending up in the b/f list, and it is very likely you are
    	on your way back to look at data that you believe you just edited.
    
            Reviewed by Ken.
    
            * WebView.subproj/WebFramePrivate.m:
            (-[WebFrame _loadItem:withLoadType:]):  Nit cleanup.  Remove unused arg.
            (-[WebFrame _recursiveGoToItem:fromItem:withLoadType:]):
    	Same nit cleanup.
            * WebView.subproj/WebMainResourceClient.m:
            (-[WebMainResourceClient connection:willSendRequest:redirectResponse:]):
    	Force loadFromOrigin if we have a redirect in response to a POST.
            * WebView.subproj/WebResourceLoadDelegate.h:
    	Add headerdoc comment for redirectResponse param.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@3998 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 182b646..a0eb599 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,28 @@
+2003-04-01  Trey Matteson  <trey at apple.com>
+
+	3174227 - aggressive caching of generated pages causes problems with WIKI
+
+	We decided to fix half the observed behavior, as all the bad behavior is
+	arguably due to a mis-configured server (that sets a max-age=60 on
+	all its pages).
+
+	The fix is that when a redirect comes in response to a POST we force a
+	load from origin, since this is a common technique sites do to prevent
+	a post from ending up in the b/f list, and it is very likely you are
+	on your way back to look at data that you believe you just edited. 
+
+        Reviewed by Ken.
+
+        * WebView.subproj/WebFramePrivate.m:
+        (-[WebFrame _loadItem:withLoadType:]):  Nit cleanup.  Remove unused arg.
+        (-[WebFrame _recursiveGoToItem:fromItem:withLoadType:]):
+	Same nit cleanup.
+        * WebView.subproj/WebMainResourceClient.m:
+        (-[WebMainResourceClient connection:willSendRequest:redirectResponse:]):
+	Force loadFromOrigin if we have a redirect in response to a POST.
+        * WebView.subproj/WebResourceLoadDelegate.h:
+	Add headerdoc comment for redirectResponse param.
+
 2003-04-01  Maciej Stachowiak  <mjs at apple.com>
 
         Reviewed by Richard.
diff --git a/WebKit/WebView.subproj/WebFramePrivate.m b/WebKit/WebView.subproj/WebFramePrivate.m
index a99f55b..d7ba1e6 100644
--- a/WebKit/WebView.subproj/WebFramePrivate.m
+++ b/WebKit/WebView.subproj/WebFramePrivate.m
@@ -1050,7 +1050,7 @@ static CFAbsoluteTime _timeOfLastCompletedLoad;
 }
 
 // loads content into this frame, as specified by item
-- (void)_loadItem:(WebHistoryItem *)item fromItem:(WebHistoryItem *)fromItem withLoadType:(WebFrameLoadType)loadType
+- (void)_loadItem:(WebHistoryItem *)item withLoadType:(WebFrameLoadType)loadType
 {
     NSURL *itemURL = [item URL];
     NSURL *currentURL = [[[self dataSource] request] URL];
@@ -1199,7 +1199,7 @@ static CFAbsoluteTime _timeOfLastCompletedLoad;
         }
     } else {
         // We need to reload the content
-        [self _loadItem:item fromItem:fromItem withLoadType:type];
+        [self _loadItem:item withLoadType:type];
     }
 }
 
diff --git a/WebKit/WebView.subproj/WebMainResourceClient.m b/WebKit/WebView.subproj/WebMainResourceClient.m
index 8f49c91..40d9d0b 100644
--- a/WebKit/WebView.subproj/WebMainResourceClient.m
+++ b/WebKit/WebView.subproj/WebMainResourceClient.m
@@ -113,12 +113,30 @@
     NSURL *URL = [newRequest URL];
 
     LOG(Redirect, "URL = %@", URL);
-    
+
+    NSMutableURLRequest *mutableRequest = nil;
     // Update cookie policy base URL as URL changes, except for subframes, which use the
     // URL of the main frame which doesn't change when we redirect.
     if ([dataSource webFrame] == [[dataSource _controller] mainFrame]) {
-        NSMutableURLRequest *mutableRequest = [newRequest mutableCopy];
+        mutableRequest = [newRequest mutableCopy];
         [mutableRequest HTTPSetCookiePolicyBaseURL:URL];
+    }
+
+    // If we're fielding a redirect in response to a POST, force a load from origin, since
+    // this is a common site technique to return to a page viewing some data that the POST
+    // just modified.
+    if (redirectResponse && [redirectResponse isKindOfClass:[NSHTTPURLResponse class]]) {
+        int status = [(NSHTTPURLResponse *)redirectResponse statusCode];
+        if (((status >= 301 && status <= 303) || status == 307)
+            && [[[dataSource initialRequest] HTTPMethod] isEqualToString:@"POST"])
+        {
+            if (!mutableRequest) {
+                mutableRequest = [newRequest mutableCopy];
+            }
+            [mutableRequest setCachePolicy:NSURLRequestReloadIgnoringCacheData];
+        }
+    }
+    if (mutableRequest) {
         newRequest = [mutableRequest autorelease];
     }
 
diff --git a/WebKit/WebView.subproj/WebMainResourceLoader.m b/WebKit/WebView.subproj/WebMainResourceLoader.m
index 8f49c91..40d9d0b 100644
--- a/WebKit/WebView.subproj/WebMainResourceLoader.m
+++ b/WebKit/WebView.subproj/WebMainResourceLoader.m
@@ -113,12 +113,30 @@
     NSURL *URL = [newRequest URL];
 
     LOG(Redirect, "URL = %@", URL);
-    
+
+    NSMutableURLRequest *mutableRequest = nil;
     // Update cookie policy base URL as URL changes, except for subframes, which use the
     // URL of the main frame which doesn't change when we redirect.
     if ([dataSource webFrame] == [[dataSource _controller] mainFrame]) {
-        NSMutableURLRequest *mutableRequest = [newRequest mutableCopy];
+        mutableRequest = [newRequest mutableCopy];
         [mutableRequest HTTPSetCookiePolicyBaseURL:URL];
+    }
+
+    // If we're fielding a redirect in response to a POST, force a load from origin, since
+    // this is a common site technique to return to a page viewing some data that the POST
+    // just modified.
+    if (redirectResponse && [redirectResponse isKindOfClass:[NSHTTPURLResponse class]]) {
+        int status = [(NSHTTPURLResponse *)redirectResponse statusCode];
+        if (((status >= 301 && status <= 303) || status == 307)
+            && [[[dataSource initialRequest] HTTPMethod] isEqualToString:@"POST"])
+        {
+            if (!mutableRequest) {
+                mutableRequest = [newRequest mutableCopy];
+            }
+            [mutableRequest setCachePolicy:NSURLRequestReloadIgnoringCacheData];
+        }
+    }
+    if (mutableRequest) {
         newRequest = [mutableRequest autorelease];
     }
 
diff --git a/WebKit/WebView.subproj/WebResourceLoadDelegate.h b/WebKit/WebView.subproj/WebResourceLoadDelegate.h
index b2f0906..2e81ff5 100644
--- a/WebKit/WebView.subproj/WebResourceLoadDelegate.h
+++ b/WebKit/WebView.subproj/WebResourceLoadDelegate.h
@@ -46,6 +46,8 @@
     @param identifier An identifier that can be used to track the progress of a resource load across
     multiple call backs.
     @param request The request about to be sent.
+    @param redirectResponse If the request is being made in response to a redirect we received,
+    the response that conveyed that redirect.
     @param dataSource The dataSource that initiated the load.
     @result Returns the request, which may be mutated by the implementor, although typically
     will be request.

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list