WebCore:
authorbeidson <beidson@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 11 Jan 2007 22:20:55 +0000 (22:20 +0000)
committerbeidson <beidson@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 11 Jan 2007 22:20:55 +0000 (22:20 +0000)
        Reviewed by Anders

        Rewrites HTTP Authentication setting up a more platform-independent structure

        * WebCore.exp:
        * WebCore.xcodeproj/project.pbxproj:
        * loader/FrameLoader.cpp:
        (WebCore::FrameLoader::didReceiveAuthenticationChallenge):
        (WebCore::FrameLoader::didCancelAuthenticationChallenge):
        * loader/FrameLoader.h:
        * loader/FrameLoaderClient.h:
        * loader/ResourceLoader.cpp:
        (WebCore::ResourceLoader::ResourceLoader):
        (WebCore::ResourceLoader::didCancel):
        * loader/ResourceLoader.h:
        (WebCore::ResourceLoader::didReceiveAuthenticationChallenge):
        (WebCore::ResourceLoader::didCancelAuthenticationChallenge):
        (WebCore::ResourceLoader::receivedCredential):
        (WebCore::ResourceLoader::receivedRequestToContinueWithoutCredential):
        (WebCore::ResourceLoader::receivedCancellation):
        * loader/mac/FrameLoaderMac.mm:
        * loader/mac/ResourceLoaderMac.mm:
        (WebCore::ResourceLoader::didReceiveAuthenticationChallenge):
        (WebCore::ResourceLoader::didCancelAuthenticationChallenge):
        (WebCore::ResourceLoader::receivedCredential):
        (WebCore::ResourceLoader::receivedRequestToContinueWithoutCredential):
        (WebCore::ResourceLoader::receivedCancellation):
        * platform/graphics/svg/SVGImageEmptyClients.h:
        (WebCore::SVGEmptyFrameLoaderClient::dispatchDidReceiveAuthenticationChallenge):
        (WebCore::SVGEmptyFrameLoaderClient::dispatchDidCancelAuthenticationChallenge):
        * platform/network/ResourceHandleClient.h:
        (WebCore::ResourceHandleClient::willSendRequest):
        (WebCore::ResourceHandleClient::didReceiveAuthenticationChallenge):
        (WebCore::ResourceHandleClient::didCancelAuthenticationChallenge):
        (WebCore::ResourceHandleClient::receivedCredential):
        (WebCore::ResourceHandleClient::receivedRequestToContinueWithoutCredential):
        (WebCore::ResourceHandleClient::receivedCancellation):
        (WebCore::ResourceHandleClient::willCacheResponse):
        * platform/network/ResourceResponse.h:
        (WebCore::operator!=):
        * platform/network/URLAuthenticationChallenge.cpp: Added.
        (WebCore::URLAuthenticationChallenge::URLAuthenticationChallenge):
        (WebCore::URLAuthenticationChallenge::previousFailureCount):
        (WebCore::URLAuthenticationChallenge::proposedCredential):
        (WebCore::URLAuthenticationChallenge::protectionSpace):
        (WebCore::URLAuthenticationChallenge::failureResponse):
        (WebCore::URLAuthenticationChallenge::error):
        (WebCore::URLAuthenticationChallenge::isNull):
        (WebCore::URLAuthenticationChallenge::nullify):
        (WebCore::operator==):
        (WebCore::operator!=):
        * platform/network/URLAuthenticationChallenge.h: Added.
        (WebCore::URLAuthenticationChallenge::sender):
        (WebCore::URLAuthenticationChallenge::nsURLAuthenticationChallenge):
        * platform/network/URLCredential.cpp: Added.
        (WebCore::URLCredential::URLCredential):
        (WebCore::URLCredential::user):
        (WebCore::URLCredential::password):
        (WebCore::URLCredential::hasPassword):
        (WebCore::URLCredential::persistence):
        (WebCore::operator==):
        * platform/network/URLCredential.h: Added.
        (WebCore::):
        (WebCore::operator!=):
        * platform/network/URLProtectionSpace.cpp: Added.
        (WebCore::URLProtectionSpace::URLProtectionSpace):
        (WebCore::URLProtectionSpace::host):
        (WebCore::URLProtectionSpace::port):
        (WebCore::URLProtectionSpace::serverType):
        (WebCore::URLProtectionSpace::realm):
        (WebCore::URLProtectionSpace::authenticationScheme):
        (WebCore::operator==):
        * platform/network/URLProtectionSpace.h: Added.
        (WebCore::):
        (WebCore::operator!=):
        * platform/network/mac/AuthenticationMac.h: Added.
        * platform/network/mac/AuthenticationMac.mm: Added.
        (WebCore::URLAuthenticationChallenge::URLAuthenticationChallenge):
        (WebCore::mac):
        (WebCore::core):
        * platform/network/mac/ResourceHandleMac.mm:
        (-[WebCoreResourceHandleAsDelegate connection:didReceiveAuthenticationChallenge:]):
        (-[WebCoreResourceHandleAsDelegate connection:didCancelAuthenticationChallenge:]):
        (-[WebCoreResourceHandleAsDelegate useCredential:forAuthenticationChallenge:]):
        (-[WebCoreResourceHandleAsDelegate continueWithoutCredentialForAuthenticationChallenge:]):
        (-[WebCoreResourceHandleAsDelegate cancelAuthenticationChallenge:]):
        * platform/network/mac/ResourceResponseMac.mm:
        (WebCore::operator==):

WebKit:

        Reviewed by Anders

        Rewrites HTTP Authentication setting up a more platform-independent structure

        * WebCoreSupport/WebFrameLoaderClient.h:
        * WebCoreSupport/WebFrameLoaderClient.mm:
        (WebFrameLoaderClient::dispatchDidReceiveAuthenticationChallenge):
        (WebFrameLoaderClient::dispatchDidCancelAuthenticationChallenge):
        * WebKit.xcodeproj/project.pbxproj:

WebKitQt:

        Keep the fancy new FrameLoaderClientQt building with a small api change in WebCore
        Yay for the loader on QT!

        * WebCoreSupport/FrameLoaderClientQt.cpp:
        (WebCore::FrameLoaderClientQt::dispatchDidReceiveAuthenticationChallenge):
        (WebCore::FrameLoaderClientQt::dispatchDidCancelAuthenticationChallenge):
        * WebCoreSupport/FrameLoaderClientQt.h:

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

31 files changed:
WebCore/ChangeLog
WebCore/WebCore.exp
WebCore/WebCore.xcodeproj/project.pbxproj
WebCore/loader/FrameLoader.cpp
WebCore/loader/FrameLoader.h
WebCore/loader/FrameLoaderClient.h
WebCore/loader/ResourceLoader.cpp
WebCore/loader/ResourceLoader.h
WebCore/loader/mac/FrameLoaderMac.mm
WebCore/loader/mac/ResourceLoaderMac.mm
WebCore/platform/graphics/svg/SVGImageEmptyClients.h
WebCore/platform/network/AuthenticationChallenge.cpp [new file with mode: 0644]
WebCore/platform/network/AuthenticationChallenge.h [new file with mode: 0644]
WebCore/platform/network/Credential.cpp [new file with mode: 0644]
WebCore/platform/network/Credential.h [new file with mode: 0644]
WebCore/platform/network/ProtectionSpace.cpp [new file with mode: 0644]
WebCore/platform/network/ProtectionSpace.h [new file with mode: 0644]
WebCore/platform/network/ResourceError.h
WebCore/platform/network/ResourceHandle.cpp
WebCore/platform/network/ResourceHandleClient.h
WebCore/platform/network/ResourceResponse.cpp
WebCore/platform/network/ResourceResponse.h
WebCore/platform/network/mac/AuthenticationMac.h [new file with mode: 0644]
WebCore/platform/network/mac/AuthenticationMac.mm [new file with mode: 0644]
WebCore/platform/network/mac/ResourceHandleMac.mm
WebKit/ChangeLog
WebKit/WebCoreSupport/WebFrameLoaderClient.h
WebKit/WebCoreSupport/WebFrameLoaderClient.mm
WebKitQt/ChangeLog
WebKitQt/WebCoreSupport/FrameLoaderClientQt.cpp
WebKitQt/WebCoreSupport/FrameLoaderClientQt.h

index 83d16214199cd474cd95e6f8ef83712668f5711c..f5f10fd646287b733ce34795bf5075c665f81b79 100644 (file)
@@ -1,3 +1,94 @@
+2007-01-11  Brady Eidson  <beidson@apple.com>
+
+        Reviewed by Anders
+
+        Rewrites HTTP Authentication setting up a more platform-independent structure
+
+        * WebCore.exp:
+        * WebCore.xcodeproj/project.pbxproj:
+        * loader/FrameLoader.cpp:
+        (WebCore::FrameLoader::didReceiveAuthenticationChallenge):
+        (WebCore::FrameLoader::didCancelAuthenticationChallenge):
+        * loader/FrameLoader.h:
+        * loader/FrameLoaderClient.h:
+        * loader/ResourceLoader.cpp:
+        (WebCore::ResourceLoader::ResourceLoader):
+        (WebCore::ResourceLoader::didCancel):
+        * loader/ResourceLoader.h:
+        (WebCore::ResourceLoader::didReceiveAuthenticationChallenge):
+        (WebCore::ResourceLoader::didCancelAuthenticationChallenge):
+        (WebCore::ResourceLoader::receivedCredential):
+        (WebCore::ResourceLoader::receivedRequestToContinueWithoutCredential):
+        (WebCore::ResourceLoader::receivedCancellation):
+        * loader/mac/FrameLoaderMac.mm:
+        * loader/mac/ResourceLoaderMac.mm:
+        (WebCore::ResourceLoader::didReceiveAuthenticationChallenge):
+        (WebCore::ResourceLoader::didCancelAuthenticationChallenge):
+        (WebCore::ResourceLoader::receivedCredential):
+        (WebCore::ResourceLoader::receivedRequestToContinueWithoutCredential):
+        (WebCore::ResourceLoader::receivedCancellation):
+        * platform/graphics/svg/SVGImageEmptyClients.h:
+        (WebCore::SVGEmptyFrameLoaderClient::dispatchDidReceiveAuthenticationChallenge):
+        (WebCore::SVGEmptyFrameLoaderClient::dispatchDidCancelAuthenticationChallenge):
+        * platform/network/ResourceHandleClient.h:
+        (WebCore::ResourceHandleClient::willSendRequest):
+        (WebCore::ResourceHandleClient::didReceiveAuthenticationChallenge):
+        (WebCore::ResourceHandleClient::didCancelAuthenticationChallenge):
+        (WebCore::ResourceHandleClient::receivedCredential):
+        (WebCore::ResourceHandleClient::receivedRequestToContinueWithoutCredential):
+        (WebCore::ResourceHandleClient::receivedCancellation):
+        (WebCore::ResourceHandleClient::willCacheResponse):
+        * platform/network/ResourceResponse.h:
+        (WebCore::operator!=):
+        * platform/network/URLAuthenticationChallenge.cpp: Added.
+        (WebCore::URLAuthenticationChallenge::URLAuthenticationChallenge):
+        (WebCore::URLAuthenticationChallenge::previousFailureCount):
+        (WebCore::URLAuthenticationChallenge::proposedCredential):
+        (WebCore::URLAuthenticationChallenge::protectionSpace):
+        (WebCore::URLAuthenticationChallenge::failureResponse):
+        (WebCore::URLAuthenticationChallenge::error):
+        (WebCore::URLAuthenticationChallenge::isNull):
+        (WebCore::URLAuthenticationChallenge::nullify):
+        (WebCore::operator==):
+        (WebCore::operator!=):
+        * platform/network/URLAuthenticationChallenge.h: Added.
+        (WebCore::URLAuthenticationChallenge::sender):
+        (WebCore::URLAuthenticationChallenge::nsURLAuthenticationChallenge):
+        * platform/network/URLCredential.cpp: Added.
+        (WebCore::URLCredential::URLCredential):
+        (WebCore::URLCredential::user):
+        (WebCore::URLCredential::password):
+        (WebCore::URLCredential::hasPassword):
+        (WebCore::URLCredential::persistence):
+        (WebCore::operator==):
+        * platform/network/URLCredential.h: Added.
+        (WebCore::):
+        (WebCore::operator!=):
+        * platform/network/URLProtectionSpace.cpp: Added.
+        (WebCore::URLProtectionSpace::URLProtectionSpace):
+        (WebCore::URLProtectionSpace::host):
+        (WebCore::URLProtectionSpace::port):
+        (WebCore::URLProtectionSpace::serverType):
+        (WebCore::URLProtectionSpace::realm):
+        (WebCore::URLProtectionSpace::authenticationScheme):
+        (WebCore::operator==):
+        * platform/network/URLProtectionSpace.h: Added.
+        (WebCore::):
+        (WebCore::operator!=):
+        * platform/network/mac/AuthenticationMac.h: Added.
+        * platform/network/mac/AuthenticationMac.mm: Added.
+        (WebCore::URLAuthenticationChallenge::URLAuthenticationChallenge):
+        (WebCore::mac):
+        (WebCore::core):
+        * platform/network/mac/ResourceHandleMac.mm:
+        (-[WebCoreResourceHandleAsDelegate connection:didReceiveAuthenticationChallenge:]):
+        (-[WebCoreResourceHandleAsDelegate connection:didCancelAuthenticationChallenge:]):
+        (-[WebCoreResourceHandleAsDelegate useCredential:forAuthenticationChallenge:]):
+        (-[WebCoreResourceHandleAsDelegate continueWithoutCredentialForAuthenticationChallenge:]):
+        (-[WebCoreResourceHandleAsDelegate cancelAuthenticationChallenge:]):
+        * platform/network/mac/ResourceResponseMac.mm:
+        (WebCore::operator==):
+
 2007-01-11  Geoffrey Garen  <ggaren@apple.com>
 
         Reviewed by Anders Carlsson.
index 30a495a2eeaff5cd5a05d258a8eb0e84dfb93183..b8e672554b1ad224dab07e4a65a5dd2dc948c8ad 100644 (file)
@@ -556,6 +556,7 @@ __ZNK7WebCore9Selection17isContentEditableEv
 __ZNK7WebCore9Selection23isContentRichlyEditableEv
 __ZNK7WebCore9Selection7toRangeEv
 __ZNK7WebCore9TimerBase8isActiveEv
+__ZN7WebCore3macERKNS_23AuthenticationChallengeE
 _canonicalURL
 _stringIsFileURL
 _urlByRemovingComponent
index 4d83257db38ed09fc18782d3f932832d569b9a05..7377195da5a924bb282a43976f46878ad46a641d 100644 (file)
                4E19592E0A39DACC00220FE5 /* MediaQueryExp.h in Headers */ = {isa = PBXBuildFile; fileRef = 4E1959280A39DACC00220FE5 /* MediaQueryExp.h */; };
                510184690B08602A004A825F /* PageCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 510184670B08602A004A825F /* PageCache.h */; settings = {ATTRIBUTES = (Private, ); }; };
                5101846A0B08602A004A825F /* PageCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 510184680B08602A004A825F /* PageCache.cpp */; };
+               510F735F0B56C08800A3002A /* AuthenticationChallenge.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 510F73590B56C08800A3002A /* AuthenticationChallenge.cpp */; };
+               510F73600B56C08800A3002A /* AuthenticationChallenge.h in Headers */ = {isa = PBXBuildFile; fileRef = 510F735A0B56C08800A3002A /* AuthenticationChallenge.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               510F73610B56C08800A3002A /* Credential.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 510F735B0B56C08800A3002A /* Credential.cpp */; };
+               510F73620B56C08800A3002A /* Credential.h in Headers */ = {isa = PBXBuildFile; fileRef = 510F735C0B56C08800A3002A /* Credential.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               510F73630B56C08800A3002A /* ProtectionSpace.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 510F735D0B56C08800A3002A /* ProtectionSpace.cpp */; };
+               510F73640B56C08800A3002A /* ProtectionSpace.h in Headers */ = {isa = PBXBuildFile; fileRef = 510F735E0B56C08800A3002A /* ProtectionSpace.h */; settings = {ATTRIBUTES = (Private, ); }; };
                5115095C0A9CE04700901013 /* urlIcon.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 5115095B0A9CE04600901013 /* urlIcon.tiff */; };
                5126E6BB0A2E3B12005C29FA /* IconDatabase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5126E6B90A2E3B12005C29FA /* IconDatabase.cpp */; };
                5126E6BC0A2E3B12005C29FA /* IconDatabase.h in Headers */ = {isa = PBXBuildFile; fileRef = 5126E6BA0A2E3B12005C29FA /* IconDatabase.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               513BF1080B4F558900CCFECE /* AuthenticationMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 513BF1070B4F558900CCFECE /* AuthenticationMac.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               513BF1280B4F57DC00CCFECE /* AuthenticationMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 513BF1270B4F57DC00CCFECE /* AuthenticationMac.mm */; };
                513F14530AB634C400094DDF /* IconLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 513F14510AB634C400094DDF /* IconLoader.cpp */; };
                513F14540AB634C400094DDF /* IconLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 513F14520AB634C400094DDF /* IconLoader.h */; };
                5160F1FE0B0A7EF400C1D2AF /* HistoryItemTimer.h in Headers */ = {isa = PBXBuildFile; fileRef = 5160F1FC0B0A7EF400C1D2AF /* HistoryItemTimer.h */; };
                4E1959280A39DACC00220FE5 /* MediaQueryExp.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = MediaQueryExp.h; sourceTree = "<group>"; };
                510184670B08602A004A825F /* PageCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PageCache.h; sourceTree = "<group>"; };
                510184680B08602A004A825F /* PageCache.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PageCache.cpp; sourceTree = "<group>"; };
+               510F73590B56C08800A3002A /* AuthenticationChallenge.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = AuthenticationChallenge.cpp; sourceTree = "<group>"; };
+               510F735A0B56C08800A3002A /* AuthenticationChallenge.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = AuthenticationChallenge.h; sourceTree = "<group>"; };
+               510F735B0B56C08800A3002A /* Credential.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Credential.cpp; sourceTree = "<group>"; };
+               510F735C0B56C08800A3002A /* Credential.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Credential.h; sourceTree = "<group>"; };
+               510F735D0B56C08800A3002A /* ProtectionSpace.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = ProtectionSpace.cpp; sourceTree = "<group>"; };
+               510F735E0B56C08800A3002A /* ProtectionSpace.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ProtectionSpace.h; sourceTree = "<group>"; };
                5115095B0A9CE04600901013 /* urlIcon.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = urlIcon.tiff; sourceTree = "<group>"; };
                5126E6B90A2E3B12005C29FA /* IconDatabase.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = IconDatabase.cpp; sourceTree = "<group>"; };
                5126E6BA0A2E3B12005C29FA /* IconDatabase.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = IconDatabase.h; sourceTree = "<group>"; };
+               513BF1070B4F558900CCFECE /* AuthenticationMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AuthenticationMac.h; sourceTree = "<group>"; };
+               513BF1270B4F57DC00CCFECE /* AuthenticationMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AuthenticationMac.mm; sourceTree = "<group>"; };
                513F14510AB634C400094DDF /* IconLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = IconLoader.cpp; sourceTree = "<group>"; };
                513F14520AB634C400094DDF /* IconLoader.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = IconLoader.h; sourceTree = "<group>"; };
                5150C2A10702629000AF642C /* WebDashboardRegion.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebDashboardRegion.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                        isa = PBXGroup;
                        children = (
                                656B84E70AEA1DAE00A095B4 /* mac */,
+                               510F73590B56C08800A3002A /* AuthenticationChallenge.cpp */,
+                               510F735A0B56C08800A3002A /* AuthenticationChallenge.h */,
+                               510F735B0B56C08800A3002A /* Credential.cpp */,
+                               510F735C0B56C08800A3002A /* Credential.h */,
                                65DADA170AFD878000CE53ED /* FormData.h */,
                                65DAD9FA0AFD86B400CE53ED /* FormData.cpp */,
                                651888860AFF3BF700164720 /* ResourceError.cpp */,
                                655A81BD0AEF67E6000975F0 /* HTTPHeaderMap.h */,
                                E1D8E3150B29E39C00F4BAF6 /* HTTPParsers.h */,
                                E1D8E3190B29E3B600F4BAF6 /* HTTPParsers.cpp */,
+                               510F735D0B56C08800A3002A /* ProtectionSpace.cpp */,
+                               510F735E0B56C08800A3002A /* ProtectionSpace.h */,
                                656B85370AEA1F9A00A095B4 /* ResourceHandle.h */,
                                656B84DC0AEA1D3100A095B4 /* ResourceHandle.cpp */,
                                656B84DE0AEA1D3100A095B4 /* ResourceHandleClient.h */,
                                656B84DF0AEA1D3100A095B4 /* ResourceHandleInternal.h */,
-                               1AD8CFCD0B1CED8900696DE0 /* ResourceRequest.cpp */,
                                6522BCDE09C9DAA800C9BA7A /* ResourceRequest.h */,
-                               1A8180A40B1D4E4300CE46C4 /* ResourceResponse.cpp */,
+                               1AD8CFCD0B1CED8900696DE0 /* ResourceRequest.cpp */,
                                658821650AF4CDF700F01D1F /* ResourceResponse.h */,
+                               1A8180A40B1D4E4300CE46C4 /* ResourceResponse.cpp */,
                        );
                        path = network;
                        sourceTree = "<group>";
                                656B84EA0AEA1DDA00A095B4 /* ResourceHandleMac.mm */,
                                650E3F680AF6C168001FA3AD /* ResourceRequestMac.mm */,
                                658821690AF4CE1200F01D1F /* ResourceResponseMac.mm */,
+                               513BF1070B4F558900CCFECE /* AuthenticationMac.h */,
+                               513BF1270B4F57DC00CCFECE /* AuthenticationMac.mm */,
                        );
                        path = mac;
                        sourceTree = "<group>";
                                A82422700B4A16C50084722B /* SVGAnimateMotionElement.h in Headers */,
                                062287840B4DB322000C34DF /* FocusDirection.h in Headers */,
                                1A4A954E0B4EDCCB002D8C3C /* SharedBuffer.h in Headers */,
+                               513BF1080B4F558900CCFECE /* AuthenticationMac.h in Headers */,
                                BCCFBAE80B5152ED0001F1D7 /* Tokenizer.h in Headers */,
                                AA882B300B4EF5EB006D26D1 /* PointerEventsHitRules.h in Headers */,
                                93C7B5F40B52D89100B5477E /* CharacterNames.h in Headers */,
+                               510F73600B56C08800A3002A /* AuthenticationChallenge.h in Headers */,
+                               510F73620B56C08800A3002A /* Credential.h in Headers */,
+                               510F73640B56C08800A3002A /* ProtectionSpace.h in Headers */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                                A82422710B4A16C50084722B /* SVGAnimateMotionElement.cpp in Sources */,
                                1A4A954D0B4EDCCB002D8C3C /* SharedBuffer.cpp in Sources */,
                                1A4A95520B4EDCFF002D8C3C /* SharedBufferMac.mm in Sources */,
+                               513BF1280B4F57DC00CCFECE /* AuthenticationMac.mm in Sources */,
                                AA882B2F0B4EF5EB006D26D1 /* PointerEventsHitRules.cpp in Sources */,
+                               510F735F0B56C08800A3002A /* AuthenticationChallenge.cpp in Sources */,
+                               510F73610B56C08800A3002A /* Credential.cpp in Sources */,
+                               510F73630B56C08800A3002A /* ProtectionSpace.cpp in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
index 9a07e23cc6e757d3c796e162ca0fafe99b65105d..78905ca0d3d0673a6ccf6e84c6eb6f4728f09333 100644 (file)
@@ -4053,6 +4053,16 @@ PassRefPtr<SharedBuffer> FrameLoader::mainResourceData() const
     return m_mainResourceLoader->resourceData();
 }
 
+void FrameLoader::didReceiveAuthenticationChallenge(ResourceLoader* loader, const AuthenticationChallenge& currentWebChallenge)
+{
+    m_client->dispatchDidReceiveAuthenticationChallenge(activeDocumentLoader(), loader->identifier(), currentWebChallenge);
+}
+
+void FrameLoader::didCancelAuthenticationChallenge(ResourceLoader* loader, const AuthenticationChallenge& currentWebChallenge)
+{
+    m_client->dispatchDidCancelAuthenticationChallenge(activeDocumentLoader(), loader->identifier(), currentWebChallenge);
+}
+
 PolicyCheck::PolicyCheck()
     : m_navigationFunction(0)
     , m_newWindowFunction(0)
index f447b49078ba3ad2356fab7431472278d2dafc85..1197186e146775258203af5bde07d1043870ce34 100644 (file)
@@ -67,6 +67,7 @@ namespace KJS {
 
 namespace WebCore {
 
+    class AuthenticationChallenge;
     class DocumentLoader;
     class Element;
     class Event;
@@ -211,13 +212,12 @@ namespace WebCore {
         DocumentLoader* provisionalDocumentLoader();
         FrameState state() const;
         static double timeOfLastCompletedLoad();
-
+        
+        void didReceiveAuthenticationChallenge(ResourceLoader*, const AuthenticationChallenge&);
+        void didCancelAuthenticationChallenge(ResourceLoader*, const AuthenticationChallenge&);
+        
         id identifierForInitialRequest(const ResourceRequest&);
         void willSendRequest(ResourceLoader*, ResourceRequest&, const ResourceResponse& redirectResponse);
-#if PLATFORM(MAC)
-        void didReceiveAuthenticationChallenge(ResourceLoader*, NSURLAuthenticationChallenge *);
-        void didCancelAuthenticationChallenge(ResourceLoader*, NSURLAuthenticationChallenge *);
-#endif
         void didReceiveResponse(ResourceLoader*, const ResourceResponse&);
         void didReceiveData(ResourceLoader*, const char*, int, int lengthReceived);
         void didFinishLoad(ResourceLoader*);
index 8f34328862dbfc17fecbd3a042043ec7758f392c..a92f2fc261121cb007833ca25f9f01326daee539 100644 (file)
@@ -46,6 +46,7 @@ typedef void* id;
 
 namespace WebCore {
 
+    class AuthenticationChallenge;
     class DocumentLoader;
     class Element;
     class FormState;
@@ -55,12 +56,12 @@ namespace WebCore {
     class KURL;
     class NavigationAction;
     class PageCache;
-    class String;
     class ResourceError;
     class ResourceHandle;
     class ResourceLoader;
     class ResourceRequest;
     class ResourceResponse;
+    class String;
 
     typedef void (FrameLoader::*FramePolicyFunction)(PolicyAction);
 
@@ -89,16 +90,10 @@ namespace WebCore {
 
         virtual void loadedFromPageCache() = 0;
 
-        virtual void download(ResourceHandle*, const ResourceRequest&, const ResourceResponse&) = 0;
+        virtual void dispatchDidReceiveAuthenticationChallenge(DocumentLoader*, id identifier, const AuthenticationChallenge&) = 0;
+        virtual void dispatchDidCancelAuthenticationChallenge(DocumentLoader*, id identifier, const AuthenticationChallenge&) = 0;
 
-#if PLATFORM(MAC)
-        virtual id dispatchIdentifierForInitialRequest(DocumentLoader*, const ResourceRequest&) = 0;
-#endif
         virtual void dispatchWillSendRequest(DocumentLoader*, id identifier, ResourceRequest&, const ResourceResponse& redirectResponse) = 0;
-#if PLATFORM(MAC)
-        virtual void dispatchDidReceiveAuthenticationChallenge(DocumentLoader*, id identifier, NSURLAuthenticationChallenge *) = 0;
-        virtual void dispatchDidCancelAuthenticationChallenge(DocumentLoader*, id identifier, NSURLAuthenticationChallenge *) = 0;
-#endif
         virtual void dispatchDidReceiveResponse(DocumentLoader*, id identifier, const ResourceResponse&) = 0;
         virtual void dispatchDidReceiveContentLength(DocumentLoader*, id identifier, int lengthReceived) = 0;
         virtual void dispatchDidFinishLoading(DocumentLoader*, id identifier) = 0;
@@ -194,6 +189,11 @@ namespace WebCore {
         
         virtual void saveDocumentViewToPageCache(PageCache*) = 0;
         virtual bool canCachePage() const = 0;
+        virtual void download(ResourceHandle*, const ResourceRequest&, const ResourceResponse&) = 0;
+
+#if PLATFORM(MAC)
+        virtual id dispatchIdentifierForInitialRequest(DocumentLoader*, const ResourceRequest&) = 0;
+#endif
     };
 
 } // namespace WebCore
index 06fc7ff5aca65fcb40c400a5fa5dfd22d7df6d2a..6507288adc0fb9b610f5bda3dfa47c25abaab434 100644 (file)
@@ -55,7 +55,7 @@ ResourceLoader::ResourceLoader(Frame* frame)
     , m_calledDidFinishLoad(false)
     , m_frame(frame)
 #if PLATFORM(MAC)
-    , m_currentConnectionChallenge(nil)
+    , m_currentMacChallenge(nil)
 #endif
     , m_defersLoading(frame->page()->defersLoading())
 {
@@ -255,9 +255,10 @@ void ResourceLoader::didCancel(const ResourceError& error)
     m_cancelled = true;
     
 #if PLATFORM(MAC)
-    m_currentConnectionChallenge = nil;
-    m_currentWebChallenge = nil;
+    m_currentMacChallenge = nil;
 #endif
+    m_currentWebChallenge.nullify();
+
 
     frameLoader()->cancelPendingArchiveLoad(this);
     if (m_handle) {
index 91d8b78a1512db22f611c6de2278d9f077658f6c..8ab19e8e91cf29979586929f14d1f9f53142074f 100644 (file)
@@ -34,6 +34,7 @@
 #include "ResourceResponse.h"
 #include "ResourceLoader.h"
 #include "Shared.h"
+#include "AuthenticationChallenge.h"
 #include "KURL.h"
 
 #include <wtf/Forward.h>
@@ -93,7 +94,7 @@ namespace WebCore {
         virtual void addData(const char*, int, bool allAtOnce);
         virtual PassRefPtr<SharedBuffer> resourceData();
         void clearResourceData();
-
+        
         virtual void willSendRequest(ResourceRequest&, const ResourceResponse& redirectResponse);
         virtual void didReceiveResponse(const ResourceResponse&);
         virtual void didReceiveData(const char*, int, long long lengthReceived, bool allAtOnce);
@@ -101,13 +102,7 @@ namespace WebCore {
         virtual void didFinishLoading();
         virtual void didFail(const ResourceError&);
 #if PLATFORM(MAC)
-        void didReceiveAuthenticationChallenge(NSURLAuthenticationChallenge *);
-        void didCancelAuthenticationChallenge(NSURLAuthenticationChallenge *);
         NSCachedURLResponse *willCacheResponse(NSCachedURLResponse *);
-
-        void receivedCredential(NSURLAuthenticationChallenge *, NSURLCredential *);
-        void receivedRequestToContinueWithoutCredential(NSURLAuthenticationChallenge *);
-        void receivedCancellation(NSURLAuthenticationChallenge *);
 #endif
 
         // ResourceHandleClient
@@ -116,19 +111,22 @@ namespace WebCore {
         virtual void didReceiveData(ResourceHandle*, const char*, int, int lengthReceived);
         virtual void didFinishLoading(ResourceHandle*);
         virtual void didFail(ResourceHandle*, const ResourceError&);
-
         virtual void willStopBufferingData(ResourceHandle*, const char* data, int length) { willStopBufferingData(data, length); } 
 
 #if PLATFORM(MAC)
-        virtual void didReceiveAuthenticationChallenge(ResourceHandle*, NSURLAuthenticationChallenge *challenge) { didReceiveAuthenticationChallenge(challenge); } 
-        virtual void didCancelAuthenticationChallenge(ResourceHandle*, NSURLAuthenticationChallenge *challenge) { didCancelAuthenticationChallenge(challenge); } 
-        
-        
         virtual NSCachedURLResponse *willCacheResponse(ResourceHandle*, NSCachedURLResponse *cachedResponse) { return willCacheResponse(cachedResponse); }
         
-        virtual void receivedCredential(ResourceHandle*, NSURLAuthenticationChallenge *challenge, NSURLCredential *credential) { receivedCredential(challenge, credential); }
-        virtual void receivedRequestToContinueWithoutCredential(ResourceHandle*, NSURLAuthenticationChallenge *challenge) { receivedRequestToContinueWithoutCredential(challenge); } 
-        virtual void receivedCancellation(ResourceHandle*, NSURLAuthenticationChallenge *challenge) { receivedCancellation(challenge); }
+        void didReceiveAuthenticationChallenge(const AuthenticationChallenge& challenge);
+        void didCancelAuthenticationChallenge(const AuthenticationChallenge& challenge);
+        void receivedCredential(const AuthenticationChallenge&, const Credential&);
+        void receivedRequestToContinueWithoutCredential(const AuthenticationChallenge&);
+        void receivedCancellation(const AuthenticationChallenge&);
+        
+        virtual void didReceiveAuthenticationChallenge(ResourceHandle*, const AuthenticationChallenge& challenge) { didReceiveAuthenticationChallenge(challenge); } 
+        virtual void didCancelAuthenticationChallenge(ResourceHandle*, const AuthenticationChallenge& challenge) { didCancelAuthenticationChallenge(challenge); } 
+        virtual void receivedCredential(ResourceHandle*, const AuthenticationChallenge& challenge, const Credential& credential) { receivedCredential(challenge, credential); }
+        virtual void receivedRequestToContinueWithoutCredential(ResourceHandle*, const AuthenticationChallenge& challenge) { receivedRequestToContinueWithoutCredential(challenge); } 
+        virtual void receivedCancellation(ResourceHandle*, const AuthenticationChallenge& challenge) { receivedCancellation(challenge); }
 #endif
         
         ResourceHandle* handle() const { return m_handle.get(); }
@@ -146,7 +144,7 @@ namespace WebCore {
         bool defersLoading() const { return m_defersLoading; }
 
         RefPtr<ResourceHandle> m_handle;
-        
+
     private:
         ResourceRequest m_request;
 
@@ -160,9 +158,10 @@ protected:
         ResourceResponse m_response;
 #if PLATFORM(MAC)
         RetainPtr<id> m_identifier;
-        NSURLAuthenticationChallenge *m_currentConnectionChallenge;
-        RetainPtr<NSURLAuthenticationChallenge> m_currentWebChallenge;
+        NSURLAuthenticationChallenge *m_currentMacChallenge;
 #endif
+        AuthenticationChallenge m_currentWebChallenge;
+
         KURL m_originalURL;
         RefPtr<SharedBuffer> m_resourceData;
         bool m_defersLoading;
index 9bf8b357620920ed84873227bfb33cd1015c4d61..31063a4a952f1078734f1f699a6a6c7939d8e492 100644 (file)
@@ -171,16 +171,6 @@ String FrameLoader::referrer() const
     return documentLoader()->request().httpReferrer();
 }
 
-void FrameLoader::didReceiveAuthenticationChallenge(ResourceLoader* loader, NSURLAuthenticationChallenge *currentWebChallenge)
-{
-    m_client->dispatchDidReceiveAuthenticationChallenge(activeDocumentLoader(), loader->identifier(), currentWebChallenge);
-}
-
-void FrameLoader::didCancelAuthenticationChallenge(ResourceLoader* loader, NSURLAuthenticationChallenge *currentWebChallenge)
-{
-    m_client->dispatchDidCancelAuthenticationChallenge(activeDocumentLoader(), loader->identifier(), currentWebChallenge);
-}
-
 void FrameLoader::didChangeTitle(DocumentLoader* loader)
 {
     m_client->didChangeTitle(loader);
index 83dbb2a01680b8aa71f1a373342e7f0a8dd25e59..cb402a4109625b3bd8a3c958facaeee6aa57d2ff 100644 (file)
@@ -29,6 +29,7 @@
 #import "config.h"
 #import "ResourceLoader.h"
 
+#import "AuthenticationMac.h"
 #import "FrameLoader.h"
 #import "FrameMac.h"
 #import "Page.h"
@@ -53,37 +54,40 @@ using namespace WebCore;
 
 namespace WebCore {
 
-void ResourceLoader::didReceiveAuthenticationChallenge(NSURLAuthenticationChallenge *challenge)
+void ResourceLoader::didReceiveAuthenticationChallenge(const AuthenticationChallenge& challenge)
 {
     ASSERT(!m_reachedTerminalState);
-    ASSERT(!m_currentConnectionChallenge);
-    ASSERT(!m_currentWebChallenge);
-
+    ASSERT(!m_currentMacChallenge);
+    ASSERT(m_currentWebChallenge.isNull());
+    // Since NSURLConnection networking relies on keeping a reference to the original NSURLAuthenticationChallenge,
+    // we make sure that is actually present
+    ASSERT(challenge.nsURLAuthenticationChallenge());
+    
     // Protect this in this delegate method since the additional processing can do
     // anything including possibly derefing this; one example of this is Radar 3266216.
     RefPtr<ResourceLoader> protector(this);
 
-    m_currentConnectionChallenge = challenge;
-    NSURLAuthenticationChallenge *webChallenge = [[NSURLAuthenticationChallenge alloc] initWithAuthenticationChallenge:challenge sender:(id<NSURLAuthenticationChallengeSender>)m_handle->delegate()];
-    m_currentWebChallenge = webChallenge;
-
-    frameLoader()->didReceiveAuthenticationChallenge(this, webChallenge);
-
+    m_currentMacChallenge = challenge.nsURLAuthenticationChallenge();
+    NSURLAuthenticationChallenge *webChallenge = [[NSURLAuthenticationChallenge alloc] initWithAuthenticationChallenge:m_currentMacChallenge 
+                                                                                       sender:(id<NSURLAuthenticationChallengeSender>)m_handle->delegate()];
+    m_currentWebChallenge = core(webChallenge);
     [webChallenge release];
+
+    frameLoader()->didReceiveAuthenticationChallenge(this, m_currentWebChallenge);
 }
 
-void ResourceLoader::didCancelAuthenticationChallenge(NSURLAuthenticationChallenge *challenge)
+void ResourceLoader::didCancelAuthenticationChallenge(const AuthenticationChallenge& challenge)
 {
     ASSERT(!m_reachedTerminalState);
-    ASSERT(m_currentConnectionChallenge);
-    ASSERT(m_currentWebChallenge);
-    ASSERT(m_currentConnectionChallenge == challenge);
+    ASSERT(m_currentMacChallenge);
+    ASSERT(!m_currentWebChallenge.isNull());
+    ASSERT(m_currentWebChallenge == challenge);
 
     // Protect this in this delegate method since the additional processing can do
     // anything including possibly derefing this; one example of this is Radar 3266216.
     RefPtr<ResourceLoader> protector(this);
 
-    frameLoader()->didCancelAuthenticationChallenge(this, m_currentWebChallenge.get());
+    frameLoader()->didCancelAuthenticationChallenge(this, m_currentWebChallenge);
 }
 
 NSCachedURLResponse *ResourceLoader::willCacheResponse(NSCachedURLResponse *cachedResponse)
@@ -103,31 +107,31 @@ void ResourceLoader::setIdentifier(id identifier)
 }
 
 
-void ResourceLoader::receivedCredential(NSURLAuthenticationChallenge *challenge, NSURLCredential *credential)
+void ResourceLoader::receivedCredential(const AuthenticationChallenge& challenge, const Credential& credential)
 {
-    ASSERT(challenge);
+    ASSERT(!challenge.isNull());
     if (challenge != m_currentWebChallenge)
         return;
 
-    [[m_currentConnectionChallenge sender] useCredential:credential forAuthenticationChallenge:m_currentConnectionChallenge];
+    [[m_currentMacChallenge sender] useCredential:mac(credential) forAuthenticationChallenge:m_currentMacChallenge];
 
-    m_currentConnectionChallenge = nil;
-    m_currentWebChallenge = nil;
+    m_currentMacChallenge = nil;
+    m_currentWebChallenge.nullify();
 }
 
-void ResourceLoader::receivedRequestToContinueWithoutCredential(NSURLAuthenticationChallenge *challenge)
+void ResourceLoader::receivedRequestToContinueWithoutCredential(const AuthenticationChallenge& challenge)
 {
-    ASSERT(challenge);
+    ASSERT(!challenge.isNull());
     if (challenge != m_currentWebChallenge)
         return;
 
-    [[m_currentConnectionChallenge sender] continueWithoutCredentialForAuthenticationChallenge:m_currentConnectionChallenge];
+    [[m_currentMacChallenge sender] continueWithoutCredentialForAuthenticationChallenge:m_currentMacChallenge];
 
-    m_currentConnectionChallenge = nil;
-    m_currentWebChallenge = nil;
+    m_currentMacChallenge = nil;
+    m_currentWebChallenge.nullify();
 }
 
-void ResourceLoader::receivedCancellation(NSURLAuthenticationChallenge *challenge)
+void ResourceLoader::receivedCancellation(const AuthenticationChallenge& challenge)
 {
     if (challenge != m_currentWebChallenge)
         return;
index 20c990e3cbd5eaaa51e1d79f103e3d8612b1d2db..7d76936148085b6d8e469e1346cb9f9d90b4d560 100644 (file)
@@ -143,8 +143,8 @@ public:
     
     virtual id dispatchIdentifierForInitialRequest(DocumentLoader*, const ResourceRequest&) { return 0; }
     virtual void dispatchWillSendRequest(DocumentLoader*, id identifier, ResourceRequest&, const ResourceResponse& redirectResponse) { }
-    virtual void dispatchDidReceiveAuthenticationChallenge(DocumentLoader*, id identifier, NSURLAuthenticationChallenge *) { }
-    virtual void dispatchDidCancelAuthenticationChallenge(DocumentLoader*, id identifier, NSURLAuthenticationChallenge *) { }
+    virtual void dispatchDidReceiveAuthenticationChallenge(DocumentLoader*, id identifier, const AuthenticationChallenge&) { }
+    virtual void dispatchDidCancelAuthenticationChallenge(DocumentLoader*, id identifier, const AuthenticationChallenge&) { }
     virtual void dispatchDidReceiveResponse(DocumentLoader*, id identifier, const ResourceResponse&) { }
     virtual void dispatchDidReceiveContentLength(DocumentLoader*, id identifier, int lengthReceived) { }
     virtual void dispatchDidFinishLoading(DocumentLoader*, id identifier) { }
diff --git a/WebCore/platform/network/AuthenticationChallenge.cpp b/WebCore/platform/network/AuthenticationChallenge.cpp
new file mode 100644 (file)
index 0000000..35e39ff
--- /dev/null
@@ -0,0 +1,122 @@
+/*
+ * Copyright (C) 2007 Apple Inc.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+#include "config.h"
+#include "AuthenticationChallenge.h"
+
+namespace WebCore {
+
+AuthenticationChallenge::AuthenticationChallenge()
+    : m_isNull(true)
+    , m_previousFailureCount(0)
+{
+}
+
+AuthenticationChallenge::AuthenticationChallenge(const ProtectionSpace& protectionSpace, const Credential& proposedCredential, 
+                                                       unsigned previousFailureCount, const ResourceResponse& response, const ResourceError& error)
+    : m_isNull(false)
+    , m_protectionSpace(protectionSpace)
+    , m_proposedCredential(proposedCredential)
+    , m_previousFailureCount(previousFailureCount)
+    , m_failureResponse(response)
+    , m_error(error)
+{
+}
+
+unsigned AuthenticationChallenge::previousFailureCount() const 
+{ 
+    return m_previousFailureCount; 
+}
+
+const Credential& AuthenticationChallenge::proposedCredential() const 
+{ 
+    return m_proposedCredential; 
+}
+
+const ProtectionSpace& AuthenticationChallenge::protectionSpace() const 
+{ 
+    return m_protectionSpace; 
+}
+
+const ResourceResponse& AuthenticationChallenge::failureResponse() const 
+{ 
+    return m_failureResponse; 
+}
+
+const ResourceError& AuthenticationChallenge::error() const 
+{ 
+    return m_error; 
+}
+
+bool AuthenticationChallenge::isNull() const
+{
+    return m_isNull;
+}
+
+void AuthenticationChallenge::nullify()
+{
+    m_isNull = true;
+}
+
+bool operator==(const AuthenticationChallenge& a, const AuthenticationChallenge& b)
+{
+    if (a.isNull() != b.isNull())
+        return false;
+    if (a.isNull())
+        return true;
+        
+#if PLATFORM(MAC)
+    if (a.sender() != b.sender())
+        return false;
+        
+    if (a.nsURLAuthenticationChallenge() != b.nsURLAuthenticationChallenge())
+        return false;
+#endif
+
+    if (a.protectionSpace() != b.protectionSpace())
+        return false;
+        
+    if (a.proposedCredential() != b.proposedCredential())
+        return false;
+        
+    if (a.previousFailureCount() != b.previousFailureCount())
+        return false;
+        
+    if (a.failureResponse() != b.failureResponse())
+        return false;
+        
+    if (a.error() != b.error())
+        return false;
+        
+    return true;
+}
+
+bool operator!=(const AuthenticationChallenge& a, const AuthenticationChallenge& b)
+{
+    return !(a == b);
+}
+
+}
+
+
diff --git a/WebCore/platform/network/AuthenticationChallenge.h b/WebCore/platform/network/AuthenticationChallenge.h
new file mode 100644 (file)
index 0000000..5923310
--- /dev/null
@@ -0,0 +1,91 @@
+/*
+ * Copyright (C) 2007 Apple Inc.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+#ifndef AuthenticationChallenge_h_
+#define AuthenticationChallenge_h_
+
+#include "Credential.h"
+#include "ProtectionSpace.h"
+#include "ResourceResponse.h"
+#include "ResourceError.h"
+
+#include <wtf/RefPtr.h>
+
+
+#if PLATFORM(MAC)
+#include "RetainPtr.h"
+#ifndef __OBJC__
+typedef struct objc_object *id;
+class NSURLAuthenticationChallenge;
+#else
+@class NSURLAuthenticationChallenge;
+#endif
+#endif
+
+
+namespace WebCore {
+
+class AuthenticationChallenge {
+
+public:
+    AuthenticationChallenge();
+    AuthenticationChallenge(const ProtectionSpace& protectionSpace, const Credential& proposedCredential, unsigned previousFailureCount, const ResourceResponse& response, const ResourceError& error);
+#if PLATFORM(MAC)
+    AuthenticationChallenge(NSURLAuthenticationChallenge *);
+#endif
+
+    unsigned previousFailureCount() const;
+    const Credential& proposedCredential() const;
+    const ProtectionSpace& protectionSpace() const;
+    const ResourceResponse& failureResponse() const;
+    const ResourceError& error() const;
+    
+    bool isNull() const;
+    void nullify();
+    
+#if PLATFORM(MAC)
+    id sender() const { return m_sender.get(); }
+    NSURLAuthenticationChallenge *nsURLAuthenticationChallenge() const { return m_macChallenge.get(); }
+#endif
+
+private:
+    bool m_isNull;
+    ProtectionSpace m_protectionSpace;
+    Credential m_proposedCredential;
+    unsigned m_previousFailureCount;
+    ResourceResponse m_failureResponse;
+    ResourceError m_error;
+
+#if PLATFORM(MAC)
+    RetainPtr<id> m_sender;
+    RetainPtr<NSURLAuthenticationChallenge *> m_macChallenge;
+#endif
+
+};
+
+bool operator==(const AuthenticationChallenge&, const AuthenticationChallenge&);
+bool operator!=(const AuthenticationChallenge&, const AuthenticationChallenge&);
+}
+#endif
+
diff --git a/WebCore/platform/network/Credential.cpp b/WebCore/platform/network/Credential.cpp
new file mode 100644 (file)
index 0000000..4743959
--- /dev/null
@@ -0,0 +1,80 @@
+/*
+ * Copyright (C) 2007 Apple Inc.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+#include "config.h"
+#include "Credential.h"
+
+namespace WebCore {
+
+// Need to enforce empty, non-null strings due to the pickiness of the String == String operator
+// combined with the semantics of the String(NSString*) constructor
+Credential::Credential()
+    : m_user("")
+    , m_password("")
+{
+}
+   
+// Need to enforce empty, non-null strings due to the pickiness of the String == String operator
+// combined with the semantics of the String(NSString*) constructor
+Credential::Credential(const String& user, const String& password, CredentialPersistence persistence)
+    : m_user(user.length() ? user : "")
+    , m_password(password.length() ? password : "")
+    , m_persistence(persistence)
+{
+}
+    
+const String& Credential::user() const
+{ 
+    return m_user; 
+}
+
+const String& Credential::password() const 
+{ 
+    return m_password; 
+}
+
+bool Credential::hasPassword() const 
+{ 
+    return !m_password.isEmpty(); 
+}
+
+CredentialPersistence Credential::persistence() const 
+{ 
+    return m_persistence; 
+}
+
+bool operator==(const Credential& a, const Credential& b)
+{
+    if (a.user() != b.user())
+        return false;
+    if (a.password() != b.password())
+        return false;
+    if (a.persistence() != b.persistence())
+        return false;
+        
+    return true;
+}
+
+}
+
diff --git a/WebCore/platform/network/Credential.h b/WebCore/platform/network/Credential.h
new file mode 100644 (file)
index 0000000..f231673
--- /dev/null
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2007 Apple Inc.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+#ifndef Credential_h_
+#define Credential_h_
+
+#include "PlatformString.h"
+
+namespace WebCore {
+
+enum CredentialPersistence {
+    CredentialPersistenceNone,
+    CredentialPersistenceForSession,
+    CredentialPersistencePermanent
+};
+    
+class Credential {
+
+public:
+    Credential();
+    Credential(const String& user, const String& password, CredentialPersistence);
+    
+    const String& user() const;
+    const String& password() const;
+    bool hasPassword() const;
+    CredentialPersistence persistence() const;
+    
+private:
+    String m_user;
+    String m_password;
+    CredentialPersistence m_persistence;
+};
+
+bool operator==(const Credential& a, const Credential& b);
+inline bool operator!=(const Credential& a, const Credential& b) { return !(a == b); }
+    
+};
+#endif
diff --git a/WebCore/platform/network/ProtectionSpace.cpp b/WebCore/platform/network/ProtectionSpace.cpp
new file mode 100644 (file)
index 0000000..e98386a
--- /dev/null
@@ -0,0 +1,92 @@
+/*
+ * Copyright (C) 2007 Apple Inc.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+#include "config.h"
+#include "ProtectionSpace.h"
+
+namespace WebCore {
+
+// Need to enforce empty, non-null strings due to the pickiness of the String == String operator
+// combined with the semantics of the String(NSString*) constructor
+ProtectionSpace::ProtectionSpace()
+    : m_host("")
+    , m_realm("")
+{
+}
+// Need to enforce empty, non-null strings due to the pickiness of the String == String operator
+// combined with the semantics of the String(NSString*) constructor
+ProtectionSpace::ProtectionSpace(const String& host, int port, ProtectionSpaceServerType serverType, const String& realm, ProtectionSpaceAuthenticationScheme authenticationScheme)
+    : m_host(host.length() ? host : "")
+    , m_port(port)
+    , m_serverType(serverType)
+    , m_realm(realm.length() ? host : "")
+    , m_authenticationScheme(authenticationScheme)
+{    
+}
+    
+const String& ProtectionSpace::host() const 
+{ 
+    return m_host; 
+}
+
+int ProtectionSpace::port() const 
+{
+    return m_port; 
+}
+
+ProtectionSpaceServerType ProtectionSpace::serverType() const 
+{
+    return m_serverType; 
+}
+
+const String& ProtectionSpace::realm() const 
+{ 
+    return m_realm; 
+}
+
+ProtectionSpaceAuthenticationScheme ProtectionSpace::authenticationScheme() const 
+{ 
+    return m_authenticationScheme; 
+}
+
+bool operator==(const ProtectionSpace& a, const ProtectionSpace& b)
+{
+    if (a.host() != b.host())
+        return false;
+    if (a.port() != b.port())
+        return false;
+    if (a.serverType() != b.serverType())
+        return false;
+    if (a.realm() != b.realm())
+        return false;
+    if (a.authenticationScheme() != b.authenticationScheme())
+        return false;
+    
+    return true;
+}
+
+}
+
+
diff --git a/WebCore/platform/network/ProtectionSpace.h b/WebCore/platform/network/ProtectionSpace.h
new file mode 100644 (file)
index 0000000..e9743f5
--- /dev/null
@@ -0,0 +1,74 @@
+/*
+ * Copyright (C) 2007 Apple Inc.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+#ifndef ProtectionSpace_h_
+#define ProtectionSpace_h_
+
+#include "PlatformString.h"
+
+namespace WebCore {
+
+enum ProtectionSpaceServerType {
+  ProtectionSpaceServerHTTP = 1,
+  ProtectionSpaceServerHTTPS = 2,
+  ProtectionSpaceServerFTP = 3,
+  ProtectionSpaceServerFTPS = 4,
+  ProtectionSpaceProxyHTTP = 5,
+  ProtectionSpaceProxyHTTPS = 6,
+  ProtectionSpaceProxyFTP = 7,
+  ProtectionSpaceProxySOCKS = 8
+};
+
+enum ProtectionSpaceAuthenticationScheme {
+  ProtectionSpaceAuthenticationSchemeDefault = 1,
+  ProtectionSpaceAuthenticationSchemeHTTPBasic = 2,
+  ProtectionSpaceAuthenticationSchemeHTTPDigest = 3,
+  ProtectionSpaceAuthenticationSchemeHTMLForm = 4,
+};
+
+class ProtectionSpace {
+
+public:
+    ProtectionSpace();
+    ProtectionSpace(const String& host, int port, ProtectionSpaceServerType, const String& realm, ProtectionSpaceAuthenticationScheme);
+    
+    const String& host() const;
+    int port() const;
+    ProtectionSpaceServerType serverType() const;
+    const String& realm() const;
+    ProtectionSpaceAuthenticationScheme authenticationScheme() const;
+    
+private:
+    String m_host;
+    int m_port;
+    ProtectionSpaceServerType m_serverType;
+    String m_realm;
+    ProtectionSpaceAuthenticationScheme m_authenticationScheme;
+};
+
+bool operator==(const ProtectionSpace& a, const ProtectionSpace& b);
+inline bool operator!=(const ProtectionSpace& a, const ProtectionSpace& b) { return !(a == b); }
+    
+}
+#endif
index d5a52de6add17beb88d0d996bb3fb4705d3adb75..a62d2e7504cea039624bff3647a17e1c9429e27a 100644 (file)
@@ -117,6 +117,29 @@ namespace WebCore {
         bool m_isNull;
 };
 
+inline bool operator==(const ResourceError& a, const ResourceError& b)
+{
+    if (a.isNull() && b.isNull())
+        return true;
+    if (a.isNull() || b.isNull())
+        return false;
+    if (a.domain() != b.domain())
+        return false;
+    if (a.errorCode() != b.errorCode())
+        return false;
+    if (a.failingURL() != b.failingURL())
+        return false;
+    if (a.localizedDescription() != b.localizedDescription())
+        return false;
+#if PLATFORM(MAC)
+    if ((NSError *)a != (NSError *)b)
+        return false;
+#endif
+    return true;
+}
+
+inline bool operator!=(const ResourceError& a, const ResourceError& b) { return !(a == b); }
+
 } // namespace WebCore
 
 #endif // ResourceError_h_
index d2f98f9b97cda3a9bab2d5c3674a7fd3701a8d31..1976cba57d5e67b32b3096ca163d66d8ebe17276 100644 (file)
@@ -77,3 +77,4 @@ const ResourceRequest& ResourceHandle::request() const
 }
 
 } // namespace WebCore
+
index 706992d55edbd63ea4d40541406de48877a66201..02db4af00357f78115ac9e16924e1a61f06d6afe 100644 (file)
 #ifdef __OBJC__
 @class NSCachedURLResponse;
 @class NSData;
-@class NSURLAuthenticationChallenge;
-@class NSURLCredential;
 #else
 class NSCachedURLResponse;
 class NSData;
-class NSURLAuthenticationChallenge;
-class NSURLCredential;
 #endif
 #endif
 
@@ -65,6 +61,8 @@ namespace WebCore {
     typedef RefPtr<PlatformResponseQt> PlatformResponse;
 #endif
 
+    class AuthenticationChallenge;
+    class Credential;
     class KURL;
     class ResourceHandle;
     class ResourceError;
@@ -77,9 +75,6 @@ namespace WebCore {
 
         // request may be modified
         virtual void willSendRequest(ResourceHandle*, ResourceRequest&, const ResourceResponse& redirectResponse) { }
-    
-        // void didReceiveAuthenticationChallenge(ResourceHandle*, const AuthenticationChallenge&) { }
-        // void didCancelAuthenticationChallenge(ResourceHandle*, const AuthenticationChallenge&) { }
 
         virtual void didReceiveResponse(ResourceHandle*, const ResourceResponse&) { }
         virtual void didReceiveData(ResourceHandle*, const char*, int, int lengthReceived) { }
@@ -88,18 +83,16 @@ namespace WebCore {
 
         // cached response may be modified
         // void willCacheResponse(ResourceHandle*, CachedResourceResponse&) { }
-
 #if PLATFORM(MAC)
-        virtual void didReceiveAuthenticationChallenge(ResourceHandle*, NSURLAuthenticationChallenge *) { } 
-        virtual void didCancelAuthenticationChallenge(ResourceHandle*, NSURLAuthenticationChallenge *) { } 
+        virtual void didReceiveAuthenticationChallenge(ResourceHandle*, const AuthenticationChallenge&) { }
+        virtual void didCancelAuthenticationChallenge(ResourceHandle*, const AuthenticationChallenge&) { }
+        virtual void receivedCredential(ResourceHandle*, const AuthenticationChallenge&, const Credential&) { }
+        virtual void receivedRequestToContinueWithoutCredential(ResourceHandle*, const AuthenticationChallenge&) { }
+        virtual void receivedCancellation(ResourceHandle*, const AuthenticationChallenge&) { }
         
         virtual void willStopBufferingData(ResourceHandle*, const char*, int) { } 
         
         virtual NSCachedURLResponse *willCacheResponse(ResourceHandle*, NSCachedURLResponse *cachedResponse) { return cachedResponse; }
-
-        virtual void receivedCredential(ResourceHandle*, NSURLAuthenticationChallenge *, NSURLCredential *) { } 
-        virtual void receivedRequestToContinueWithoutCredential(ResourceHandle*, NSURLAuthenticationChallenge *) { } 
-        virtual void receivedCancellation(ResourceHandle*, NSURLAuthenticationChallenge *) { } 
 #endif
     };
 
index 6479490ab0c4bc9641f1f35dbbe0b2a9b8ed5d9d..53d9d403bb3c02058660c652ed0a4cb9699e8144 100644 (file)
@@ -162,4 +162,33 @@ void ResourceResponse::updateResourceResponse() const
 #endif
 }
 
+bool operator==(const ResourceResponse& a, const ResourceResponse& b)
+{
+    if (a.isNull() != b.isNull())
+        return false;  
+    if (a.url() != b.url())
+        return false;
+    if (a.mimeType() != b.mimeType())
+        return false;
+    if (a.expectedContentLength() != b.expectedContentLength())
+        return false;
+    if (a.textEncodingName() != b.textEncodingName())
+        return false;
+    if (a.suggestedFilename() != b.suggestedFilename())
+        return false;
+    if (a.httpStatusCode() != b.httpStatusCode())
+        return false;
+    if (a.httpStatusText() != b.httpStatusText())
+        return false;
+    if (a.httpHeaderFields() != b.httpHeaderFields())
+        return false;
+    if (a.expirationDate() != b.expirationDate())
+        return false;
+#if PLATFORM(MAC)
+    if (a.nsURLResponse() != b.nsURLResponse())
+        return false;
+#endif
+    return true;
+ }
+
 }
index eacc139f3ecbe9559eb9af3603986ee85d3d3890..4d3d3aef7b6f2faf72ad985c8bcd8c5e9d664c05 100644 (file)
@@ -141,6 +141,9 @@ public:
     
 };
 
+bool operator==(const ResourceResponse& a, const ResourceResponse& b);
+inline bool operator!=(const ResourceResponse& a, const ResourceResponse& b) { return !(a == b); }
+
 } // namespace WebCore
 
 #endif // ResourceResponse_h_
diff --git a/WebCore/platform/network/mac/AuthenticationMac.h b/WebCore/platform/network/mac/AuthenticationMac.h
new file mode 100644 (file)
index 0000000..9290525
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2007 Apple Inc.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+#ifndef AuthenticationMac_h_
+#define AuthenticationMac_h_
+
+#ifdef __OBJC__
+
+@class NSURLAuthenticationChallenge;
+@class NSURLCredential;
+@class NSURLProtectionSpace;
+
+namespace WebCore {
+
+class AuthenticationChallenge;
+class Credential;
+class ProtectionSpace;
+
+NSURLAuthenticationChallenge *mac(const AuthenticationChallenge&);
+NSURLProtectionSpace *mac(const ProtectionSpace&);
+NSURLCredential *mac(const Credential&);
+
+AuthenticationChallenge core(NSURLAuthenticationChallenge *);
+ProtectionSpace core(NSURLProtectionSpace *);
+Credential core(NSURLCredential *);
+
+}
+#endif
+
+#endif
diff --git a/WebCore/platform/network/mac/AuthenticationMac.mm b/WebCore/platform/network/mac/AuthenticationMac.mm
new file mode 100644 (file)
index 0000000..e2e95bb
--- /dev/null
@@ -0,0 +1,224 @@
+/*
+ * Copyright (C) 2007 Apple Inc.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+#import "config.h"
+#import "AuthenticationMac.h"
+
+#import "AuthenticationChallenge.h"
+#import "Credential.h"
+#import "ProtectionSpace.h"
+
+#import <Foundation/NSURLAuthenticationChallenge.h>
+#import <Foundation/NSURLCredential.h>
+#import <Foundation/NSURLProtectionSpace.h>
+
+
+namespace WebCore {
+
+
+AuthenticationChallenge::AuthenticationChallenge(NSURLAuthenticationChallenge *macChallenge)
+    : m_isNull(false)
+    , m_protectionSpace(core([macChallenge protectionSpace]))
+    , m_proposedCredential(core([macChallenge proposedCredential]))
+    , m_previousFailureCount([macChallenge previousFailureCount])
+    , m_failureResponse([macChallenge failureResponse])
+    , m_error([macChallenge error])
+    , m_sender([macChallenge sender])
+    , m_macChallenge(macChallenge)
+{
+}
+
+
+NSURLAuthenticationChallenge *mac(const AuthenticationChallenge& coreChallenge)
+{
+    if (coreChallenge.nsURLAuthenticationChallenge())
+        return coreChallenge.nsURLAuthenticationChallenge();
+        
+    return [[[NSURLAuthenticationChallenge alloc] initWithProtectionSpace:mac(coreChallenge.protectionSpace())
+                                                       proposedCredential:mac(coreChallenge.proposedCredential())
+                                                     previousFailureCount:coreChallenge.previousFailureCount()
+                                                          failureResponse:coreChallenge.failureResponse().nsURLResponse()
+                                                                    error:coreChallenge.error()
+                                                                   sender:coreChallenge.sender()] autorelease];
+}
+
+NSURLProtectionSpace *mac(const ProtectionSpace& coreSpace)
+{
+    NSString *proxyType = nil;
+    NSString *protocol = nil;
+    switch (coreSpace.serverType()) {
+        case ProtectionSpaceServerHTTP:
+            protocol = @"http";
+            break;
+        case ProtectionSpaceServerHTTPS:
+            protocol = @"https";
+            break;
+        case ProtectionSpaceServerFTP:
+            protocol = @"ftp";
+            break;
+        case ProtectionSpaceServerFTPS:
+            protocol = @"ftps";
+            break;
+        case ProtectionSpaceProxyHTTP:
+            proxyType = NSURLProtectionSpaceHTTPProxy;
+            break;
+        case ProtectionSpaceProxyHTTPS:
+            proxyType = NSURLProtectionSpaceHTTPSProxy;
+            break;
+        case ProtectionSpaceProxyFTP:
+            proxyType = NSURLProtectionSpaceFTPProxy;
+            break;
+        case ProtectionSpaceProxySOCKS:
+            proxyType = NSURLProtectionSpaceSOCKSProxy;
+            break;
+        default:
+            ASSERT_NOT_REACHED();
+    }
+  
+    NSString *method = nil;
+    switch (coreSpace.authenticationScheme()) {
+        case ProtectionSpaceAuthenticationSchemeDefault:
+            method = NSURLAuthenticationMethodDefault;
+            break;
+        case ProtectionSpaceAuthenticationSchemeHTTPBasic:
+            method = NSURLAuthenticationMethodHTTPBasic;
+            break;
+        case ProtectionSpaceAuthenticationSchemeHTTPDigest:
+            method = NSURLAuthenticationMethodHTTPDigest;
+            break;
+        case ProtectionSpaceAuthenticationSchemeHTMLForm:
+            method = NSURLAuthenticationMethodHTMLForm;
+            break;
+        default:
+            ASSERT_NOT_REACHED();
+    }
+    
+    if (proxyType)
+        return [[[NSURLProtectionSpace alloc] initWithProxyHost:coreSpace.host()
+                                                           port:coreSpace.port()
+                                                           type:proxyType
+                                                          realm:coreSpace.realm()
+                                           authenticationMethod:method] autorelease];
+    return [[[NSURLProtectionSpace alloc] initWithHost:coreSpace.host()
+                                                  port:coreSpace.port()
+                                              protocol:protocol
+                                                 realm:coreSpace.realm()
+                                  authenticationMethod:method] autorelease];
+}
+
+NSURLCredential *mac(const Credential& coreCredential)
+{
+    NSURLCredentialPersistence persistence;
+    switch (coreCredential.persistence()) {
+        case CredentialPersistenceNone:
+            persistence = NSURLCredentialPersistenceNone;
+            break;
+        case CredentialPersistenceForSession:
+            persistence = NSURLCredentialPersistenceForSession;
+            break;
+        case CredentialPersistencePermanent:
+            persistence = NSURLCredentialPersistencePermanent;
+            break;
+        default:
+            ASSERT_NOT_REACHED();
+    }
+    
+    return [NSURLCredential credentialWithUser:coreCredential.user()
+                                      password:coreCredential.password()
+                                   persistence:persistence];
+}
+
+AuthenticationChallenge core(NSURLAuthenticationChallenge *macChallenge)
+{
+    return AuthenticationChallenge(macChallenge);
+}
+
+ProtectionSpace core(NSURLProtectionSpace *macSpace)
+{
+    ProtectionSpaceServerType serverType;
+    
+    if ([macSpace isProxy]) {
+        NSString *proxyType = [macSpace proxyType];
+        if ([proxyType isEqualToString:NSURLProtectionSpaceHTTPProxy])
+            serverType = ProtectionSpaceProxyHTTP;
+        else if ([proxyType isEqualToString:NSURLProtectionSpaceHTTPSProxy])
+            serverType = ProtectionSpaceProxyHTTPS;
+        else if ([proxyType isEqualToString:NSURLProtectionSpaceFTPProxy])
+            serverType = ProtectionSpaceProxyFTP;
+        else if ([proxyType isEqualToString:NSURLProtectionSpaceSOCKSProxy])
+            serverType = ProtectionSpaceProxySOCKS;
+        else 
+            ASSERT_NOT_REACHED();
+    } else {
+        NSString *protocol = [macSpace protocol];
+        if ([protocol caseInsensitiveCompare:@"http"] == NSOrderedSame)
+            serverType = ProtectionSpaceServerHTTP;
+        else if ([protocol caseInsensitiveCompare:@"https"] == NSOrderedSame)
+            serverType = ProtectionSpaceServerHTTPS;
+        else if ([protocol caseInsensitiveCompare:@"ftp"] == NSOrderedSame)
+            serverType = ProtectionSpaceServerFTP;
+        else if ([protocol caseInsensitiveCompare:@"ftps"] == NSOrderedSame)
+            serverType = ProtectionSpaceServerFTPS;
+        else
+            ASSERT_NOT_REACHED();
+    }
+
+    ProtectionSpaceAuthenticationScheme scheme;
+    NSString *method = [macSpace authenticationMethod];
+    if ([method isEqualToString:NSURLAuthenticationMethodDefault])
+        scheme = ProtectionSpaceAuthenticationSchemeDefault;
+    else if ([method isEqualToString:NSURLAuthenticationMethodHTTPBasic])
+        scheme = ProtectionSpaceAuthenticationSchemeHTTPBasic;
+    else if ([method isEqualToString:NSURLAuthenticationMethodHTTPDigest])
+        scheme = ProtectionSpaceAuthenticationSchemeHTTPDigest;
+    else if ([method isEqualToString:NSURLAuthenticationMethodHTMLForm])
+        scheme = ProtectionSpaceAuthenticationSchemeHTMLForm;
+    else
+        ASSERT_NOT_REACHED();
+        
+    return ProtectionSpace([macSpace host], [macSpace port], serverType, [macSpace realm], scheme);
+
+}
+
+Credential core(NSURLCredential *macCredential)
+{
+    CredentialPersistence persistence;
+    switch ([macCredential persistence]) {
+        case NSURLCredentialPersistenceNone:
+            persistence = CredentialPersistenceNone;
+            break;
+        case NSURLCredentialPersistenceForSession:
+            persistence = CredentialPersistenceForSession;
+            break;
+        case NSURLCredentialPersistencePermanent:
+            persistence = CredentialPersistencePermanent;
+            break;
+        default:
+            ASSERT_NOT_REACHED();
+    }
+    
+    return Credential([macCredential user], [macCredential password], persistence);
+}
+
+};
index e9bf552b13d4829369c7fd049d2879577d56e20b..78c6ab9408edff53650d6efb10df96a8e21dd549 100644 (file)
@@ -27,6 +27,7 @@
 #import "ResourceHandle.h"
 #import "ResourceHandleInternal.h"
 
+#import "AuthenticationMac.h"
 #import "BlockExceptions.h"
 #import "DocLoader.h"
 #import "FrameLoader.h"
@@ -35,6 +36,7 @@
 #import "ResourceResponse.h"
 #import "SharedBuffer.h"
 #import "SubresourceLoader.h"
+#import "AuthenticationChallenge.h"
 #import "WebCoreSystemInterface.h"
 
 using namespace WebCore;
@@ -261,7 +263,7 @@ void ResourceHandle::loadResourceSynchronously(const ResourceRequest& request, R
     if (!m_handle)
         return;
     ++inNSURLConnectionCallback;
-    m_handle->client()->didReceiveAuthenticationChallenge(m_handle, challenge);
+    m_handle->client()->didReceiveAuthenticationChallenge(m_handle, core(challenge));
     --inNSURLConnectionCallback;
 }
 
@@ -270,7 +272,7 @@ void ResourceHandle::loadResourceSynchronously(const ResourceRequest& request, R
     if (!m_handle)
         return;
     ++inNSURLConnectionCallback;
-    m_handle->client()->didCancelAuthenticationChallenge(m_handle, challenge);
+    m_handle->client()->didCancelAuthenticationChallenge(m_handle, core(challenge));
     --inNSURLConnectionCallback;
 }
 
@@ -337,21 +339,21 @@ void ResourceHandle::loadResourceSynchronously(const ResourceRequest& request, R
 {
     if (!m_handle)
         return;
-    m_handle->client()->receivedCredential(m_handle, challenge, credential);
+    m_handle->client()->receivedCredential(m_handle, core(challenge), core(credential));
 }
 
 - (void)continueWithoutCredentialForAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge
 {
     if (!m_handle)
         return;
-    m_handle->client()->receivedRequestToContinueWithoutCredential(m_handle, challenge);
+    m_handle->client()->receivedRequestToContinueWithoutCredential(m_handle, core(challenge));
 }
 
 - (void)cancelAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge
 {
     if (!m_handle)
         return;
-    m_handle->client()->receivedCancellation(m_handle, challenge);
+    m_handle->client()->receivedCancellation(m_handle, core(challenge));
 }
 
 @end
index 3b3a8fbc1ee267f46737e483790f7a726715ebba..918972cf48eeb07412e41fd1852d79e449022bdb 100644 (file)
@@ -1,3 +1,15 @@
+2007-01-11  Brady Eidson  <beidson@apple.com>
+
+        Reviewed by Anders
+
+        Rewrites HTTP Authentication setting up a more platform-independent structure
+
+        * WebCoreSupport/WebFrameLoaderClient.h:
+        * WebCoreSupport/WebFrameLoaderClient.mm:
+        (WebFrameLoaderClient::dispatchDidReceiveAuthenticationChallenge):
+        (WebFrameLoaderClient::dispatchDidCancelAuthenticationChallenge):
+        * WebKit.xcodeproj/project.pbxproj:
+
 2007-01-11  Darin Adler  <darin@apple.com>
 
         Reviewed by Mitz.
index 32b4cbe73004ce98a3eb0e468d6301b252085265..0b1abcb6522e5e89d53a77029ba822d74d8ccf78 100644 (file)
@@ -38,6 +38,7 @@
 @class WebResource;
 
 namespace WebCore {
+    class AuthenticationChallenge;
     class HistoryItem;
     class PageCache;
     class String;
@@ -81,8 +82,8 @@ private:
 
     virtual id dispatchIdentifierForInitialRequest(WebCore::DocumentLoader*, const WebCore::ResourceRequest&);
     virtual void dispatchWillSendRequest(WebCore::DocumentLoader*, id identifier, WebCore::ResourceRequest&, const WebCore::ResourceResponse& redirectResponse);
-    virtual void dispatchDidReceiveAuthenticationChallenge(WebCore::DocumentLoader*, id identifier, NSURLAuthenticationChallenge *);
-    virtual void dispatchDidCancelAuthenticationChallenge(WebCore::DocumentLoader*, id identifier, NSURLAuthenticationChallenge *);
+    virtual void dispatchDidReceiveAuthenticationChallenge(WebCore::DocumentLoader*, id identifier, const WebCore::AuthenticationChallenge&);
+    virtual void dispatchDidCancelAuthenticationChallenge(WebCore::DocumentLoader*, id identifier, const WebCore::AuthenticationChallenge&);
     virtual void dispatchDidReceiveResponse(WebCore::DocumentLoader*, id identifier, const WebCore::ResourceResponse&);
     virtual void dispatchDidReceiveContentLength(WebCore::DocumentLoader*, id identifier, int lengthReceived);
     virtual void dispatchDidFinishLoading(WebCore::DocumentLoader*, id identifier);
index d6fed6a2fae4a5025c8a1d3d10b2a09fb3fd6e66..1b4e7d3c754ad205d47779c7eb218e9674742d47 100644 (file)
@@ -64,6 +64,7 @@
 #import "WebScriptDebugServerPrivate.h"
 #import "WebUIDelegate.h"
 #import "WebViewInternal.h"
+#import <WebCore/AuthenticationMac.h>
 #import <WebCore/Chrome.h>
 #import <WebCore/Document.h>
 #import <WebCore/DocumentLoader.h>
@@ -283,35 +284,37 @@ void WebFrameLoaderClient::dispatchWillSendRequest(DocumentLoader* loader, id id
         request = implementations.willSendRequestFunc(resourceLoadDelegate, @selector(webView:resource:willSendRequest:redirectResponse:fromDataSource:), webView, identifier, request.nsURLRequest(), redirectResponse.nsURLResponse(), dataSource(loader));
 }
 
-void WebFrameLoaderClient::dispatchDidReceiveAuthenticationChallenge(DocumentLoader* loader, id identifier,
-    NSURLAuthenticationChallenge *challenge)
+void WebFrameLoaderClient::dispatchDidReceiveAuthenticationChallenge(DocumentLoader* loader, id identifier, const AuthenticationChallenge& challenge)
 {
     WebView *webView = getWebView(m_webFrame.get());
     id resourceLoadDelegate = [webView resourceLoadDelegate];
     WebResourceDelegateImplementationCache implementations = WebViewGetResourceLoadDelegateImplementations(webView);
 
+    NSURLAuthenticationChallenge *webChallenge = mac(challenge);
+
     if (implementations.delegateImplementsDidReceiveAuthenticationChallenge) {
-        [resourceLoadDelegate webView:webView resource:identifier didReceiveAuthenticationChallenge:challenge fromDataSource:dataSource(loader)];
+        [resourceLoadDelegate webView:webView resource:identifier didReceiveAuthenticationChallenge:webChallenge fromDataSource:dataSource(loader)];
         return;
     }
 
     NSWindow *window = [webView hostWindow] ? [webView hostWindow] : [webView window];
-    [[WebPanelAuthenticationHandler sharedHandler] startAuthentication:challenge window:window];
+    [[WebPanelAuthenticationHandler sharedHandler] startAuthentication:webChallenge window:window];
 }
 
-void WebFrameLoaderClient::dispatchDidCancelAuthenticationChallenge(DocumentLoader* loader, id identifier,
-    NSURLAuthenticationChallenge *challenge)
+void WebFrameLoaderClient::dispatchDidCancelAuthenticationChallenge(DocumentLoader* loader, id identifier, const AuthenticationChallenge&challenge)
 {
     WebView *webView = getWebView(m_webFrame.get());
     id resourceLoadDelegate = [webView resourceLoadDelegate];
     WebResourceDelegateImplementationCache implementations = WebViewGetResourceLoadDelegateImplementations(webView);
 
+    NSURLAuthenticationChallenge *webChallenge = mac(challenge);
+
     if (implementations.delegateImplementsDidCancelAuthenticationChallenge) {
-        [resourceLoadDelegate webView:webView resource:identifier didCancelAuthenticationChallenge:challenge fromDataSource:dataSource(loader)];
+        [resourceLoadDelegate webView:webView resource:identifier didCancelAuthenticationChallenge:webChallenge fromDataSource:dataSource(loader)];
         return;
     }
 
-    [(WebPanelAuthenticationHandler *)[WebPanelAuthenticationHandler sharedHandler] cancelAuthentication:challenge];
+    [(WebPanelAuthenticationHandler *)[WebPanelAuthenticationHandler sharedHandler] cancelAuthentication:webChallenge];
 }
 
 void WebFrameLoaderClient::dispatchDidReceiveResponse(DocumentLoader* loader, id identifier, const ResourceResponse& response)
index c06e8d3fe60415be16c7799c8ae02fee68b2571d..13af5fd635f336ebf7203bd093a0b019559928ef 100644 (file)
@@ -1,3 +1,13 @@
+2007-01-11  Brady Eidson  <beidson@apple.com>
+
+        Keep the fancy new FrameLoaderClientQt building with a small api change in WebCore
+        Yay for the loader on QT!
+
+        * WebCoreSupport/FrameLoaderClientQt.cpp:
+        (WebCore::FrameLoaderClientQt::dispatchDidReceiveAuthenticationChallenge):
+        (WebCore::FrameLoaderClientQt::dispatchDidCancelAuthenticationChallenge):
+        * WebCoreSupport/FrameLoaderClientQt.h:
+
 2007-01-11  Lars Knoll <lars@trolltech.com>
 
         Reviewed by Darin
index fecca8d287c6100aaa4b86d23b168c04c3d863e1..8e43b28dddd6fee66d82d6adff52a4bcaebe21f3 100644 (file)
@@ -735,6 +735,15 @@ bool FrameLoaderClientQt::willUseArchive(WebCore::ResourceLoader*, const WebCore
     return false;
 }
 
+void FrameLoaderClientQt::dispatchDidReceiveAuthenticationChallenge(DocumentLoader*, id, const AuthenticationChallenge&)
+{
+    notImplemented();
+}
+
+void FrameLoaderClientQt::dispatchDidCancelAuthenticationChallenge(DocumentLoader*, id, const AuthenticationChallenge&)
+{
+    notImplemented();
+}
 
 }
 
index 224f1c30f78ed4c39c9a479c0f18dd7a066f2f43..28f21e8acc344c1fd130938ba4a28aa882ce912f 100644 (file)
@@ -37,6 +37,7 @@
 
 namespace WebCore {
 
+    class AuthenticationChallenge;
     class DocumentLoader;
     class Element;
     class FormState;
@@ -190,6 +191,9 @@ namespace WebCore {
         virtual void startDownload(const WebCore::ResourceRequest&);
         virtual bool willUseArchive(WebCore::ResourceLoader*, const WebCore::ResourceRequest&, const WebCore::KURL&) const;
 
+        virtual void dispatchDidReceiveAuthenticationChallenge(DocumentLoader*, id identifier, const AuthenticationChallenge&);
+        virtual void dispatchDidCancelAuthenticationChallenge(DocumentLoader*, id identifier, const AuthenticationChallenge&);
+        
         // FIXME: This should probably not be here, but it's needed for the tests currently
         virtual void partClearedInBegin();