Not reviewed, fix for accidental commit.
authormjs <mjs@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 3 Nov 2006 22:28:20 +0000 (22:28 +0000)
committermjs <mjs@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 3 Nov 2006 22:28:20 +0000 (22:28 +0000)
        - roll back some network changes accidentally committed with a previous patch.

        * WebCore.xcodeproj/project.pbxproj:
        * bridge/mac/WebCoreFrameBridge.mm:
        (-[WebCoreFrameBridge getData:andResponse:forURL:]):
        (-[WebCoreFrameBridge getAllResourceDatas:andResponses:]):
        * loader/CachedCSSStyleSheet.cpp:
        (WebCore::CachedCSSStyleSheet::checkNotify):
        * loader/CachedImage.cpp:
        (WebCore::CachedImage::createImage):
        * loader/CachedResource.cpp:
        (WebCore::CachedResource::CachedResource):
        (WebCore::CachedResource::~CachedResource):
        (WebCore::CachedResource::setExpireDate):
        (WebCore::CachedResource::isExpired):
        * loader/CachedResource.h:
        (WebCore::CachedResource::response):
        * loader/LoaderFunctions.h:
        * loader/loader.cpp:
        (WebCore::Loader::receivedResponse):
        (WebCore::Loader::didReceivedResponse):
        * loader/loader.h:
        * loader/mac/FormDataStream.h:
        * loader/mac/FormDataStream.m:
        (WebCore::formCreate):
        (WebCore::formFinalize):
        * loader/mac/ImageDocumentMac.mm:
        (WebCore::finishImageLoad):
        * loader/mac/LoaderFunctionsMac.mm:
        (WebCore::CheckCacheObjectStatus):
        (WebCore::CachedResource::setResponse):
        * loader/mac/SubresourceLoaderMac.mm:
        (WebCore::SubresourceLoader::willSendRequest):
        * platform/network/ResourceHandle.h:
        * platform/network/ResourceHandleClient.h:
        (WebCore::ResourceHandleClient::receivedRedirect):
        * platform/network/ResourceRequest.h:
        * platform/network/ResourceResponse.h:
        (WebCore::ResourceResponse::ResourceResponse):
        * platform/network/mac/ResourceHandleMac.mm:
        (WebCore::ResourceHandle::redirectedToURL):
        * xml/xmlhttprequest.cpp:
        (WebCore::XMLHttpRequest::receivedRedirect):
        * xml/xmlhttprequest.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@17582 268f45cc-cd09-0410-ab3c-d52691b4dbfc

22 files changed:
WebCore/ChangeLog
WebCore/WebCore.xcodeproj/project.pbxproj
WebCore/bridge/mac/WebCoreFrameBridge.mm
WebCore/loader/CachedCSSStyleSheet.cpp
WebCore/loader/CachedImage.cpp
WebCore/loader/CachedResource.cpp
WebCore/loader/CachedResource.h
WebCore/loader/LoaderFunctions.h
WebCore/loader/loader.cpp
WebCore/loader/loader.h
WebCore/loader/mac/FormDataStream.h
WebCore/loader/mac/FormDataStream.m
WebCore/loader/mac/ImageDocumentMac.mm
WebCore/loader/mac/LoaderFunctionsMac.mm
WebCore/loader/mac/SubresourceLoaderMac.mm
WebCore/platform/network/ResourceHandle.h
WebCore/platform/network/ResourceHandleClient.h
WebCore/platform/network/ResourceRequest.h
WebCore/platform/network/ResourceResponse.h
WebCore/platform/network/mac/ResourceHandleMac.mm
WebCore/xml/xmlhttprequest.cpp
WebCore/xml/xmlhttprequest.h

index de6b9ab891a0ba5536830d4b8659b8fcaa35c35f..e944d363b335dde80602132381eddf2851ff5e92 100644 (file)
@@ -1,3 +1,52 @@
+2006-11-03  Maciej Stachowiak  <mjs@apple.com>
+
+        Not reviewed, fix for accidental commit.
+
+        - roll back some network changes accidentally committed with a previous patch.
+
+        * WebCore.xcodeproj/project.pbxproj:
+        * bridge/mac/WebCoreFrameBridge.mm:
+        (-[WebCoreFrameBridge getData:andResponse:forURL:]):
+        (-[WebCoreFrameBridge getAllResourceDatas:andResponses:]):
+        * loader/CachedCSSStyleSheet.cpp:
+        (WebCore::CachedCSSStyleSheet::checkNotify):
+        * loader/CachedImage.cpp:
+        (WebCore::CachedImage::createImage):
+        * loader/CachedResource.cpp:
+        (WebCore::CachedResource::CachedResource):
+        (WebCore::CachedResource::~CachedResource):
+        (WebCore::CachedResource::setExpireDate):
+        (WebCore::CachedResource::isExpired):
+        * loader/CachedResource.h:
+        (WebCore::CachedResource::response):
+        * loader/LoaderFunctions.h:
+        * loader/loader.cpp:
+        (WebCore::Loader::receivedResponse):
+        (WebCore::Loader::didReceivedResponse):
+        * loader/loader.h:
+        * loader/mac/FormDataStream.h:
+        * loader/mac/FormDataStream.m:
+        (WebCore::formCreate):
+        (WebCore::formFinalize):
+        * loader/mac/ImageDocumentMac.mm:
+        (WebCore::finishImageLoad):
+        * loader/mac/LoaderFunctionsMac.mm:
+        (WebCore::CheckCacheObjectStatus):
+        (WebCore::CachedResource::setResponse):
+        * loader/mac/SubresourceLoaderMac.mm:
+        (WebCore::SubresourceLoader::willSendRequest):
+        * platform/network/ResourceHandle.h:
+        * platform/network/ResourceHandleClient.h:
+        (WebCore::ResourceHandleClient::receivedRedirect):
+        * platform/network/ResourceRequest.h:
+        * platform/network/ResourceResponse.h:
+        (WebCore::ResourceResponse::ResourceResponse):
+        * platform/network/mac/ResourceHandleMac.mm:
+        (WebCore::ResourceHandle::redirectedToURL):
+        * xml/xmlhttprequest.cpp:
+        (WebCore::XMLHttpRequest::receivedRedirect):
+        * xml/xmlhttprequest.h:
+
 2006-11-03  Anders Carlsson  <acarlsson@apple.com>
 
         Rubber-stamped by Oliver.
index 7020e5132684b99864e189562e48022fe54a1260..f3e3e3f3762f63b68bb0b16f5ee646daf713ab7b 100644 (file)
                51F11E150A48C2920034A24E /* SQLTransaction.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51F11E140A48C2920034A24E /* SQLTransaction.cpp */; };
                550A0BC9085F6039007353D6 /* QualifiedName.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 550A0BC7085F6039007353D6 /* QualifiedName.cpp */; };
                550A0BCA085F6039007353D6 /* QualifiedName.h in Headers */ = {isa = PBXBuildFile; fileRef = 550A0BC8085F6039007353D6 /* QualifiedName.h */; settings = {ATTRIBUTES = (Private, ); }; };
-               650E3F690AF6C168001FA3AD /* ResourceRequestMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 650E3F670AF6C168001FA3AD /* ResourceRequestMac.h */; };
-               650E3F6A0AF6C168001FA3AD /* ResourceRequestMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 650E3F680AF6C168001FA3AD /* ResourceRequestMac.mm */; };
                650F53DC09D15DDA00C9B0C8 /* CSSGrammar.h in Headers */ = {isa = PBXBuildFile; fileRef = 650F53DB09D15DDA00C9B0C8 /* CSSGrammar.h */; };
                650F53DD09D15DDF00C9B0C8 /* CSSGrammar.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6565814409D13043000E61D7 /* CSSGrammar.cpp */; };
                651B4D8509AC83370029F1EF /* DeprecatedStringList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 651B4D8309AC83370029F1EF /* DeprecatedStringList.cpp */; };
                6550B6A6099DF0270090D781 /* Text.h in Headers */ = {isa = PBXBuildFile; fileRef = 6550B69C099DF0270090D781 /* Text.h */; settings = {ATTRIBUTES = (Private, ); }; };
                6552E7AA096AA11B0006F248 /* WebCoreFrameNamespaces.h in Headers */ = {isa = PBXBuildFile; fileRef = 6552E7A8096AA11B0006F248 /* WebCoreFrameNamespaces.h */; settings = {ATTRIBUTES = (Private, ); }; };
                6552E7AB096AA11B0006F248 /* WebCoreFrameNamespaces.mm in Sources */ = {isa = PBXBuildFile; fileRef = 6552E7A9096AA11B0006F248 /* WebCoreFrameNamespaces.mm */; };
-               655A81BE0AEF67E6000975F0 /* HTTPHeaderMap.h in Headers */ = {isa = PBXBuildFile; fileRef = 655A81BD0AEF67E6000975F0 /* HTTPHeaderMap.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               655A81BE0AEF67E6000975F0 /* HTTPHeaderMap.h in Headers */ = {isa = PBXBuildFile; fileRef = 655A81BD0AEF67E6000975F0 /* HTTPHeaderMap.h */; };
                6563A9A70ADF4094000ED2CD /* LoaderNSURLRequestExtras.h in Headers */ = {isa = PBXBuildFile; fileRef = 6563A9A50ADF4094000ED2CD /* LoaderNSURLRequestExtras.h */; };
                6563A9A80ADF4094000ED2CD /* LoaderNSURLRequestExtras.m in Sources */ = {isa = PBXBuildFile; fileRef = 6563A9A60ADF4094000ED2CD /* LoaderNSURLRequestExtras.m */; };
                656580F409D12B20000E61D7 /* CSSPropertyNames.h in Headers */ = {isa = PBXBuildFile; fileRef = 656580EF09D12B20000E61D7 /* CSSPropertyNames.h */; };
                6582A16309999D6D00BEEB6D /* SystemTimeMac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6582A15509999D6D00BEEB6D /* SystemTimeMac.cpp */; };
                6582A17809999EA000BEEB6D /* DeprecatedStringMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 6582A17709999EA000BEEB6D /* DeprecatedStringMac.mm */; };
                658436860AE01B7400E53753 /* FrameLoadRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = 658436850AE01B7400E53753 /* FrameLoadRequest.h */; };
-               658821660AF4CDF700F01D1F /* ResourceResponse.h in Headers */ = {isa = PBXBuildFile; fileRef = 658821650AF4CDF700F01D1F /* ResourceResponse.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               658821660AF4CDF700F01D1F /* ResourceResponse.h in Headers */ = {isa = PBXBuildFile; fileRef = 658821650AF4CDF700F01D1F /* ResourceResponse.h */; };
                6588216B0AF4CE1200F01D1F /* ResourceResponseMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 658821680AF4CE1200F01D1F /* ResourceResponseMac.h */; };
                6588216C0AF4CE1200F01D1F /* ResourceResponseMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 658821690AF4CE1200F01D1F /* ResourceResponseMac.mm */; };
                65901A4409FC6039005BD752 /* WebCoreStringTruncator.h in Headers */ = {isa = PBXBuildFile; fileRef = 65901A4209FC6039005BD752 /* WebCoreStringTruncator.h */; settings = {ATTRIBUTES = (Private, ); }; };
                55998A5B052B59CC0017A6C1 /* WebCoreAXObject.mm */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebCoreAXObject.mm; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                55998A5C052B59CC0017A6C1 /* AXObjectCache.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = AXObjectCache.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                55998A5D052B59CC0017A6C1 /* AXObjectCacheMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AXObjectCacheMac.mm; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
-               650E3F670AF6C168001FA3AD /* ResourceRequestMac.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ResourceRequestMac.h; sourceTree = "<group>"; };
-               650E3F680AF6C168001FA3AD /* ResourceRequestMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = ResourceRequestMac.mm; sourceTree = "<group>"; };
                650F53DB09D15DDA00C9B0C8 /* CSSGrammar.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CSSGrammar.h; sourceTree = "<group>"; };
                651B4D8309AC83370029F1EF /* DeprecatedStringList.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = DeprecatedStringList.cpp; sourceTree = "<group>"; };
                651B4D8409AC83370029F1EF /* DeprecatedStringList.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = DeprecatedStringList.h; sourceTree = "<group>"; };
                        isa = PBXGroup;
                        children = (
                                656B84EA0AEA1DDA00A095B4 /* ResourceHandleMac.mm */,
-                               650E3F670AF6C168001FA3AD /* ResourceRequestMac.h */,
-                               650E3F680AF6C168001FA3AD /* ResourceRequestMac.mm */,
                                658821680AF4CE1200F01D1F /* ResourceResponseMac.h */,
                                658821690AF4CE1200F01D1F /* ResourceResponseMac.mm */,
                        );
                                93E22A730AF5E94C00D48324 /* PageState.h in Headers */,
                                658821660AF4CDF700F01D1F /* ResourceResponse.h in Headers */,
                                6588216B0AF4CE1200F01D1F /* ResourceResponseMac.h in Headers */,
-                               650E3F690AF6C168001FA3AD /* ResourceRequestMac.h in Headers */,
                                93CCF0270AF6C52900018E89 /* NavigationAction.h in Headers */,
                                B2A015A90AF6CD53006BCE0E /* GraphicsContext.h in Headers */,
                                B2A015AB0AF6CD53006BCE0E /* GraphicsTypes.h in Headers */,
                                93E227E30AF589AD00D48324 /* ResourceLoader.cpp in Sources */,
                                93E227E40AF589AD00D48324 /* SubresourceLoader.cpp in Sources */,
                                93E22A6F0AF5E94100D48324 /* PageState.cpp in Sources */,
-                               650E3F6A0AF6C168001FA3AD /* ResourceRequestMac.mm in Sources */,
                                93CCF0580AF6C9FE00018E89 /* NavigationActionMac.mm in Sources */,
                                93CCF0600AF6CA7600018E89 /* NavigationAction.cpp in Sources */,
                                B2A015A80AF6CD53006BCE0E /* GraphicsContext.cpp in Sources */,
index c2f4159ad1be7c12bdbe2cfa1283d81bf6373657..fa3fc5367f4d683b2b02c5d691852c9ac65205a9 100644 (file)
@@ -1763,7 +1763,7 @@ static NSCharacterSet *_getPostSmartSet(void)
         return NO;
 
     *data = resource->allData();
-    *response = resource->platformResponse();
+    *response = resource->response();
     return YES;
 }
 
@@ -1785,7 +1785,7 @@ static NSCharacterSet *_getPostSmartSet(void)
     HashMap<String, CachedResource*>::const_iterator end = allResources.end();
     for (HashMap<String, CachedResource*>::const_iterator it = allResources.begin(); it != end; ++it) {
         [d addObject:it->second->allData()];
-        [r addObject:it->second->platformResponse()];
+        [r addObject:it->second->response()];
     }
 
     *datas = [d autorelease];
index 82d1d97df8fb9a861ca339b96530e7d83d540481..d2472d565b6e027a115657fed20d1795074e3976 100644 (file)
@@ -86,8 +86,12 @@ void CachedCSSStyleSheet::checkNotify()
         return;
 
     CachedResourceClientWalker w(m_clients);
-    while (CachedResourceClient *c = w.next())
-        c->setCSSStyleSheet(m_response.url().url(), m_decoder->encoding().name(), m_sheet);
+    while (CachedResourceClient *c = w.next()) {
+        if (m_response && !IsResponseURLEqualToURL(m_response, m_url))
+            c->setCSSStyleSheet(ResponseURL(m_response), m_decoder->encoding().name(), m_sheet);
+        else
+            c->setCSSStyleSheet(m_url, m_decoder->encoding().name(), m_sheet);
+    }
 }
 
 void CachedCSSStyleSheet::error()
index c0a950c22df96483b78cf449699db043bba39b3a..02d86f07d375afbb50742df000b00653ec304008 100644 (file)
@@ -135,7 +135,7 @@ inline void CachedImage::createImage()
 {
     // Create the image if it doesn't yet exist.
     if (!m_image)
-        m_image = new Image(this, m_response.mimeType() == "application/pdf");
+        m_image = new Image(this, ResponseMIMEType(m_response) == "application/pdf");
 }
 
 Vector<char>& CachedImage::bufferData(const char* bytes, int addedSize, Request* request)
index 15eeae806b364ab1b54ad6b3f6348ee36c40ce0d..c9d8534f366a3a492fabf80203dd28930e90de91 100644 (file)
@@ -40,7 +40,7 @@
 
 namespace WebCore {
 
-CachedResource::CachedResource(const String& URL, Type type, CachePolicy cachePolicy, unsigned size)
+CachedResource::CachedResource(const String& URL, Type type, CachePolicy cachePolicy, time_t expireDate, unsigned size)
 {
     m_url = URL;
     m_type = type;
@@ -49,8 +49,9 @@ CachedResource::CachedResource(const String& URL, Type type, CachePolicy cachePo
     m_inCache = false;
     m_cachePolicy = cachePolicy;
     m_request = 0;
-    m_platformResponse = 0;
+    m_response = 0;
     m_allData = 0;
+    m_expireDate = expireDate;
     m_expireDateChanged = false;
     m_accessCount = 0;
     m_nextInLRUList = 0;
@@ -68,7 +69,7 @@ CachedResource::~CachedResource()
 #ifndef NDEBUG
     m_deleted = true;
 #endif
-    setPlatformResponse(0);
+    setResponse(0);
     setAllData(0);
 }
 
@@ -92,12 +93,25 @@ void CachedResource::finish()
         m_expireDateChanged = false;
 }
 
+void CachedResource::setExpireDate(time_t expireDate, bool changeHttpCache)
+{
+    if (expireDate == m_expireDate)
+        return;
+
+    if (m_status == Cached)
+        finish();
+
+    m_expireDate = expireDate;
+    if (changeHttpCache && m_expireDate)
+       m_expireDateChanged = true;
+}
+
 bool CachedResource::isExpired() const
 {
-    if (!m_response.expirationDate())
+    if (!m_expireDate)
         return false;
     time_t now = time(0);
-    return (difftime(now, m_response.expirationDate()) >= 0);
+    return (difftime(now, m_expireDate) >= 0);
 }
 
 void CachedResource::setRequest(Request* request)
index 57c19c6a652eebd2ac81e3692a3111e5e37e3880..a1e16168f9a13e44661a3bcad5b9e015be581da8 100644 (file)
@@ -31,7 +31,6 @@
 #include "CachePolicy.h"
 #include "PlatformString.h"
 #include "ResourceHandleClient.h" // defines PlatformResponse and PlatformData
-#include "ResourceResponse.h"
 #include <wtf/HashSet.h>
 #include <wtf/Vector.h>
 #include <time.h>
@@ -78,7 +77,7 @@ public:
         Cached       // regular case
     };
 
-    CachedResource(const String& URL, Type type, CachePolicy cachePolicy, unsigned size = 0);
+    CachedResource(const String& URL, Type type, CachePolicy cachePolicy, time_t expireDate, unsigned size = 0);
     virtual ~CachedResource();
 
     virtual void setEncoding(const String&) { }
@@ -121,15 +120,15 @@ public:
 
     void setRequest(Request*);
 
-    PlatformResponse platformResponse() const { return m_platformResponse; }
-    void setPlatformResponse(PlatformResponse);
+    PlatformResponse response() const { return m_response; }
+    void setResponse(PlatformResponse);
     PlatformData allData() const { return m_allData; }
     void setAllData(PlatformData);
 
-    void setResponse(const ResourceResponse& response) { m_response = response; }
-
     bool canDelete() const { return !referenced() && !m_request; }
 
+    void setExpireDate(time_t expireDate, bool changeHttpCache);
+
     bool isExpired() const;
 
     virtual bool schedule() const { return false; }
@@ -156,8 +155,7 @@ protected:
     RetainPtr<NSURLRequest> m_nsURLRequest;
 #endif
 
-    ResourceResponse m_response;
-    PlatformResponse m_platformResponse;
+    PlatformResponse m_response;
     PlatformData m_allData;
 
     Type m_type;
@@ -168,6 +166,7 @@ private:
     unsigned m_accessCount;
 
 protected:
+    time_t m_expireDate;
     CachePolicy m_cachePolicy;
     bool m_inCache;
     bool m_loading;
index 0b78adf93e9a88cb95cc501af0b0d0b0e1332497..369816dc41cc60d381345651d7e8f2aa9899661d 100644 (file)
@@ -55,5 +55,10 @@ Vector<char> ServeSynchronousRequest(Loader*, DocLoader*, const ResourceRequest&
 
 void CheckCacheObjectStatus(DocLoader*, CachedResource*);
 bool CheckIfReloading(DocLoader*);
+bool IsResponseURLEqualToURL(PlatformResponse , const String& URL);
+DeprecatedString ResponseURL(PlatformResponse);
+DeprecatedString ResponseMIMEType(PlatformResponse);
+bool ResponseIsMultipart(PlatformResponse);
+NSString* HeaderStringFromDictionary(NSDictionary* headers, int statusCode);
 
 }
index 6ab59f6eb80237bac8c7fd8ec1888c2c563d1fde..85c00c4db89cd18cc7c99ad59070bed2e5e1921d 100644 (file)
@@ -127,14 +127,14 @@ void Loader::receivedResponse(ResourceHandle* handle, PlatformResponse response)
     // FIXME: the win32 platform does not have PlatformResponse yet.
     ASSERT(response);
 #endif
-    req->cachedResource()->setPlatformResponse(response);
+    req->cachedResource()->setResponse(response);
 }
 
-void Loader::didReceiveResponse(ResourceHandle* handle, const ResourceResponse& response)
+void Loader::didReceivedResponse(ResourceHandle* handle, const ResourceResponse& response)
 {
     Request* req = m_requestsLoading.get(handle);
     ASSERT(req);
-    req->cachedResource()->setResponse(response);
+    req->cachedResource()->setExpireDate(response.expirationDate(), false);
     
     String encoding = response.textEncodingName();
     if (!encoding.isNull())
index 22ccffd17b2d25b38eae3ecb3ab40abce3e72b5d..fbc9b72cea86ff046379e8220f0c0fab4b067220 100644 (file)
@@ -64,7 +64,7 @@ namespace WebCore {
 
     private:
         virtual void receivedResponse(ResourceHandle*, PlatformResponse);
-        virtual void didReceiveResponse(ResourceHandle* handle, const ResourceResponse& response);
+        virtual void didReceivedResponse(ResourceHandle* handle, const ResourceResponse& response);
         virtual void didReceiveData(ResourceHandle*, const char*, int);
         virtual void receivedAllData(ResourceHandle*, PlatformData);
 
index c13edb34c55a967d5d4b51eeb0287e8e9a6baf81..75f192d0a2e671b5486b9644fdb3155a1a8128a2 100644 (file)
@@ -31,5 +31,4 @@
 namespace WebCore {
     class FormData;
     void setHTTPBody(NSMutableURLRequest *, const FormData&);
-    const FormData* httpBodyFromStream(NSInputStream* stream);
 }
index 97a1a441a2f1b0883f45bfd1d09a349ba57ac7c5..b295e0343225938e55dd0b460616ffbb5795969e 100644 (file)
 #import <sys/stat.h>
 #import <sys/types.h>
 #import <wtf/Assertions.h>
-#import <wtf/HashMap.h>
 
 namespace WebCore {
 
-static HashMap<CFReadStreamRef, const FormData*>* streamFormDatas = 0;
-
-static HashMap<CFReadStreamRef, const FormData*>* getStreamFormDatas()
-{
-    if (!streamFormDatas)
-        streamFormDatas = new HashMap<CFReadStreamRef, const FormData*>();
-    return streamFormDatas;
-}
-
 static void formEventCallback(CFReadStreamRef stream, CFStreamEventType type, void* context);
 
 struct FormStreamFields {
@@ -182,8 +172,6 @@ static void* formCreate(CFReadStreamRef stream, void* context)
     for (size_t i = 0; i < size; ++i)
         newInfo->remainingElements.append(formData->elements()[size - i - 1]);
 
-    getStreamFormDatas()->set(stream, new FormData(*formData));
-
     return newInfo;
 }
 
@@ -191,9 +179,6 @@ static void formFinalize(CFReadStreamRef stream, void* context)
 {
     FormStreamFields* form = static_cast<FormStreamFields*>(context);
 
-    delete getStreamFormDatas()->get(stream);
-    getStreamFormDatas()->remove(stream);
-
     closeCurrentStream(form);
     CFRelease(form->scheduledRunLoopPairs);
     delete form;
@@ -345,10 +330,4 @@ void setHTTPBody(NSMutableURLRequest *request, const FormData& formData)
     CFRelease(stream);
 }
 
-
-const FormData* httpBodyFromStream(NSInputStream* stream)
-{
-    return getStreamFormDatas()->get((CFReadStreamRef)stream);
-}
-
 }
index 79f903851a5ca5bde22632cea2877ce9cf79992e..657b7b146a165388cbb22ef1f73a234927713436 100644 (file)
@@ -45,7 +45,7 @@ void finishImageLoad(Document* document, CachedImage* image, const void* imageDa
 
     Frame* frame = document->frame();
     NSURLResponse *response = frame->loader()->documentLoader()->response();
-    image->setPlatformResponse(response);
+    image->setResponse(response);
 
     IntSize size = image->imageSize();
     if (size.width())
index 5a8090573c6dd87d15231743692941f65521f3f8..78cc3363f57a4c054bce6b61506fc3d916c39e86 100644 (file)
@@ -130,7 +130,7 @@ void CheckCacheObjectStatus(DocLoader *loader, CachedResource *cachedResource)
         return;
     }
     
-    ASSERT(cachedResource->platformResponse());
+    ASSERT(cachedResource->response());
     
     // Notify the caller that we "loaded".
     FrameMac *frame = static_cast<FrameMac *>(loader->frame());
@@ -139,7 +139,7 @@ void CheckCacheObjectStatus(DocLoader *loader, CachedResource *cachedResource)
         return;
         
     NSURLRequest *request = cachedResource->getNSURLRequest();
-    NSURLResponse *response = cachedResource->platformResponse();
+    NSURLResponse *response = cachedResource->response();
     NSData *data = cachedResource->allData();
     
     // FIXME: If the WebKit client changes or cancels the request, WebCore does not respect this and continues the load.
@@ -196,14 +196,14 @@ bool ResponseIsMultipart(PlatformResponse response)
     return false;
 }
 
-void CachedResource::setPlatformResponse(PlatformResponse response)
+void CachedResource::setResponse(PlatformResponse response)
 {
     HardRetain(response);
     BEGIN_BLOCK_OBJC_EXCEPTIONS;
-    HardRelease(m_platformResponse);
+    HardRelease(m_response);
     END_BLOCK_OBJC_EXCEPTIONS;
 
-    m_platformResponse = response;
+    m_response = response;
 }
 
 void CachedResource::setAllData(PlatformData allData)
index 8b9056ff249db52ec0a076489749aeb369ea5b1b..83ab9690e52d2d91af2e26dded7d233fb1cc98e0 100644 (file)
@@ -109,7 +109,7 @@ NSURLRequest *SubresourceLoader::willSendRequest(NSURLRequest *newRequest, NSURL
     NSURL *oldURL = [request() URL];
     NSURLRequest *clientRequest = ResourceLoader::willSendRequest(newRequest, redirectResponse);
     if (clientRequest && oldURL != [clientRequest URL] && ![oldURL isEqual:[clientRequest URL]])
-        clientRequest = m_handle->willSendRequest(clientRequest, redirectResponse);
+        m_handle->redirectedToURL([clientRequest URL]);
     return clientRequest;
 }
 
index 17dab15ea9818d474940b1d7d1180901d53d2154..ac81944c411edf25d365adc48bfb90e55b217f6f 100644 (file)
@@ -48,12 +48,8 @@ typedef LONG_PTR LRESULT;
 #if PLATFORM(MAC)
 #ifdef __OBJC__
 @class WebCoreResourceLoaderImp;
-@class NSURLRequest;
-@class NSURLResponse;
 #else
 class WebCoreResourceLoaderImp;
-class NSURLRequest;
-class NSURLResponse;
 #endif
 #endif
 
@@ -82,7 +78,7 @@ public:
     void kill();
 
 #if PLATFORM(MAC)
-    NSURLRequest *willSendRequest(NSURLRequest *, NSURLResponse *);
+    void redirectedToURL(NSURL *url);
     void addData(NSData *data);
     void finishJobAndHandle(NSData *data);
     void reportError();
index e3353371b6736d54fe8c6320199fc47990a694d4..76465d2067e38bdac4bfad64ea8f5e952e956445 100644 (file)
@@ -74,7 +74,6 @@ namespace WebCore {
 
     class KURL;
     class ResourceHandle;
-    class ResourceRequest;
     class ResourceResponse;
 
     class ResourceHandleClient {
@@ -82,7 +81,7 @@ namespace WebCore {
         virtual ~ResourceHandleClient() { }
 
         // request may be modified
-        virtual void willSendRequest(ResourceHandle*, ResourceRequest&, const ResourceResponse& redirectResponse) { }
+        // void willSendRequest(ResourceHandle*, Request&, const ResourceResonse& redirectResponse) { }
     
         // void didReceiveAuthenticationChallenge(ResourceHandle*, const AuthenticationChallenge&) { }
         // void didCancelAuthenticationChallenge(ResourceHandle*, const AuthenticationChallenge&) { }
@@ -96,6 +95,7 @@ namespace WebCore {
         // void willCacheResponse(ResourceHandle*, CachedResourceResponse&) { }
 
         // old-style methods
+        virtual void receivedRedirect(ResourceHandle*, const KURL&) { }
         virtual void receivedResponse(ResourceHandle*, PlatformResponse) { }
         virtual void receivedAllData(ResourceHandle*, PlatformData) { }
     };
index 837d3fbb4b712cd441637b855a605e1572285019..d240b656c4b0fa074b47a95f7dc6c56d59dcd716 100644 (file)
@@ -117,8 +117,8 @@ namespace WebCore {
         FormData& httpBody() { return m_httpBody; }
         void setHTTPBody(const FormData& httpBody) { m_httpBody = httpBody; } 
         
-        bool allowHTTPCookies() const { return m_allowHTTPCookies; }
-        void setAllowHTTPCookies(bool allowHTTPCookies) { m_allowHTTPCookies = allowHTTPCookies; }
+        bool allowHTTPCookies() const;
+        void setAllowHTTPCookies(bool);
 
     private:
         static const int defaultTimeoutInterval = 60;
index 5b5c63aa5b3bd0db2527a0412c97e1193cda997e..693126952c27140dad9299ee95650f2848578e86 100644 (file)
@@ -35,12 +35,7 @@ namespace WebCore {
 class ResourceResponse {
 public:
 
-    ResourceResponse() 
-        : m_expectedContentLength(0)
-        , m_httpStatusCode(0)
-        , m_expirationDate(0) 
-    {
-    }
+    ResourceResponse() : m_expectedContentLength(0), m_httpStatusCode(0) {}
 
     ResourceResponse(const KURL& url, const String& mimeType, long long expectedLength, const String& textEncodingName, const String& filename)
         : m_url(url)
@@ -49,7 +44,6 @@ public:
         , m_textEncodingName(textEncodingName)
         , m_suggestedFilename(filename)
         , m_httpStatusCode(0)
-        , m_expirationDate(0)
     {
     }
  
@@ -69,6 +63,9 @@ public:
     const HTTPHeaderMap& httpHeaderFields() const { return m_httpHeaderFields; }
     HTTPHeaderMap& httpHeaderFields() { return m_httpHeaderFields; }
 
+    // possibly add calculated expiration info
+    // lastModifiedDate (date)
+
     bool isMultipart() const { return m_mimeType == "multipart/x-mixed-replace"; }
 
     void setExpirationDate(time_t expirationDate) { m_expirationDate = expirationDate; }
index a9926960f096f182501a200981ec4fc8223efd16..38cbd29dbcec32994bbbe14f8cc1c261d64810ff 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2004, 2006 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 2004 Apple Computer, Inc.  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -34,7 +34,6 @@
 #import "KURL.h"
 #import "LoaderFunctions.h"
 #import "Logging.h"
-#import "ResourceRequestMac.h"
 #import "ResourceResponse.h"
 #import "ResourceResponseMac.h"
 #import "WebCoreFrameBridge.h"
@@ -105,19 +104,11 @@ void ResourceHandle::cancel()
     d->m_subresourceLoader->cancel();
 }
 
-NSURLRequest *ResourceHandle::willSendRequest(NSURLRequest *nsRequest, NSURLResponse* nsRedirectResponse)
+void ResourceHandle::redirectedToURL(NSURL *url)
 {
-    ASSERT(nsRequest);
-    if (ResourceHandleClient* c = client()) {
-        ResourceRequest request;
-        getResourceRequest(request, nsRequest);
-        ResourceResponse redirectResponse;
-        getResourceResponse(redirectResponse, nsRedirectResponse);
-        c->willSendRequest(this, request, redirectResponse);
-        return nsURLRequest(request);
-    }
-
-    return nsRequest;
+    ASSERT(url);
+    if (ResourceHandleClient* c = client())
+        c->receivedRedirect(this, KURL(url));
 }
 
 void ResourceHandle::addData(NSData *data)
index 44bf7bafd93692f338b3670a95750d6fd75ee630..50d9b610d41cad3a1522df6ca7cfe17f1f0ce842 100644 (file)
@@ -507,9 +507,9 @@ void XMLHttpRequest::didFinishLoading(ResourceHandle* loader)
     }
 }
 
-void XMLHttpRequest::willSendRequest(ResourceHandle*, ResourceRequest& request, const ResourceResponse& redirectResponse)
+void XMLHttpRequest::receivedRedirect(ResourceHandle*, const KURL& m_url)
 {
-    if (!urlMatchesDocumentDomain(request.url()))
+    if (!urlMatchesDocumentDomain(m_url))
         abort();
 }
 
index f2f17b740ed39b5436c9c5d7f6cbb600179423f4..adef105711878002c2b393e33fce0451c96fcd57 100644 (file)
@@ -82,7 +82,7 @@ public:
 private:
     bool urlMatchesDocumentDomain(const KURL&) const;
 
-    virtual void willSendRequest(ResourceHandle*, ResourceRequest& request, const ResourceResponse& redirectResponse);
+    virtual void receivedRedirect(ResourceHandle*, const KURL&);
     virtual void didReceiveResponse(ResourceHandle*, const ResourceResponse&);
     virtual void didReceiveData(ResourceHandle*, const char* data, int size);
     virtual void didFinishLoading(ResourceHandle*);