Changeset 235418 in webkit


Ignore:
Timestamp:
Aug 27, 2018 5:43:44 PM (6 years ago)
Author:
Basuke Suzuki
Message:

[Curl] Enable Proxy Authentication on WebKit.
https://bugs.webkit.org/show_bug.cgi?id=188998

Reviewed by Alex Christensen.

Add support for proxy authentication to curl backend running on WebKit.
This is follow up implementation of legacy implementation:

  • NetworkProcess/curl/NetworkDataTaskCurl.cpp:

(WebKit::NetworkDataTaskCurl::curlDidReceiveResponse):
(WebKit::NetworkDataTaskCurl::tryProxyAuthentication):

  • NetworkProcess/curl/NetworkDataTaskCurl.h:
  • NetworkProcess/curl/NetworkProcessCurl.cpp:
  • PlatformWin.cmake:
Location:
trunk/Source/WebKit
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r235414 r235418  
     12018-08-27  Basuke Suzuki  <Basuke.Suzuki@sony.com>
     2
     3        [Curl] Enable Proxy Authentication on WebKit.
     4        https://bugs.webkit.org/show_bug.cgi?id=188998
     5
     6        Reviewed by Alex Christensen.
     7
     8        Add support for proxy authentication to curl backend running on WebKit.
     9        This is follow up implementation of legacy implementation:
     10        - https://bugs.webkit.org/show_bug.cgi?id=185266
     11
     12        * NetworkProcess/curl/NetworkDataTaskCurl.cpp:
     13        (WebKit::NetworkDataTaskCurl::curlDidReceiveResponse):
     14        (WebKit::NetworkDataTaskCurl::tryProxyAuthentication):
     15        * NetworkProcess/curl/NetworkDataTaskCurl.h:
     16        * NetworkProcess/curl/NetworkProcessCurl.cpp:
     17        * PlatformWin.cmake:
     18
    1192018-08-27  Wenson Hsieh  <wenson_hsieh@apple.com>
    220
  • trunk/Source/WebKit/NetworkProcess/curl/NetworkDataTaskCurl.cpp

    r235326 r235418  
    170170    }
    171171
     172    if (m_response.isProxyAuthenticationRequired()) {
     173        tryProxyAuthentication(AuthenticationChallenge(receivedResponse, 0, m_response));
     174        return;
     175    }
     176
    172177    didReceiveResponse(ResourceResponse(m_response), [this, protectedThis = makeRef(*this)](PolicyAction policyAction) {
    173178        if (m_state == State::Canceling || m_state == State::Completed)
     
    361366}
    362367
     368void NetworkDataTaskCurl::tryProxyAuthentication(WebCore::AuthenticationChallenge&& challenge)
     369{
     370    m_client->didReceiveChallenge(AuthenticationChallenge(challenge), [this, protectedThis = makeRef(*this), challenge](AuthenticationChallengeDisposition disposition, const Credential& credential) {
     371        if (m_state == State::Canceling || m_state == State::Completed)
     372            return;
     373
     374        if (disposition == AuthenticationChallengeDisposition::Cancel) {
     375            cancel();
     376            m_client->didCompleteWithError(ResourceError::httpError(CURLE_COULDNT_RESOLVE_PROXY, m_response.url()));
     377            return;
     378        }
     379
     380        CurlContext::singleton().setProxyUserPass(credential.user(), credential.password());
     381        CurlContext::singleton().setDefaultProxyAuthMethod();
     382
     383        auto requestCredential = m_curlRequest ? Credential(m_curlRequest->user(), m_curlRequest->password(), CredentialPersistenceNone) : Credential();
     384        restartWithCredential(requestCredential);
     385    });
     386}
     387
    363388void NetworkDataTaskCurl::restartWithCredential(const Credential& credential)
    364389{
  • trunk/Source/WebKit/NetworkProcess/curl/NetworkDataTaskCurl.h

    r235326 r235418  
    7474
    7575    void tryHttpAuthentication(WebCore::AuthenticationChallenge&&);
     76    void tryProxyAuthentication(WebCore::AuthenticationChallenge&&);
    7677    void restartWithCredential(const WebCore::Credential&);
    7778
  • trunk/Source/WebKit/NetworkProcess/curl/NetworkProcessCurl.cpp

    r234651 r235418  
    3434#include <WebCore/FileSystem.h>
    3535#include <WebCore/NetworkStorageSession.h>
     36#include "WebCookieManager.h"
     37#include <WebCore/CurlContext.h>
    3638#include <WebCore/NotImplemented.h>
    3739#include <WebCore/ResourceHandle.h>
  • trunk/Source/WebKit/PlatformWin.cmake

    r235098 r235418  
    177177
    178178    list(APPEND WebKit_INCLUDE_DIRECTORIES
     179        "${WEBCORE_DIR}/platform/network/curl"
    179180        "${WEBKIT_DIR}/NetworkProcess/curl"
    180181        "${WEBKIT_DIR}/WebProcess/WebCoreSupport/curl"
Note: See TracChangeset for help on using the changeset viewer.