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

kocienda kocienda at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 06:46:03 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit b10c9d7638a8cfed7046ac688159f8c992be61eb
Author: kocienda <kocienda at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Oct 1 14:38:14 2002 +0000

    WebFoundation:
    
    	Big set of changes to move the code closer to the proposed WebFoundation API. Major work includes:
    
    	- Implemented new callbacks for WebResourceHandleDelegate. All delegates of WebResourceHandle
    	  were updated to reflect this change.
    
    	- Modified the way WebProtocolHandler creates protocol-specific responses.
    
    	- Move WebResourceHandle API much closer to the final proposal. The public API on this class
    	  is very thin now. Some private methods are still available to code inside Intrigue (to ease
    	  the transition), and the dependencies on these private methods will be reduced over time.
    
    	- WebResourceRequest and WebResourceResponse classes are now closer to their proposed APIs, but
    	  work remains to be done with them.
    
    	- Synchronous loading code received a large rewrite.
    
    	And an extra:
    
    	- Sped up implementation of file protocol handler. This protocol handler no longer kicks a thread for each file load.
    
            * CacheLoader.subproj/IFHTTPURLHandleC.h:
            * CacheLoader.subproj/IFHTTPURLHandleC.m:
            (IFHTTPURLHandleGetRequestMethod)
            (IFHTTPURLHandleGetRequestHeaders)
            * CacheLoader.subproj/IFURLHandleC.m:
            (IFURLHandleBackgroundLoadFailedWithResultCode)
            (IFURLHandleGetURL)
            (IFURLHandleGetCanonicalURL)
            (IFURLHandleGetStatusCode)
            (IFURLHandleGetResultCode)
            (IFURLHandleGetContentType)
            (IFURLHandleGetError)
            (IFURLHandleGetContentLength)
            (IFURLHandleGetContentLengthReceived)
            (IFURLHandleGetPercentComplete)
            * CacheLoader.subproj/WebMemoryCache.m:
            (-[WebMemoryCache _truncateToSizeLimit])
            * CacheLoader.subproj/WebProtocolHandler.h:
            * CacheLoader.subproj/WebProtocolHandler.m:
            (-[WebProtocolHandler responseClass])
            (-[WebProtocolHandler responseMetadataAvailable])
            (-[WebProtocolHandler setResponseMetadata:])
            * CacheLoader.subproj/WebResourceCallbackClient.m:
            (-[WebResourceCallbackClient handle:willSendRequest:])
            (-[WebResourceCallbackClient handle:didReceiveResponse:])
            * CacheLoader.subproj/WebResourceHandle.h:
            * CacheLoader.subproj/WebResourceHandle.m:
            (+[WebResourceHandle sendSynchronousRequest:])
            (-[WebResourceHandle initWithRequest:delegate:])
            * CacheLoader.subproj/WebResourceHandleDelegate.h:
            * CacheLoader.subproj/WebResourceHandleInternal.h:
            * CacheLoader.subproj/WebResourceHandleInternal.m:
            (-[WebResourceHandleInstanceVariables prepareCallbacks])
            (-[WebResourceHandleInstanceVariables dealloc])
            (-[WebResourceHandle _loadInBackground])
            (-[WebResourceHandle _sendCallbacks])
            (-[WebResourceHandle _notifyClientWillSendRequest])
            (-[WebResourceHandle _notifyClientDidReceiveResponse])
            (-[WebResourceHandle _notifyClientDataDidBecomeAvailable])
            (-[WebResourceHandle _notifyClientDidFailLoading])
            (-[WebResourceHandle _notifyClientDidFinishLoading])
            * CacheLoader.subproj/WebResourceHandlePrivate.h:
            * CacheLoader.subproj/WebResourceHandlePrivate.m:
            (-[WebResourceHandle _didReceiveResponseMetadata:])
            (-[WebResourceHandle _backgroundLoadComplete])
            (-[WebResourceHandle _backgroundLoadFailed])
            (-[WebResourceHandle _didRedirectToURL:])
            (-[WebResourceHandle _request])
            (-[WebResourceHandle _response])
            (-[WebResourceHandle _redirectedURL])
            * CacheLoader.subproj/WebResourceLoad.h:
            * CacheLoader.subproj/WebResourceLoad.m:
            (-[WebResourceLoad initWithRequest:])
            (-[WebResourceLoad didLoadBytes:length:])
            (-[WebResourceLoad succeeded])
            (-[WebResourceLoad failedWithResultCode:inDomain:failingURL:])
            (-[WebResourceLoad addHandle:])
            (-[WebResourceLoad cacheObjectCheckingRedirects:])
            (-[WebResourceLoad didRedirectToURL:permanent:])
            (-[WebResourceLoad originalRequest])
            (-[WebResourceLoad _beginLoad])
            (-[WebResourceLoad _cacheKey])
            (-[WebResourceLoad description])
            (-[WebResourceLoad dealloc])
            * CacheLoader.subproj/WebResourceLoadManager.m:
            (+[WebResourceLoadKey keyWithHandle:])
            (+[WebResourceLoadKey keyWithLoad:])
            (-[WebResourceLoadKey hash])
            (-[WebResourceLoadManager requestWithURLHandle:])
            * CacheLoader.subproj/WebResourceLoadQueue.m:
            (-[WebResourceLoadQueue put:])
            * CacheLoader.subproj/WebResourceRequest.h:
            * CacheLoader.subproj/WebResourceRequest.m:
            (-[WebResourceRequest initWithURL:])
            (-[WebResourceRequest canonicalURL])
            (-[WebResourceRequest protocolHandlerClass])
            (-[WebResourceRequest copyWithZone:])
            (-[WebResourceRequest copyWithURL:])
            * CacheLoader.subproj/WebResourceResponse.m:
            (-[WebResourceResponse contentType])
            * CacheLoader.subproj/WebResourceSynchronousClient.h:
            * CacheLoader.subproj/WebResourceSynchronousClient.m:
            (-[WebResourceHandleSynchronousDelegate initWithRequest:monitor:])
            (-[WebResourceHandleSynchronousDelegate dealloc])
            (-[WebResourceHandleSynchronousDelegate run:])
            (-[WebResourceHandleSynchronousDelegate started])
            (-[WebResourceHandleSynchronousDelegate handle])
            (-[WebResourceHandleSynchronousDelegate response])
            (-[WebResourceHandleSynchronousDelegate result])
            (-[WebResourceHandleSynchronousDelegate handle:willSendRequest:])
            (-[WebResourceHandleSynchronousDelegate handleDidFinishLoading:])
            (-[WebResourceHandleSynchronousDelegate handle:didReceiveResponse:])
            (-[WebResourceHandleSynchronousDelegate handle:didReceiveData:])
            * Misc.subproj/WebFoundation.h:
            * Misc.subproj/WebFoundationLogging.h:
            * Misc.subproj/WebFoundationLogging.m:
            * Misc.subproj/WebNSStringExtras.m:
            (-[NSString _web_isCaseInsensitiveEqualToString:]
            * ProtocolHandlers.subproj/WebAboutProtocolHandler.h:
            * ProtocolHandlers.subproj/WebAboutProtocolHandler.m:
            (-[WebAboutProtocolHandler beginLoad])
            (-[WebAboutProtocolHandler responseClass])
            (-[WebAboutProtocolHandler responseMetadataAvailable])
            (-[WebAboutProtocolHandler setResponseMetadata:])
            * ProtocolHandlers.subproj/WebCFNetworkHTTPProtocolHandler.m:
            (-[WebCFNetworkHTTPProtocolHandler addAuthenticationHeaders:andCall:])
            (-[WebCFNetworkHTTPProtocolHandler continueAfterBytesAvailable])
            (-[WebCFNetworkHTTPProtocolHandler handleReadStreamEvent:event:])
            (-[WebCFNetworkHTTPProtocolHandler performHTTPHeaderRead:andCall:])
            * ProtocolHandlers.subproj/WebFileProtocolHandler.h:
            * ProtocolHandlers.subproj/WebFileProtocolHandler.m:
            (-[WebFileProtocolHandler initWithResourceLoad:])
            (-[WebFileProtocolHandler dealloc])
            (-[WebFileProtocolHandler didLoadData:])
            (-[WebFileProtocolHandler beginLoad])
            (-[WebFileProtocolHandler endLoad])
            (-[WebFileProtocolHandler responseClass])
            (-[WebFileProtocolHandler responseMetadataAvailable])
            (-[WebFileProtocolHandler setResponseMetadata:])
            * ProtocolHandlers.subproj/WebHTTPProtocolHandler.m:
            (-[WebHTTPProtocolHandler responseClass])
            (-[WebHTTPProtocolHandler responseMetadataAvailable])
            (-[WebHTTPProtocolHandler setResponseMetadata:])
            (-[WebHTTPProtocolHandler shouldCacheResponse:])
            (-[WebHTTPProtocolHandler URL])
            (-[WebHTTPProtocolHandler retryWithRedirectedURLAndResultCode:])
            * ProtocolHandlers.subproj/WebSimpleHTTPProtocolHandler.m:
            (-[WebSimpleHTTPProtocolHandler createHTTPRequest])
            (-[WebSimpleHTTPProtocolHandler _examineHeaders])
            * WebFoundation.exp
            * WebFoundation.pbproj/project.pbxproj
    
    WebKit:
    
    	Many changes to coincide with API work in WebFoundation. Most of the modifications
    	here have to do with changes for the new callback scheme.
    
            * Misc.subproj/WebIconLoader.m:
            (-[WebIconLoader handleDidFinishLoading:])
            (-[WebIconLoader handle:willSendRequest:]): New method. A no-op here.
            (-[WebIconLoader handle:didReceiveResponse:]): Ditto.
            * Plugins.subproj/WebBaseNetscapePluginView.m:
            (-[WebBaseNetscapePluginView stop]): Fix for Deployment build breakage.
            * Plugins.subproj/WebPluginStream.h: Add response ivar.
            * Plugins.subproj/WebPluginStream.m:
            (-[WebNetscapePluginStream startLoad]): Tweak method name for new API.
            (-[WebNetscapePluginStream receivedData:withHandle:]):
            (-[WebNetscapePluginStream handle:willSendRequest:]): New method. Replaces old redirect callback.
            (-[WebNetscapePluginStream handle:didReceiveResponse:]): New method. Set the response ivar.
            * WebCoreSupport.subproj/WebSubresourceClient.h: Add response ivar.
            * WebCoreSupport.subproj/WebSubresourceClient.m:
            (-[WebSubresourceClient dealloc]): Release response ivar.
            (+[WebSubresourceClient startLoadingResource:withURL:referrer:forDataSource:]): Set the request user agent here.
            (-[WebSubresourceClient handle:willSendRequest:]): New method. Handle like a redirect.
            (-[WebSubresourceClient handle:didReceiveResponse:]): New method. Set the response ivar.
            (-[WebSubresourceClient handle:didReceiveData:]): Tweaks for new WebFoundation API and method names.
            (-[WebSubresourceClient handleDidFinishLoading:]): Ditto.
            (-[WebSubresourceClient handle:didFailLoadingWithError:]): Ditto.
            * WebView.subproj/WebControllerPrivate.m:
            (-[WebController _receivedError:forResourceHandle:partialProgress:fromDataSource:]): Ditto.
            * WebView.subproj/WebDataSourcePrivate.h: Add _setRequest method.
            * WebView.subproj/WebDataSourcePrivate.m:
            (-[WebDataSource _startLoading]): Call didStartLoadingWithURL with request URL instead of handle URL.
            (-[WebDataSource _setRequest:]): Add implementation.
            * WebView.subproj/WebLoadProgress.m:
            (-[WebLoadProgress initWithResourceHandle:]): Tweaks for new WebFoundation API and method names.
            * WebView.subproj/WebMainResourceClient.h: Add response ivar.
            * WebView.subproj/WebMainResourceClient.m:
            (-[WebMainResourceClient initWithDataSource:]): Set user agent on request here.
            (-[WebMainResourceClient dealloc]): Release response ivar.
            (-[WebMainResourceClient didCancelWithHandle:]): Tweaks for new WebFoundation API and method names.
            (-[WebMainResourceClient handleDidFinishLoading:]): Tweaks for new WebFoundation API and method names.
            (-[WebMainResourceClient handle:willSendRequest:]): New method. Handle like a redirect.
            (-[WebMainResourceClient handle:didReceiveResponse:]): New method. Set the response ivar.
            (-[WebMainResourceClient handle:didReceiveData:]): Tweaks for new WebFoundation API and method names.
            (-[WebMainResourceClient handle:didFailLoadingWithError:]): Ditto.
    
    WebBrowser:
    
    	Updated a couple methods to reflect changes in WebFoundation API names.
    
            * BrowserWebController.m:
            (-[BrowserWebController receivedProgress:forResourceHandle:fromDataSource:complete:]): Call for the URL on the handles response
    	instead of the URL of the handle itself.
            (-[BrowserWebController receivedError:forResourceHandle:partialProgress:fromDataSource:]): Ditto.
            * DownloadMonitor.m:
            (-[DownloadMonitor receivedError:forResourceHandle:partialProgress:fromDataSource:]): Request accessor for handle
    	is now private; reflect that in method name (i.e. add an underscore).
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@2213 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index b32d0f6..e2e4d44 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,48 @@
+2002-10-01  Ken Kocienda  <kocienda at apple.com>
+
+	Many changes to coincide with API work in WebFoundation. Most of the modifications
+	here have to do with changes for the new callback scheme.
+
+        * Misc.subproj/WebIconLoader.m:
+        (-[WebIconLoader handleDidFinishLoading:])
+        (-[WebIconLoader handle:willSendRequest:]): New method. A no-op here.
+        (-[WebIconLoader handle:didReceiveResponse:]): Ditto.
+        * Plugins.subproj/WebBaseNetscapePluginView.m:
+        (-[WebBaseNetscapePluginView stop]): Fix for Deployment build breakage. 
+        * Plugins.subproj/WebPluginStream.h: Add response ivar.
+        * Plugins.subproj/WebPluginStream.m:
+        (-[WebNetscapePluginStream startLoad]): Tweak method name for new API.
+        (-[WebNetscapePluginStream receivedData:withHandle:]):
+        (-[WebNetscapePluginStream handle:willSendRequest:]): New method. Replaces old redirect callback.
+        (-[WebNetscapePluginStream handle:didReceiveResponse:]): New method. Set the response ivar.
+        * WebCoreSupport.subproj/WebSubresourceClient.h: Add response ivar.
+        * WebCoreSupport.subproj/WebSubresourceClient.m:
+        (-[WebSubresourceClient dealloc]): Release response ivar.
+        (+[WebSubresourceClient startLoadingResource:withURL:referrer:forDataSource:]): Set the request user agent here.
+        (-[WebSubresourceClient handle:willSendRequest:]): New method. Handle like a redirect.
+        (-[WebSubresourceClient handle:didReceiveResponse:]): New method. Set the response ivar.
+        (-[WebSubresourceClient handle:didReceiveData:]): Tweaks for new WebFoundation API and method names.
+        (-[WebSubresourceClient handleDidFinishLoading:]): Ditto.
+        (-[WebSubresourceClient handle:didFailLoadingWithError:]): Ditto.
+        * WebView.subproj/WebControllerPrivate.m: 
+        (-[WebController _receivedError:forResourceHandle:partialProgress:fromDataSource:]): Ditto.
+        * WebView.subproj/WebDataSourcePrivate.h: Add _setRequest method.
+        * WebView.subproj/WebDataSourcePrivate.m:
+        (-[WebDataSource _startLoading]): Call didStartLoadingWithURL with request URL instead of handle URL.
+        (-[WebDataSource _setRequest:]): Add implementation.
+        * WebView.subproj/WebLoadProgress.m:
+        (-[WebLoadProgress initWithResourceHandle:]): Tweaks for new WebFoundation API and method names.
+        * WebView.subproj/WebMainResourceClient.h: Add response ivar.
+        * WebView.subproj/WebMainResourceClient.m:
+        (-[WebMainResourceClient initWithDataSource:]): Set user agent on request here.
+        (-[WebMainResourceClient dealloc]): Release response ivar.
+        (-[WebMainResourceClient didCancelWithHandle:]): Tweaks for new WebFoundation API and method names.
+        (-[WebMainResourceClient handleDidFinishLoading:]): Tweaks for new WebFoundation API and method names.
+        (-[WebMainResourceClient handle:willSendRequest:]): New method. Handle like a redirect.
+        (-[WebMainResourceClient handle:didReceiveResponse:]): New method. Set the response ivar.
+        (-[WebMainResourceClient handle:didReceiveData:]): Tweaks for new WebFoundation API and method names.
+        (-[WebMainResourceClient handle:didFailLoadingWithError:]): Ditto.
+
 
 2002-09-30  Chris Blumenberg  <cblu at apple.com>
 
diff --git a/WebKit/ChangeLog-2002-12-03 b/WebKit/ChangeLog-2002-12-03
index b32d0f6..e2e4d44 100644
--- a/WebKit/ChangeLog-2002-12-03
+++ b/WebKit/ChangeLog-2002-12-03
@@ -1,3 +1,48 @@
+2002-10-01  Ken Kocienda  <kocienda at apple.com>
+
+	Many changes to coincide with API work in WebFoundation. Most of the modifications
+	here have to do with changes for the new callback scheme.
+
+        * Misc.subproj/WebIconLoader.m:
+        (-[WebIconLoader handleDidFinishLoading:])
+        (-[WebIconLoader handle:willSendRequest:]): New method. A no-op here.
+        (-[WebIconLoader handle:didReceiveResponse:]): Ditto.
+        * Plugins.subproj/WebBaseNetscapePluginView.m:
+        (-[WebBaseNetscapePluginView stop]): Fix for Deployment build breakage. 
+        * Plugins.subproj/WebPluginStream.h: Add response ivar.
+        * Plugins.subproj/WebPluginStream.m:
+        (-[WebNetscapePluginStream startLoad]): Tweak method name for new API.
+        (-[WebNetscapePluginStream receivedData:withHandle:]):
+        (-[WebNetscapePluginStream handle:willSendRequest:]): New method. Replaces old redirect callback.
+        (-[WebNetscapePluginStream handle:didReceiveResponse:]): New method. Set the response ivar.
+        * WebCoreSupport.subproj/WebSubresourceClient.h: Add response ivar.
+        * WebCoreSupport.subproj/WebSubresourceClient.m:
+        (-[WebSubresourceClient dealloc]): Release response ivar.
+        (+[WebSubresourceClient startLoadingResource:withURL:referrer:forDataSource:]): Set the request user agent here.
+        (-[WebSubresourceClient handle:willSendRequest:]): New method. Handle like a redirect.
+        (-[WebSubresourceClient handle:didReceiveResponse:]): New method. Set the response ivar.
+        (-[WebSubresourceClient handle:didReceiveData:]): Tweaks for new WebFoundation API and method names.
+        (-[WebSubresourceClient handleDidFinishLoading:]): Ditto.
+        (-[WebSubresourceClient handle:didFailLoadingWithError:]): Ditto.
+        * WebView.subproj/WebControllerPrivate.m: 
+        (-[WebController _receivedError:forResourceHandle:partialProgress:fromDataSource:]): Ditto.
+        * WebView.subproj/WebDataSourcePrivate.h: Add _setRequest method.
+        * WebView.subproj/WebDataSourcePrivate.m:
+        (-[WebDataSource _startLoading]): Call didStartLoadingWithURL with request URL instead of handle URL.
+        (-[WebDataSource _setRequest:]): Add implementation.
+        * WebView.subproj/WebLoadProgress.m:
+        (-[WebLoadProgress initWithResourceHandle:]): Tweaks for new WebFoundation API and method names.
+        * WebView.subproj/WebMainResourceClient.h: Add response ivar.
+        * WebView.subproj/WebMainResourceClient.m:
+        (-[WebMainResourceClient initWithDataSource:]): Set user agent on request here.
+        (-[WebMainResourceClient dealloc]): Release response ivar.
+        (-[WebMainResourceClient didCancelWithHandle:]): Tweaks for new WebFoundation API and method names.
+        (-[WebMainResourceClient handleDidFinishLoading:]): Tweaks for new WebFoundation API and method names.
+        (-[WebMainResourceClient handle:willSendRequest:]): New method. Handle like a redirect.
+        (-[WebMainResourceClient handle:didReceiveResponse:]): New method. Set the response ivar.
+        (-[WebMainResourceClient handle:didReceiveData:]): Tweaks for new WebFoundation API and method names.
+        (-[WebMainResourceClient handle:didFailLoadingWithError:]): Ditto.
+
 
 2002-09-30  Chris Blumenberg  <cblu at apple.com>
 
diff --git a/WebKit/Misc.subproj/WebIconLoader.m b/WebKit/Misc.subproj/WebIconLoader.m
index e911862..e2e9a66 100644
--- a/WebKit/Misc.subproj/WebIconLoader.m
+++ b/WebKit/Misc.subproj/WebIconLoader.m
@@ -94,11 +94,6 @@
     _private->handle = nil;
 }
 
-- (NSString *)handleWillUseUserAgent:(WebResourceHandle *)handle forURL:(NSURL *)URL
-{
-    return nil;
-}
-
 - (void)handleDidFinishLoading:(WebResourceHandle *)sender
 {
     NSImage *icon = [[NSImage alloc] initWithData:_private->resourceData];
@@ -109,6 +104,16 @@
     }
 }
 
+-(void)handle:(WebResourceHandle *)handle willSendRequest:(WebResourceRequest *)request
+{
+    // no-op
+}
+
+-(void)handle:(WebResourceHandle *)handle didReceiveResponse:(WebResourceResponse *)theResponse
+{
+    // no-op
+}
+
 - (void)handle:(WebResourceHandle *)sender didReceiveData:(NSData *)data
 {
     [_private->resourceData appendData:data];
diff --git a/WebKit/Plugins.subproj/WebBaseNetscapePluginView.m b/WebKit/Plugins.subproj/WebBaseNetscapePluginView.m
index e535756..1b49f54 100644
--- a/WebKit/Plugins.subproj/WebBaseNetscapePluginView.m
+++ b/WebKit/Plugins.subproj/WebBaseNetscapePluginView.m
@@ -514,7 +514,8 @@
     // Stop notifications
     [[NSNotificationCenter defaultCenter] removeObserver:self];
     
-    NPError npErr = NPP_Destroy(instance, NULL);
+    NPError npErr;
+    npErr = NPP_Destroy(instance, NULL);
     LOG(Plugins, "NPP_Destroy: %d", npErr);
 }
 
diff --git a/WebKit/Plugins.subproj/WebPluginStream.h b/WebKit/Plugins.subproj/WebPluginStream.h
index 0d590fb..e912516 100644
--- a/WebKit/Plugins.subproj/WebPluginStream.h
+++ b/WebKit/Plugins.subproj/WebPluginStream.h
@@ -10,6 +10,7 @@
 @class WebBaseNetscapePluginView;
 @class WebDataSource;
 @class WebResourceHandle;
+ at class WebResourceResponse;
 @class WebResourceRequest;
 
 @protocol WebDocumentRepresentation;
@@ -30,6 +31,7 @@
 
     WebResourceRequest *request;
     WebResourceHandle *resource;
+    WebResourceResponse *response;
     NSMutableData *resourceData;
     
     NPP_NewStreamProcPtr NPP_NewStream;
diff --git a/WebKit/Plugins.subproj/WebPluginStream.m b/WebKit/Plugins.subproj/WebPluginStream.m
index eb4e179..05335be 100644
--- a/WebKit/Plugins.subproj/WebPluginStream.m
+++ b/WebKit/Plugins.subproj/WebPluginStream.m
@@ -19,6 +19,7 @@
 #import <WebFoundation/WebError.h>
 #import <WebFoundation/WebNSFileManagerExtras.h>
 #import <WebFoundation/WebResourceHandle.h>
+#import <WebFoundation/WebResourceHandlePrivate.h>
 #import <WebFoundation/WebResourceRequest.h>
 #import <WebFoundation/WebResourceResponse.h>
 
@@ -103,7 +104,7 @@
 - (void)startLoad
 {
     resource = [[WebResourceHandle alloc] initWithRequest:request delegate:self];
-    [[view controller] _didStartLoading:[resource URL]];
+    [[view controller] _didStartLoading:[[resource _request] URL]];
 }
 
 - (void)stop
@@ -119,12 +120,12 @@
 {    
     if(isFirstChunk){
 
-        NSString *mimeType = [[handle response] contentType];
-        NSString *URLString = [[handle URL] absoluteString];
+        NSString *mimeType = [response contentType];
+        NSString *URLString = [[response URL] absoluteString];
         char *cURL = (char *)malloc([URLString cStringLength]+1);
         [URLString getCString:cURL];
 
-        NSNumber *timeInterval = [[[handle response] headers] objectForKey:@"Last-Modified"];
+        NSNumber *timeInterval = [[response headers] objectForKey:@"Last-Modified"];
         uint32 lastModified;
         
         if(timeInterval){
@@ -140,7 +141,7 @@
         
         npStream.ndata = self;
         npStream.URL = cURL;
-        npStream.end = [[handle response] contentLength];
+        npStream.end = [response contentLength];
         npStream.lastmodified = lastModified;
         npStream.notifyData = notifyData;
         
@@ -275,9 +276,20 @@
 
 @implementation WebNetscapePluginStream (WebResourceHandleDelegate)
 
-- (NSString *)handleWillUseUserAgent:(WebResourceHandle *)handle forURL:(NSURL *)theURL
+-(void)handle:(WebResourceHandle *)handle willSendRequest:(WebResourceRequest *)theRequest
 {
-    return [[view controller] userAgentForURL:theURL];
+    WebController *webController = [view controller];
+    
+    [webController _didStopLoading:URL];
+    // FIXME: This next line is not sufficient. We don't do anything to remember the new URL.
+    [webController _didStartLoading:[theRequest URL]];
+}
+
+- (void)handle:(WebResourceHandle *)handle didReceiveResponse:(WebResourceResponse *)theResponse
+{
+    [theResponse retain];
+    [response release];
+    response = theResponse;
 }
 
 - (void)handle:(WebResourceHandle *)handle didReceiveData:(NSData *)data
@@ -358,7 +370,6 @@
 - (void)handleDidRedirect:(WebResourceHandle *)handle toURL:(NSURL *)toURL
 {
     WebController *controller = [view controller];
-    
     [controller _didStopLoading:URL];
     // FIXME: This next line is not sufficient. We don't do anything to remember the new URL.
     [controller _didStartLoading:toURL];
diff --git a/WebKit/WebCoreSupport.subproj/WebSubresourceClient.h b/WebKit/WebCoreSupport.subproj/WebSubresourceClient.h
index bdc7bb2..f4b29e1 100644
--- a/WebKit/WebCoreSupport.subproj/WebSubresourceClient.h
+++ b/WebKit/WebCoreSupport.subproj/WebSubresourceClient.h
@@ -9,12 +9,14 @@
 #import <WebFoundation/WebResourceHandleDelegate.h>
 
 @class WebDataSource;
+ at class WebResourceResponse;
 @protocol WebCoreResourceHandle;
 @protocol WebCoreResourceLoader;
 
 @interface WebSubresourceClient : NSObject <WebResourceHandleDelegate, WebCoreResourceHandle>
 {
     id <WebCoreResourceLoader> loader;
+    WebResourceResponse *response;
     WebDataSource *dataSource;
     NSURL *currentURL;
     WebResourceHandle *handle;
diff --git a/WebKit/WebCoreSupport.subproj/WebSubresourceClient.m b/WebKit/WebCoreSupport.subproj/WebSubresourceClient.m
index 86fe3c5..0d20692 100644
--- a/WebKit/WebCoreSupport.subproj/WebSubresourceClient.m
+++ b/WebKit/WebCoreSupport.subproj/WebSubresourceClient.m
@@ -10,6 +10,7 @@
 
 #import <WebFoundation/WebError.h>
 #import <WebFoundation/WebResourceHandle.h>
+#import <WebFoundation/WebResourceHandlePrivate.h>
 #import <WebFoundation/WebResourceRequest.h>
 #import <WebFoundation/WebResourceResponse.h>
 
@@ -41,6 +42,7 @@
     [loader release];
     [dataSource release];
     [handle release];
+    [response release];
     
     [super dealloc];
 }
@@ -75,6 +77,7 @@
     [request setResponseCachePolicy:[[source request] responseCachePolicy]];
     [request setReferrer:referrer];
     [request setCookiePolicyBaseURL:[[[[source controller] mainFrame] dataSource] URL]];
+    [request setUserAgent:[[source controller] userAgentForURL:URL]];
     
     if (![WebResourceHandle canInitWithRequest:request]) {
         [request release];
@@ -105,15 +108,41 @@
         partialProgress:[WebLoadProgress progressWithResourceHandle:handle] fromDataSource:dataSource];
 }
 
-- (NSString *)handleWillUseUserAgent:(WebResourceHandle *)h forURL:(NSURL *)URL
+-(void)handle:(WebResourceHandle *)h willSendRequest:(WebResourceRequest *)request
 {
-    return [[dataSource controller] userAgentForURL:URL];
+    ASSERT(handle == h);
+
+    // FIXME: We do want to tell the client about redirects.
+    // But the current API doesn't give any way to tell redirects on
+    // the main page from redirects on subresources, so for now we are
+    // just disabling this. Before, we had code that tried to send the
+    // redirect, but sent it to the wrong object.
+    //[[dataSource _locationChangeHandler] serverRedirectTo:toURL forDataSource:dataSource];
+
+    // FIXME: Need to make sure client sets cookie policy base URL
+    // properly on redirect when we have the new redirect
+    // request-adjusting API
+
+    WebController *controller = [dataSource controller];
+    NSURL *URL = [request URL];
+
+    [request setUserAgent:[controller userAgentForURL:URL]];
+
+    [self didStopLoading];
+    [self didStartLoadingWithURL:URL];
+}
+
+-(void)handle:(WebResourceHandle *)handle didReceiveResponse:(WebResourceResponse *)theResponse
+{
+    [theResponse retain];
+    [response release];
+    response = theResponse;
 }
 
 - (void)handle:(WebResourceHandle *)h didReceiveData:(NSData *)data
 {
     ASSERT(handle == h);
-    ASSERT([currentURL isEqual:[handle URL]]);
+    ASSERT([currentURL isEqual:[[handle _request] canonicalURL]]);
 
     [self receivedProgressWithComplete:NO];
     [loader addData:data];
@@ -122,8 +151,8 @@
 - (void)handleDidFinishLoading:(WebResourceHandle *)h
 {
     ASSERT(handle == h);
-    ASSERT([currentURL isEqual:[handle URL]]);
-    ASSERT([[handle response] statusCode] == WebResourceHandleStatusLoadComplete);
+    ASSERT([currentURL isEqual:[[handle _request] canonicalURL]]);
+    ASSERT([response statusCode] == WebResourceHandleStatusLoadComplete);
 
     // Calling _removeSubresourceClient will likely result in a call to release, so we must retain.
     [self retain];
@@ -132,7 +161,7 @@
     
     [dataSource _removeSubresourceClient:self];
     
-    WebError *nonTerminalError = [[handle response] error];
+    WebError *nonTerminalError = [response error];
     if (nonTerminalError) {
         [self receivedError:nonTerminalError];
     }
@@ -150,7 +179,6 @@
 - (void)handle:(WebResourceHandle *)h didFailLoadingWithError:(WebError *)error
 {
     ASSERT(handle == h);
-    ASSERT([currentURL isEqual:[handle URL]]);
     
     // Calling _removeSubresourceClient will likely result in a call to release, so we must retain.
     [self retain];
@@ -169,27 +197,6 @@
     [self release];
 }
 
-- (void)handleDidRedirect:(WebResourceHandle *)h toURL:(NSURL *)URL
-{
-    ASSERT(handle == h);
-    ASSERT(currentURL != nil);
-    ASSERT([URL isEqual:[handle URL]]);
-
-    // FIXME: We do want to tell the client about redirects.
-    // But the current API doesn't give any way to tell redirects on
-    // the main page from redirects on subresources, so for now we are
-    // just disabling this. Before, we had code that tried to send the
-    // redirect, but sent it to the wrong object.
-    //[[dataSource _locationChangeHandler] serverRedirectTo:toURL forDataSource:dataSource];
-
-    // FIXME: Need to make sure client sets cookie policy base URL
-    // properly on redirect when we have the new redirect
-    // request-adjusting API
-
-    [self didStopLoading];
-    [self didStartLoadingWithURL:URL];
-}
-
 - (void)cancel
 {
     // Calling _removeSubresourceClient will likely result in a call to release, so we must retain.
diff --git a/WebKit/WebCoreSupport.subproj/WebSubresourceLoader.h b/WebKit/WebCoreSupport.subproj/WebSubresourceLoader.h
index bdc7bb2..f4b29e1 100644
--- a/WebKit/WebCoreSupport.subproj/WebSubresourceLoader.h
+++ b/WebKit/WebCoreSupport.subproj/WebSubresourceLoader.h
@@ -9,12 +9,14 @@
 #import <WebFoundation/WebResourceHandleDelegate.h>
 
 @class WebDataSource;
+ at class WebResourceResponse;
 @protocol WebCoreResourceHandle;
 @protocol WebCoreResourceLoader;
 
 @interface WebSubresourceClient : NSObject <WebResourceHandleDelegate, WebCoreResourceHandle>
 {
     id <WebCoreResourceLoader> loader;
+    WebResourceResponse *response;
     WebDataSource *dataSource;
     NSURL *currentURL;
     WebResourceHandle *handle;
diff --git a/WebKit/WebCoreSupport.subproj/WebSubresourceLoader.m b/WebKit/WebCoreSupport.subproj/WebSubresourceLoader.m
index 86fe3c5..0d20692 100644
--- a/WebKit/WebCoreSupport.subproj/WebSubresourceLoader.m
+++ b/WebKit/WebCoreSupport.subproj/WebSubresourceLoader.m
@@ -10,6 +10,7 @@
 
 #import <WebFoundation/WebError.h>
 #import <WebFoundation/WebResourceHandle.h>
+#import <WebFoundation/WebResourceHandlePrivate.h>
 #import <WebFoundation/WebResourceRequest.h>
 #import <WebFoundation/WebResourceResponse.h>
 
@@ -41,6 +42,7 @@
     [loader release];
     [dataSource release];
     [handle release];
+    [response release];
     
     [super dealloc];
 }
@@ -75,6 +77,7 @@
     [request setResponseCachePolicy:[[source request] responseCachePolicy]];
     [request setReferrer:referrer];
     [request setCookiePolicyBaseURL:[[[[source controller] mainFrame] dataSource] URL]];
+    [request setUserAgent:[[source controller] userAgentForURL:URL]];
     
     if (![WebResourceHandle canInitWithRequest:request]) {
         [request release];
@@ -105,15 +108,41 @@
         partialProgress:[WebLoadProgress progressWithResourceHandle:handle] fromDataSource:dataSource];
 }
 
-- (NSString *)handleWillUseUserAgent:(WebResourceHandle *)h forURL:(NSURL *)URL
+-(void)handle:(WebResourceHandle *)h willSendRequest:(WebResourceRequest *)request
 {
-    return [[dataSource controller] userAgentForURL:URL];
+    ASSERT(handle == h);
+
+    // FIXME: We do want to tell the client about redirects.
+    // But the current API doesn't give any way to tell redirects on
+    // the main page from redirects on subresources, so for now we are
+    // just disabling this. Before, we had code that tried to send the
+    // redirect, but sent it to the wrong object.
+    //[[dataSource _locationChangeHandler] serverRedirectTo:toURL forDataSource:dataSource];
+
+    // FIXME: Need to make sure client sets cookie policy base URL
+    // properly on redirect when we have the new redirect
+    // request-adjusting API
+
+    WebController *controller = [dataSource controller];
+    NSURL *URL = [request URL];
+
+    [request setUserAgent:[controller userAgentForURL:URL]];
+
+    [self didStopLoading];
+    [self didStartLoadingWithURL:URL];
+}
+
+-(void)handle:(WebResourceHandle *)handle didReceiveResponse:(WebResourceResponse *)theResponse
+{
+    [theResponse retain];
+    [response release];
+    response = theResponse;
 }
 
 - (void)handle:(WebResourceHandle *)h didReceiveData:(NSData *)data
 {
     ASSERT(handle == h);
-    ASSERT([currentURL isEqual:[handle URL]]);
+    ASSERT([currentURL isEqual:[[handle _request] canonicalURL]]);
 
     [self receivedProgressWithComplete:NO];
     [loader addData:data];
@@ -122,8 +151,8 @@
 - (void)handleDidFinishLoading:(WebResourceHandle *)h
 {
     ASSERT(handle == h);
-    ASSERT([currentURL isEqual:[handle URL]]);
-    ASSERT([[handle response] statusCode] == WebResourceHandleStatusLoadComplete);
+    ASSERT([currentURL isEqual:[[handle _request] canonicalURL]]);
+    ASSERT([response statusCode] == WebResourceHandleStatusLoadComplete);
 
     // Calling _removeSubresourceClient will likely result in a call to release, so we must retain.
     [self retain];
@@ -132,7 +161,7 @@
     
     [dataSource _removeSubresourceClient:self];
     
-    WebError *nonTerminalError = [[handle response] error];
+    WebError *nonTerminalError = [response error];
     if (nonTerminalError) {
         [self receivedError:nonTerminalError];
     }
@@ -150,7 +179,6 @@
 - (void)handle:(WebResourceHandle *)h didFailLoadingWithError:(WebError *)error
 {
     ASSERT(handle == h);
-    ASSERT([currentURL isEqual:[handle URL]]);
     
     // Calling _removeSubresourceClient will likely result in a call to release, so we must retain.
     [self retain];
@@ -169,27 +197,6 @@
     [self release];
 }
 
-- (void)handleDidRedirect:(WebResourceHandle *)h toURL:(NSURL *)URL
-{
-    ASSERT(handle == h);
-    ASSERT(currentURL != nil);
-    ASSERT([URL isEqual:[handle URL]]);
-
-    // FIXME: We do want to tell the client about redirects.
-    // But the current API doesn't give any way to tell redirects on
-    // the main page from redirects on subresources, so for now we are
-    // just disabling this. Before, we had code that tried to send the
-    // redirect, but sent it to the wrong object.
-    //[[dataSource _locationChangeHandler] serverRedirectTo:toURL forDataSource:dataSource];
-
-    // FIXME: Need to make sure client sets cookie policy base URL
-    // properly on redirect when we have the new redirect
-    // request-adjusting API
-
-    [self didStopLoading];
-    [self didStartLoadingWithURL:URL];
-}
-
 - (void)cancel
 {
     // Calling _removeSubresourceClient will likely result in a call to release, so we must retain.
diff --git a/WebKit/WebView.subproj/WebControllerPrivate.m b/WebKit/WebView.subproj/WebControllerPrivate.m
index e3ab36b..658915e 100644
--- a/WebKit/WebView.subproj/WebControllerPrivate.m
+++ b/WebKit/WebView.subproj/WebControllerPrivate.m
@@ -23,6 +23,7 @@
 #import <WebFoundation/WebError.h>
 #import <WebFoundation/WebFileTypeMappings.h>
 #import <WebFoundation/WebResourceHandle.h>
+#import <WebFoundation/WebResourceHandlePrivate.h>
 #import <WebFoundation/WebResourceRequest.h>
 
 @implementation WebControllerPrivate
@@ -163,7 +164,7 @@
 
     [[self resourceProgressDelegate] receivedError: error forResourceHandle: resourceHandle partialProgress: progress fromDataSource: dataSource];
 
-    NSString *resourceIdentifier = [[[resourceHandle request] URL] absoluteString];
+    NSString *resourceIdentifier = [[[resourceHandle _request] URL] absoluteString];
     if (resourceIdentifier == nil) {
         resourceIdentifier = [error failingURL];
     }
diff --git a/WebKit/WebView.subproj/WebDataSourcePrivate.h b/WebKit/WebView.subproj/WebDataSourcePrivate.h
index 32a2db4..1c5957c 100644
--- a/WebKit/WebView.subproj/WebDataSourcePrivate.h
+++ b/WebKit/WebView.subproj/WebDataSourcePrivate.h
@@ -31,6 +31,7 @@
     
     // The original URL as requested during initialization.
     NSURL *inputURL;
+    WebResourceRequest *originalRequest;
     WebResourceRequest *request;
 
     // The original URL we may have been redirected to.
@@ -98,6 +99,7 @@
 - (double)_loadingStartedTime;
 - (void)_setTitle:(NSString *)title;
 - (void)_setURL:(NSURL *)URL;
+- (void)_setRequest:(WebResourceRequest *)request;
 - (void)_setContentPolicy:(WebContentPolicy *)policy;
 - (void)_setContentType:(NSString *)type;
 - (void)_setEncoding:(NSString *)encoding;
diff --git a/WebKit/WebView.subproj/WebDataSourcePrivate.m b/WebKit/WebView.subproj/WebDataSourcePrivate.m
index 0f688fa..5860cb7 100644
--- a/WebKit/WebView.subproj/WebDataSourcePrivate.m
+++ b/WebKit/WebView.subproj/WebDataSourcePrivate.m
@@ -195,7 +195,7 @@
     }
     
     if (_private->mainHandle) {
-        [_private->mainClient didStartLoadingWithURL:[_private->mainHandle URL]];
+        [_private->mainClient didStartLoadingWithURL:[_private->request URL]];
     }
 }
 
@@ -301,6 +301,16 @@
     [[_private->controller locationChangeDelegate] serverRedirectTo:URL forDataSource:self];
 }
 
+- (void)_setRequest:(WebResourceRequest *)request
+{
+    if (_private->request != request) {
+        [request retain];
+        [_private->request release];
+        _private->request = request;
+        [self _setURL:[request URL]];
+    }
+}
+
 - (void) _setContentPolicy:(WebContentPolicy *)policy
 {
     [_private->contentPolicy release];
diff --git a/WebKit/WebView.subproj/WebLoadProgress.m b/WebKit/WebView.subproj/WebLoadProgress.m
index 8db6564..52bd21b 100644
--- a/WebKit/WebView.subproj/WebLoadProgress.m
+++ b/WebKit/WebView.subproj/WebLoadProgress.m
@@ -6,6 +6,7 @@
 #import <WebKit/WebLoadProgress.h>
 
 #import <WebFoundation/WebResourceHandle.h>
+#import <WebFoundation/WebResourceHandlePrivate.h>
 #import <WebFoundation/WebResourceResponse.h>
 
 @implementation WebLoadProgress
@@ -29,7 +30,7 @@
 
 - (id)initWithResourceHandle:(WebResourceHandle *)handle
 {
-    WebResourceResponse *theResponse = [handle response];
+    WebResourceResponse *theResponse = [handle _response];
     if (theResponse == nil) {
         return [self init];
     }
diff --git a/WebKit/WebView.subproj/WebMainResourceClient.h b/WebKit/WebView.subproj/WebMainResourceClient.h
index 26023d9..bd741eb 100644
--- a/WebKit/WebView.subproj/WebMainResourceClient.h
+++ b/WebKit/WebView.subproj/WebMainResourceClient.h
@@ -13,12 +13,14 @@
 @class WebDownloadHandler;
 @class WebDataSource;
 @class WebResourceHandle;
+ at class WebResourceResponse;
 @protocol WebResourceHandleDelegate;
 @protocol WebResourceProgressDelegate;
 
 @interface WebMainResourceClient : NSObject <WebResourceHandleDelegate>
 {
     NSURL *currentURL;
+    WebResourceResponse *response;
     WebDataSource *dataSource;
     BOOL isFirstChunk;
     BOOL suppressErrors;
diff --git a/WebKit/WebView.subproj/WebMainResourceClient.m b/WebKit/WebView.subproj/WebMainResourceClient.m
index 034b93c..353ee84 100644
--- a/WebKit/WebView.subproj/WebMainResourceClient.m
+++ b/WebKit/WebView.subproj/WebMainResourceClient.m
@@ -22,6 +22,7 @@
 #import <WebFoundation/WebError.h>
 #import <WebFoundation/WebFileTypeMappings.h>
 #import <WebFoundation/WebResourceHandle.h>
+#import <WebFoundation/WebResourceHandlePrivate.h>
 #import <WebFoundation/WebResourceRequest.h>
 #import <WebFoundation/WebResourceResponse.h>
 #import <WebFoundation/WebCookieConstants.h>
@@ -38,6 +39,12 @@
         dataSource = [ds retain];
         resourceData = [[NSMutableData alloc] init];
         isFirstChunk = YES;
+        
+        // set the user agent for the request
+        // consult the data source's controller
+        WebController *controller = [dataSource controller];
+        WebResourceRequest *request = [dataSource request];
+        [request setUserAgent:[controller userAgentForURL:[request URL]]];
     }
 
     return self;
@@ -66,6 +73,7 @@
     [downloadProgressDelegate release];
     [resourceData release];
     [dataSource release];
+    [response release];
     
     [super dealloc];
 }
@@ -115,19 +123,13 @@
     }
 }
 
-- (NSString *)handleWillUseUserAgent:(WebResourceHandle *)handle forURL:(NSURL *)URL
-{
-    ASSERT([dataSource controller]);
-    return [[dataSource controller] userAgentForURL:URL];
-}
-
 - (void)didCancelWithHandle:(WebResourceHandle *)handle
 {
     if (currentURL == nil) {
         return;
     }
     
-    LOG(Loading, "URL = %@", [handle URL]);
+    LOG(Loading, "URL = %@", [[handle _request] URL]);
     
     // Calling receivedError will likely result in a call to release, so we must retain.
     [self retain];
@@ -155,10 +157,10 @@
 
 - (void)handleDidFinishLoading:(WebResourceHandle *)handle
 {
-    LOG(Loading, "URL = %@", [handle URL]);
+    LOG(Loading, "URL = %@", [[handle _request] URL]);
     
-    ASSERT([currentURL isEqual:[handle URL]]);
-    ASSERT([[handle response] statusCode] == WebResourceHandleStatusLoadComplete);
+    ASSERT([currentURL isEqual:[[handle _request] URL]]);
+    ASSERT([response statusCode] == WebResourceHandleStatusLoadComplete);
 
     // Calling receivedError will likely result in a call to release, so we must retain.
     [self retain];
@@ -175,7 +177,7 @@
     }
     
     // Either send a final error message or a final progress message.
-    WebError *nonTerminalError = [[handle response] error];
+    WebError *nonTerminalError = [response error];
     if (nonTerminalError) {
         [self receivedError:nonTerminalError forHandle:handle];
     } else {
@@ -196,16 +198,40 @@
     [self release];
 }
 
+-(void)handle:(WebResourceHandle *)handle willSendRequest:(WebResourceRequest *)request
+{
+    WebController *controller = [dataSource controller];
+    NSURL *URL = [request URL];
+
+    LOG(Redirect, "URL = %@", URL);
+
+    // FIXME: need to update main document URL here, or cookies set
+    // via redirects might not work in main document mode
+
+    [request setUserAgent:[controller userAgentForURL:URL]];
+    [dataSource _setRequest:request];
+
+    [self didStopLoading];
+    [self didStartLoadingWithURL:URL];
+}
+
+-(void)handle:(WebResourceHandle *)handle didReceiveResponse:(WebResourceResponse *)theResponse
+{
+    [theResponse retain];
+    [response release];
+    response = theResponse;
+}
+
 - (void)handle:(WebResourceHandle *)handle didReceiveData:(NSData *)data
 {
     WebController *controller = [dataSource controller];
-    NSString *contentType = [[handle response] contentType];
+    NSString *contentType = [response contentType];
     WebFrame *frame = [dataSource webFrame];
     WebError *downloadError = nil;
     
-    LOG(Loading, "URL = %@, data = %p, length %d", [handle URL], data, [data length]);
+    LOG(Loading, "URL = %@, data = %p, length %d", [[handle _request] URL], data, [data length]);
     
-    ASSERT([currentURL isEqual:[handle URL]]);
+    ASSERT([currentURL isEqual:[[handle _request] URL]]);
     
     // Check the mime type and ask the client for the content policy.
     if(isFirstChunk){
@@ -215,7 +241,7 @@
             contentType = @"text/html";
         
         [dataSource _setContentType:contentType];
-        [dataSource _setEncoding:[[handle response] characterSet]];
+        [dataSource _setEncoding:[response characterSet]];
         
         // retain the downloadProgressDelegate just in case this is a download.
         // Alexander releases the WebController if no window is created for it.
@@ -268,15 +294,13 @@
         [handle cancel];
     }
     
-    LOG(Download, "%d of %d", [[handle response] contentLengthReceived], [[handle response] contentLength]);
+    LOG(Download, "%d of %d", [response contentLengthReceived], [response contentLength]);
     isFirstChunk = NO;
 }
 
 - (void)handle:(WebResourceHandle *)handle didFailLoadingWithError:(WebError *)result
 {
-    LOG(Loading, "URL = %@, result = %@", [handle URL], [result errorDescription]);
-
-    ASSERT([currentURL isEqual:[handle URL]]);
+    LOG(Loading, "URL = %@, result = %@", [result failingURL], [result errorDescription]);
 
     // Calling receivedError will likely result in a call to release, so we must retain.
     [self retain];
@@ -297,20 +321,4 @@
     [self release];
 }
 
-- (void)handleDidRedirect:(WebResourceHandle *)handle toURL:(NSURL *)URL
-{
-    LOG(Redirect, "URL = %@", URL);
-
-    // FIXME: need to update main document URL here, or cookies set
-    // via redirects might not work in main document mode
-
-    ASSERT(currentURL != nil);
-    ASSERT([URL isEqual:[handle URL]]);
-    
-    [dataSource _setURL:URL];
-
-    [self didStopLoading];
-    [self didStartLoadingWithURL:URL];
-}
-
 @end
diff --git a/WebKit/WebView.subproj/WebMainResourceLoader.h b/WebKit/WebView.subproj/WebMainResourceLoader.h
index 26023d9..bd741eb 100644
--- a/WebKit/WebView.subproj/WebMainResourceLoader.h
+++ b/WebKit/WebView.subproj/WebMainResourceLoader.h
@@ -13,12 +13,14 @@
 @class WebDownloadHandler;
 @class WebDataSource;
 @class WebResourceHandle;
+ at class WebResourceResponse;
 @protocol WebResourceHandleDelegate;
 @protocol WebResourceProgressDelegate;
 
 @interface WebMainResourceClient : NSObject <WebResourceHandleDelegate>
 {
     NSURL *currentURL;
+    WebResourceResponse *response;
     WebDataSource *dataSource;
     BOOL isFirstChunk;
     BOOL suppressErrors;
diff --git a/WebKit/WebView.subproj/WebMainResourceLoader.m b/WebKit/WebView.subproj/WebMainResourceLoader.m
index 034b93c..353ee84 100644
--- a/WebKit/WebView.subproj/WebMainResourceLoader.m
+++ b/WebKit/WebView.subproj/WebMainResourceLoader.m
@@ -22,6 +22,7 @@
 #import <WebFoundation/WebError.h>
 #import <WebFoundation/WebFileTypeMappings.h>
 #import <WebFoundation/WebResourceHandle.h>
+#import <WebFoundation/WebResourceHandlePrivate.h>
 #import <WebFoundation/WebResourceRequest.h>
 #import <WebFoundation/WebResourceResponse.h>
 #import <WebFoundation/WebCookieConstants.h>
@@ -38,6 +39,12 @@
         dataSource = [ds retain];
         resourceData = [[NSMutableData alloc] init];
         isFirstChunk = YES;
+        
+        // set the user agent for the request
+        // consult the data source's controller
+        WebController *controller = [dataSource controller];
+        WebResourceRequest *request = [dataSource request];
+        [request setUserAgent:[controller userAgentForURL:[request URL]]];
     }
 
     return self;
@@ -66,6 +73,7 @@
     [downloadProgressDelegate release];
     [resourceData release];
     [dataSource release];
+    [response release];
     
     [super dealloc];
 }
@@ -115,19 +123,13 @@
     }
 }
 
-- (NSString *)handleWillUseUserAgent:(WebResourceHandle *)handle forURL:(NSURL *)URL
-{
-    ASSERT([dataSource controller]);
-    return [[dataSource controller] userAgentForURL:URL];
-}
-
 - (void)didCancelWithHandle:(WebResourceHandle *)handle
 {
     if (currentURL == nil) {
         return;
     }
     
-    LOG(Loading, "URL = %@", [handle URL]);
+    LOG(Loading, "URL = %@", [[handle _request] URL]);
     
     // Calling receivedError will likely result in a call to release, so we must retain.
     [self retain];
@@ -155,10 +157,10 @@
 
 - (void)handleDidFinishLoading:(WebResourceHandle *)handle
 {
-    LOG(Loading, "URL = %@", [handle URL]);
+    LOG(Loading, "URL = %@", [[handle _request] URL]);
     
-    ASSERT([currentURL isEqual:[handle URL]]);
-    ASSERT([[handle response] statusCode] == WebResourceHandleStatusLoadComplete);
+    ASSERT([currentURL isEqual:[[handle _request] URL]]);
+    ASSERT([response statusCode] == WebResourceHandleStatusLoadComplete);
 
     // Calling receivedError will likely result in a call to release, so we must retain.
     [self retain];
@@ -175,7 +177,7 @@
     }
     
     // Either send a final error message or a final progress message.
-    WebError *nonTerminalError = [[handle response] error];
+    WebError *nonTerminalError = [response error];
     if (nonTerminalError) {
         [self receivedError:nonTerminalError forHandle:handle];
     } else {
@@ -196,16 +198,40 @@
     [self release];
 }
 
+-(void)handle:(WebResourceHandle *)handle willSendRequest:(WebResourceRequest *)request
+{
+    WebController *controller = [dataSource controller];
+    NSURL *URL = [request URL];
+
+    LOG(Redirect, "URL = %@", URL);
+
+    // FIXME: need to update main document URL here, or cookies set
+    // via redirects might not work in main document mode
+
+    [request setUserAgent:[controller userAgentForURL:URL]];
+    [dataSource _setRequest:request];
+
+    [self didStopLoading];
+    [self didStartLoadingWithURL:URL];
+}
+
+-(void)handle:(WebResourceHandle *)handle didReceiveResponse:(WebResourceResponse *)theResponse
+{
+    [theResponse retain];
+    [response release];
+    response = theResponse;
+}
+
 - (void)handle:(WebResourceHandle *)handle didReceiveData:(NSData *)data
 {
     WebController *controller = [dataSource controller];
-    NSString *contentType = [[handle response] contentType];
+    NSString *contentType = [response contentType];
     WebFrame *frame = [dataSource webFrame];
     WebError *downloadError = nil;
     
-    LOG(Loading, "URL = %@, data = %p, length %d", [handle URL], data, [data length]);
+    LOG(Loading, "URL = %@, data = %p, length %d", [[handle _request] URL], data, [data length]);
     
-    ASSERT([currentURL isEqual:[handle URL]]);
+    ASSERT([currentURL isEqual:[[handle _request] URL]]);
     
     // Check the mime type and ask the client for the content policy.
     if(isFirstChunk){
@@ -215,7 +241,7 @@
             contentType = @"text/html";
         
         [dataSource _setContentType:contentType];
-        [dataSource _setEncoding:[[handle response] characterSet]];
+        [dataSource _setEncoding:[response characterSet]];
         
         // retain the downloadProgressDelegate just in case this is a download.
         // Alexander releases the WebController if no window is created for it.
@@ -268,15 +294,13 @@
         [handle cancel];
     }
     
-    LOG(Download, "%d of %d", [[handle response] contentLengthReceived], [[handle response] contentLength]);
+    LOG(Download, "%d of %d", [response contentLengthReceived], [response contentLength]);
     isFirstChunk = NO;
 }
 
 - (void)handle:(WebResourceHandle *)handle didFailLoadingWithError:(WebError *)result
 {
-    LOG(Loading, "URL = %@, result = %@", [handle URL], [result errorDescription]);
-
-    ASSERT([currentURL isEqual:[handle URL]]);
+    LOG(Loading, "URL = %@, result = %@", [result failingURL], [result errorDescription]);
 
     // Calling receivedError will likely result in a call to release, so we must retain.
     [self retain];
@@ -297,20 +321,4 @@
     [self release];
 }
 
-- (void)handleDidRedirect:(WebResourceHandle *)handle toURL:(NSURL *)URL
-{
-    LOG(Redirect, "URL = %@", URL);
-
-    // FIXME: need to update main document URL here, or cookies set
-    // via redirects might not work in main document mode
-
-    ASSERT(currentURL != nil);
-    ASSERT([URL isEqual:[handle URL]]);
-    
-    [dataSource _setURL:URL];
-
-    [self didStopLoading];
-    [self didStartLoadingWithURL:URL];
-}
-
 @end
diff --git a/WebKit/WebView.subproj/WebViewPrivate.m b/WebKit/WebView.subproj/WebViewPrivate.m
index e3ab36b..658915e 100644
--- a/WebKit/WebView.subproj/WebViewPrivate.m
+++ b/WebKit/WebView.subproj/WebViewPrivate.m
@@ -23,6 +23,7 @@
 #import <WebFoundation/WebError.h>
 #import <WebFoundation/WebFileTypeMappings.h>
 #import <WebFoundation/WebResourceHandle.h>
+#import <WebFoundation/WebResourceHandlePrivate.h>
 #import <WebFoundation/WebResourceRequest.h>
 
 @implementation WebControllerPrivate
@@ -163,7 +164,7 @@
 
     [[self resourceProgressDelegate] receivedError: error forResourceHandle: resourceHandle partialProgress: progress fromDataSource: dataSource];
 
-    NSString *resourceIdentifier = [[[resourceHandle request] URL] absoluteString];
+    NSString *resourceIdentifier = [[[resourceHandle _request] URL] absoluteString];
     if (resourceIdentifier == nil) {
         resourceIdentifier = [error failingURL];
     }

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list