Changeset 167185 in webkit


Ignore:
Timestamp:
Apr 12, 2014 1:01:45 PM (10 years ago)
Author:
commit-queue@webkit.org
Message:

[SOUP] Libsoup internal credential setting should be controlled by loader decision
https://bugs.webkit.org/show_bug.cgi?id=130963

Patch by Youenn Fablet <youenn.fablet@crf.canon.fr> on 2014-04-12
Reviewed by Darin Adler.

Source/WebCore:

Disabled libsoup internal authentication manager for messages for which no credential is available and no stored credentials should be used.
Updated synchronous loader to return whether using credentials or not according StoredCredential loader option parameter.
Unskipped test http/tests/xmlhttprequest/cross-origin-no-authorization.html covers the patch.

  • platform/network/ResourceHandleInternal.h:

(WebCore::ResourceHandleInternal::ResourceHandleInternal): Added m_useAuthenticationManager boolean to control whether disable authentication manager or not.

  • platform/network/soup/ResourceHandleSoup.cpp:

(WebCore::WebCoreSynchronousLoader::WebCoreSynchronousLoader): Added m_storedCredentials member.
(WebCore::WebCoreSynchronousLoader::shouldUseCredentialStorage): Return true if stored credentials are allowed.
(WebCore::applyAuthenticationToRequest): Set m_useAuthenticationManager value to disable authentication manager if cannot use stored credentials and ResourceHandleInternal has no username and password.
(WebCore::createSoupMessageForHandleAndRequest): Disable authentication mananger according m_useAuthenticationManager value.
(WebCore::ResourceHandle::platformLoadResourceSynchronously): Added StoredCredentials loader option to the sync loader constructor.

Source/WebKit/efl:

  • WebCoreSupport/FrameLoaderClientEfl.cpp:

(WebCore::FrameLoaderClientEfl::shouldUseCredentialStorage): Similarly to GTK, let soup/loader layer handle when to use credential storage. Return always true

LayoutTests:

  • platform/efl/TestExpectations: Unskipped http/tests/xmlhttprequest/cross-origin-no-authorization.html.
  • platform/gtk/TestExpectations: Ditto.
Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r167184 r167185  
     12014-04-12  Youenn Fablet  <youenn.fablet@crf.canon.fr>
     2
     3        [SOUP] Libsoup internal credential setting should be controlled by loader decision
     4        https://bugs.webkit.org/show_bug.cgi?id=130963
     5
     6        Reviewed by Darin Adler.
     7
     8        * platform/efl/TestExpectations: Unskipped http/tests/xmlhttprequest/cross-origin-no-authorization.html.
     9        * platform/gtk/TestExpectations: Ditto.
     10
    1112014-04-12  Tibor Meszaros  <tmeszaros.u-szeged@partner.samsung.com>
    212
  • trunk/LayoutTests/platform/efl/TestExpectations

    r167098 r167185  
    238238http/tests/security/xss-DENIED-xsl-external-entity-redirect.xml
    239239http/tests/xmlhttprequest/access-control-basic-whitelist-request-headers.html
    240 http/tests/xmlhttprequest/cross-origin-no-authorization.html
    241240http/tests/xmlhttprequest/logout.html
    242241http/tests/xmlhttprequest/redirect-cross-origin-tripmine.html
  • trunk/LayoutTests/platform/gtk/TestExpectations

    r167139 r167185  
    12471247Bug(GTK) http/tests/xmlhttprequest/logout.html [ Failure ]
    12481248
    1249 Bug(GTK) http/tests/xmlhttprequest/cross-origin-no-authorization.html [ Failure ]
    1250 
    12511249Bug(GTK) media/video-size-intrinsic-scale.html [ Failure ]
    12521250
  • trunk/Source/WebCore/ChangeLog

    r167183 r167185  
     12014-04-12  Youenn Fablet  <youenn.fablet@crf.canon.fr>
     2
     3        [SOUP] Libsoup internal credential setting should be controlled by loader decision
     4        https://bugs.webkit.org/show_bug.cgi?id=130963
     5
     6        Reviewed by Darin Adler.
     7
     8        Disabled libsoup internal authentication manager for messages for which no credential is available and no stored credentials should be used.
     9        Updated synchronous loader to return whether using credentials or not according StoredCredential loader option parameter.
     10        Unskipped test http/tests/xmlhttprequest/cross-origin-no-authorization.html covers the patch.
     11
     12        * platform/network/ResourceHandleInternal.h:
     13        (WebCore::ResourceHandleInternal::ResourceHandleInternal): Added m_useAuthenticationManager boolean to control whether disable authentication manager or not.
     14        * platform/network/soup/ResourceHandleSoup.cpp:
     15        (WebCore::WebCoreSynchronousLoader::WebCoreSynchronousLoader): Added m_storedCredentials member.
     16        (WebCore::WebCoreSynchronousLoader::shouldUseCredentialStorage): Return true if stored credentials are allowed.
     17        (WebCore::applyAuthenticationToRequest): Set m_useAuthenticationManager value to disable authentication manager if cannot use stored credentials and ResourceHandleInternal has no username and password.
     18        (WebCore::createSoupMessageForHandleAndRequest): Disable authentication mananger according m_useAuthenticationManager value.
     19        (WebCore::ResourceHandle::platformLoadResourceSynchronously): Added StoredCredentials loader option to the sync loader constructor.
     20
    1212014-04-11  Darin Adler  <darin@apple.com>
    222
  • trunk/Source/WebCore/platform/network/ResourceHandleInternal.h

    r167183 r167185  
    111111            , m_redirectCount(0)
    112112            , m_previousPosition(0)
     113            , m_useAuthenticationManager(true)
    113114#endif
    114115#if PLATFORM(COCOA)
     
    203204        int m_redirectCount;
    204205        size_t m_previousPosition;
     206        bool m_useAuthenticationManager;
    205207#endif
    206208#if PLATFORM(GTK)
  • trunk/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp

    r166506 r167185  
    8383public:
    8484
    85     WebCoreSynchronousLoader(ResourceError& error, ResourceResponse& response, SoupSession* session, Vector<char>& data)
     85    WebCoreSynchronousLoader(ResourceError& error, ResourceResponse& response, SoupSession* session, Vector<char>& data, StoredCredentials storedCredentials)
    8686        : m_error(error)
    8787        , m_response(response)
     
    8989        , m_data(data)
    9090        , m_finished(false)
     91        , m_storedCredentials(storedCredentials)
     92       
    9193    {
    9294        // We don't want any timers to fire while we are doing our synchronous load
     
    174176    }
    175177
     178    virtual bool shouldUseCredentialStorage(ResourceHandle*)
     179    {
     180        return m_storedCredentials == AllowStoredCredentials;
     181    }
     182
    176183    void run()
    177184    {
     
    187194    bool m_finished;
    188195    GRefPtr<GMainLoop> m_mainLoop;
     196    StoredCredentials m_storedCredentials;
    189197};
    190198
     
    356364    }
    357365
    358     if (user.isEmpty() && password.isEmpty())
    359         return;
     366    if (user.isEmpty() && password.isEmpty()) {
     367        // In case credential is not available from the handle and credential storage should not to be used,
     368        // disable authentication manager so that credentials stored in libsoup are not used.
     369        d->m_useAuthenticationManager = handle->shouldUseCredentialStorage();
     370        return;
     371    }
    360372
    361373    // We always put the credentials into the URL. In the CFNetwork-port HTTP family credentials are applied in
     
    937949    if (!handle->shouldContentSniff())
    938950        soup_message_disable_feature(soupMessage, SOUP_TYPE_CONTENT_SNIFFER);
     951    if (!d->m_useAuthenticationManager)
     952        soup_message_disable_feature(soupMessage, SOUP_TYPE_AUTH_MANAGER);
    939953
    940954    FormData* httpBody = request.httpBody();
     
    12711285}
    12721286
    1273 void ResourceHandle::platformLoadResourceSynchronously(NetworkingContext* context, const ResourceRequest& request, StoredCredentials /*storedCredentials*/, ResourceError& error, ResourceResponse& response, Vector<char>& data)
     1287void ResourceHandle::platformLoadResourceSynchronously(NetworkingContext* context, const ResourceRequest& request, StoredCredentials storedCredentials, ResourceError& error, ResourceResponse& response, Vector<char>& data)
    12741288{
    12751289    ASSERT(!loadingSynchronousRequest);
     
    12771291        return;                    // we want to avoid accidentally going into an infinite loop of requests.
    12781292
    1279     WebCoreSynchronousLoader syncLoader(error, response, sessionFromContext(context), data);
     1293    WebCoreSynchronousLoader syncLoader(error, response, sessionFromContext(context), data, storedCredentials);
    12801294    RefPtr<ResourceHandle> handle = create(context, request, &syncLoader, false /*defersLoading*/, false /*shouldContentSniff*/);
    12811295    if (!handle)
  • trunk/Source/WebKit/efl/ChangeLog

    r166991 r167185  
     12014-04-12  Youenn Fablet  <youenn.fablet@crf.canon.fr>
     2
     3        [SOUP] Libsoup internal credential setting should be controlled by loader decision
     4        https://bugs.webkit.org/show_bug.cgi?id=130963
     5
     6        Reviewed by Darin Adler.
     7
     8        * WebCoreSupport/FrameLoaderClientEfl.cpp:
     9        (WebCore::FrameLoaderClientEfl::shouldUseCredentialStorage): Similarly to GTK, let soup/loader layer handle when to use credential storage. Return always true 
     10
    1112014-04-08  Ryuan Choi  <ryuan.choi@samsung.com>
    212
  • trunk/Source/WebKit/efl/WebCoreSupport/FrameLoaderClientEfl.cpp

    r165676 r167185  
    222222bool FrameLoaderClientEfl::shouldUseCredentialStorage(DocumentLoader*, unsigned long)
    223223{
    224     notImplemented();
    225     return false;
     224    return true;
    226225}
    227226
Note: See TracChangeset for help on using the changeset viewer.