2005-03-10 Richard Williamson <rjw@apple.com>
Fixed <rdar://problem/
4040321> Exception: Someone's trying to encode a WebDataRequestParameters instance
Reviewed by Darin.
If a delegate returns a mutated applewebdata: request in it's willSendRequest:
method, we don't load using the WebDataRequest. Instead we do a normal load.
Unfortunately, if the request they return is mutated *copy* of the applewebdata:
request it will hold the applewebdata: special properties. These properties
will be encoded into the cache. They should not be. So, to fix, we sanitize the
request, by removing the special properties from the request.
Note that we had to dig into the private guts of NSURLRequest because there is
no public mechanism to remove properties from a request, see
4046775.
* WebView.subproj/WebBaseResourceHandleDelegate.m:
(-[WebBaseResourceHandleDelegate willSendRequest:redirectResponse:]):
* WebView.subproj/WebDataProtocol.h:
* WebView.subproj/WebDataProtocol.m:
(-[NSURLRequest _webDataRequestExternalRequest]):
(-[NSURLRequest _webDataRequestSanitize]):
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@8882
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2005-03-14 Vicki Murley <vicki@apple.com>
+
+ - roll out the fix for 4040321, since it is still pending CCC review.
+
+ 2005-03-10 Richard Williamson <rjw@apple.com>
+
+ Fixed <rdar://problem/4040321> Exception: Someone's trying to encode a WebDataRequestParameters instance
+
+ Reviewed by Darin.
+
+ If a delegate returns a mutated applewebdata: request in it's willSendRequest:
+ method, we don't load using the WebDataRequest. Instead we do a normal load.
+ Unfortunately, if the request they return is mutated *copy* of the applewebdata:
+ request it will hold the applewebdata: special properties. These properties
+ will be encoded into the cache. They should not be. So, to fix, we sanitize the
+ request, by removing the special properties from the request.
+
+ Note that we had to dig into the private guts of NSURLRequest because there is
+ no public mechanism to remove properties from a request, see 4046775.
+
+ * WebView.subproj/WebBaseResourceHandleDelegate.m:
+ (-[WebBaseResourceHandleDelegate willSendRequest:redirectResponse:]):
+ * WebView.subproj/WebDataProtocol.h:
+ * WebView.subproj/WebDataProtocol.m:
+ (-[NSURLRequest _webDataRequestExternalRequest]):
+ (-[NSURLRequest _webDataRequestSanitize]):
+
=== Safari-406 ===
2005-03-13 Darin Adler <darin@apple.com>
newRequest = [mutableRequest autorelease];
clientRequest = [newRequest _webDataRequestExternalRequest];
- if(!clientRequest) {
+ if(!clientRequest)
clientRequest = newRequest;
- }
- else {
+ else
haveDataSchemeRequest = YES;
- }
if (identifier == nil) {
// The identifier is released after the last callback, rather than in dealloc
// If the delegate modified the request use that instead of
// our applewebdata request, otherwise use the original
// applewebdata request.
- if (![updatedRequest isEqual:clientRequest]) {
+ if (![updatedRequest isEqual:clientRequest])
newRequest = updatedRequest;
- // Sanitize the request, so that the WebDataRequest properties
- // don't end up getting cached.
- [newRequest _webDataRequestSanitize];
- }
}
// Store a copy of the request.
- (NSString *)_webDataRequestEncoding;
- (NSString *)_webDataRequestMIMEType;
- (NSMutableURLRequest *)_webDataRequestExternalRequest;
-- (void)_webDataRequestSanitize;
@end
@interface NSMutableURLRequest (WebDataRequest)
@end
-// This private interface declaration is need because NSURLProtocol
-// has no mechanism to remove a property from a NSURLRequest.
-// See 4046775.
-@interface _NSURLRequestInternal : NSObject
-{
- @public
- NSURL *URL;
- NSURLRequestCachePolicy cachePolicy;
- NSTimeInterval timeoutInterval;
- NSURL *mainDocumentURL;
- NSMutableDictionary *properties;
-}
-@end
-
@implementation NSURLRequest (WebDataRequest)
return newRequest;
}
-- (void)_webDataRequestSanitize
-{
- _NSURLRequestInternal *internal = (_NSURLRequestInternal *)_internal;
- [internal->properties removeObjectForKey:WebDataRequestPropertyKey];
-}
-
@end
@implementation NSMutableURLRequest (WebDataRequest)
newRequest = [mutableRequest autorelease];
clientRequest = [newRequest _webDataRequestExternalRequest];
- if(!clientRequest) {
+ if(!clientRequest)
clientRequest = newRequest;
- }
- else {
+ else
haveDataSchemeRequest = YES;
- }
if (identifier == nil) {
// The identifier is released after the last callback, rather than in dealloc
// If the delegate modified the request use that instead of
// our applewebdata request, otherwise use the original
// applewebdata request.
- if (![updatedRequest isEqual:clientRequest]) {
+ if (![updatedRequest isEqual:clientRequest])
newRequest = updatedRequest;
- // Sanitize the request, so that the WebDataRequest properties
- // don't end up getting cached.
- [newRequest _webDataRequestSanitize];
- }
}
// Store a copy of the request.