Changeset 161890 in webkit
- Timestamp:
- Jan 13, 2014 10:25:43 AM (10 years ago)
- Location:
- trunk/Source
- Files:
-
- 2 added
- 25 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r161889 r161890 1 2014-01-13 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 [SOUP] Add SoupNetworkSession class to wrap a SoupSession 4 https://bugs.webkit.org/show_bug.cgi?id=126813 5 6 Reviewed by Gustavo Noronha Silva. 7 8 Add SoupNetworkSession class that wraps a SoupSession and move all 9 the code related to the SoupSession from ResourceHandle to 10 SoupNetworkSession, including the static methods to get the 11 default session and create testing and private sessions. 12 13 * GNUmakefile.list.am: Add new files to compilation. 14 * PlatformEfl.cmake: Ditto. 15 * PlatformGTK.cmake: Ditto. 16 * platform/network/NetworkStorageSession.h: Use SoupNetworkSession 17 instead of SoupSession. 18 * platform/network/ResourceHandle.h: 19 * platform/network/soup/CookieJarSoup.cpp: 20 (WebCore::cookieJarForSession): Use SoupNetworkSession to get the 21 SoupSession. 22 * platform/network/soup/DNSSoup.cpp: 23 (WebCore::DNSResolveQueue::platformResolve): Ditto. 24 * platform/network/soup/NetworkStorageSessionSoup.cpp: 25 (WebCore::NetworkStorageSession::NetworkStorageSession): Use 26 SoupNetworkSession instead of SoupSession. 27 (WebCore::NetworkStorageSession::~NetworkStorageSession): 28 (WebCore::NetworkStorageSession::defaultStorageSession): Create a 29 NetworkStorageSession with a NULL SoupNetworkSession which means 30 that the default SoupNetworkSession will be used. 31 (WebCore::NetworkStorageSession::createPrivateBrowsingSession): 32 Call SoupNetworkSession::createPrivateBrowsingSession() to create 33 the private session. 34 (WebCore::NetworkStorageSession::switchToNewTestingSession): Call 35 SoupNetworkSession::createTestingSession() to create the testing 36 session. 37 (WebCore::NetworkStorageSession::soupNetworkSession): Return the 38 SoupNetworkSession or the default one. 39 (WebCore::NetworkStorageSession::setSoupNetworkSession): Set a new 40 SoupNetworkSession. 41 * platform/network/soup/ResourceHandleSoup.cpp: 42 (WebCore::sessionFromContext): Use SoupNetworkSession to get the 43 SoupSession. 44 (WebCore::ResourceHandleInternal::soupSession): Simply call 45 sessionFromContext(), since ensureSessionIsInitialized() is no 46 longer needed, because the SoupSession are now initialized in the 47 SoupNetworkSession constructor. 48 (WebCore::ResourceHandle::didStartRequest): Function to notify the 49 ResourceHandle that current request has just started for web timing. 50 * platform/network/soup/SoupNetworkSession.cpp: Added. 51 (WebCore::soupLogPrinter): Logger callback. 52 (WebCore::SoupNetworkSession::defaultSession): Return a reference 53 to the default SoupNetworkSession. 54 (WebCore::SoupNetworkSession::createPrivateBrowsingSession): 55 Create a new private session. 56 (WebCore::SoupNetworkSession::createTestingSession): Create a new 57 testing session. 58 (WebCore::SoupNetworkSession::createForSoupSession): Create a new 59 SoupNetworkSession for the given SoupSession. 60 (WebCore::authenticateCallback): Callback emitted by the 61 SoupSession when the request needs authentication. 62 (WebCore::requestStartedCallback): Callback emitted by the 63 SoupSession when as request has just started. 64 (WebCore::SoupNetworkSession::SoupNetworkSession): 65 (WebCore::SoupNetworkSession::~SoupNetworkSession): 66 (WebCore::SoupNetworkSession::setupLogger): Helper private 67 function to setup the logger. 68 (WebCore::SoupNetworkSession::setCookieJar): Set a new CookieJar 69 in the session replacing the existing one. 70 (WebCore::SoupNetworkSession::cookieJar): Return the current 71 CookieJar of the session. 72 (WebCore::SoupNetworkSession::setCache): Set a disk cache. 73 (WebCore::SoupNetworkSession::cache): Return the current disk cache. 74 (WebCore::SoupNetworkSession::setSSLPolicy): Set the SSL policy. 75 (WebCore::SoupNetworkSession::sslPolicy): Get the current SSL policy. 76 (WebCore::SoupNetworkSession::setHTTPProxy): Set the HTTP proxy. 77 (WebCore::SoupNetworkSession::httpProxy): Get the current HTTP proxy. 78 (WebCore::SoupNetworkSession::setupHTTPProxyFromEnvironment): Set 79 the HTTP proxy using the environment variables. 80 (WebCore::buildAcceptLanguages): Helper function build the accept 81 language string in the format expected by soup (RFC 2616). 82 (WebCore::SoupNetworkSession::setAcceptLanguages): Set the accept 83 language for the given list of languages. 84 * platform/network/soup/SoupNetworkSession.h: Added. 85 (WebCore::SoupNetworkSession::soupSession): Return the SoupSession. 86 1 87 2014-01-13 Brent Fulgham <bfulgham@apple.com> 2 88 -
trunk/Source/WebCore/GNUmakefile.list.am
r161817 r161890 5473 5473 Source/WebCore/platform/network/BlobResourceHandle.cpp \ 5474 5474 Source/WebCore/platform/network/BlobResourceHandle.h \ 5475 Source/WebCore/platform/network/soup/CertificateInfo.h \5476 5475 Source/WebCore/platform/network/BlobStorageData.h \ 5477 5476 Source/WebCore/platform/network/FormDataBuilder.cpp \ … … 5495 5494 Source/WebCore/platform/network/soup/AuthenticationChallenge.h \ 5496 5495 Source/WebCore/platform/network/soup/AuthenticationChallengeSoup.cpp \ 5496 Source/WebCore/platform/network/soup/CertificateInfo.h \ 5497 5497 Source/WebCore/platform/network/soup/CertificateInfo.cpp \ 5498 5498 Source/WebCore/platform/network/soup/CookieJarSoup.cpp \ … … 5507 5507 Source/WebCore/platform/network/soup/ResourceResponse.h \ 5508 5508 Source/WebCore/platform/network/soup/ResourceResponseSoup.cpp \ 5509 Source/WebCore/platform/network/soup/SoupNetworkSession.h \ 5510 Source/WebCore/platform/network/soup/SoupNetworkSession.cpp \ 5509 5511 Source/WebCore/platform/network/soup/SynchronousLoaderClientSoup.cpp \ 5510 5512 Source/WebCore/platform/ScrollableArea.cpp \ -
trunk/Source/WebCore/PlatformEfl.cmake
r161389 r161890 167 167 platform/network/soup/ResourceResponseSoup.cpp 168 168 platform/network/soup/SocketStreamHandleSoup.cpp 169 platform/network/soup/SoupNetworkSession.cpp 169 170 platform/network/soup/SoupURIUtils.cpp 170 171 platform/network/soup/SynchronousLoaderClientSoup.cpp -
trunk/Source/WebCore/PlatformGTK.cmake
r161817 r161890 125 125 platform/network/soup/ResourceResponseSoup.cpp 126 126 platform/network/soup/SocketStreamHandleSoup.cpp 127 platform/network/soup/SoupNetworkSession.cpp 127 128 platform/network/soup/SoupURIUtils.cpp 128 129 platform/network/soup/SynchronousLoaderClientSoup.cpp -
trunk/Source/WebCore/platform/network/NetworkStorageSession.h
r157337 r161890 33 33 typedef const struct __CFURLStorageSession* CFURLStorageSessionRef; 34 34 typedef struct OpaqueCFHTTPCookieStorage* CFHTTPCookieStorageRef; 35 #elif USE(SOUP)36 #include <wtf/gobject/GRefPtr.h>37 typedef struct _SoupCookieJar SoupCookieJar;38 typedef struct _SoupSession SoupSession;39 35 #endif 40 36 … … 42 38 43 39 class NetworkingContext; 40 class SoupNetworkSession; 44 41 45 42 class NetworkStorageSession { … … 61 58 RetainPtr<CFHTTPCookieStorageRef> cookieStorage() const; 62 59 #elif USE(SOUP) 63 NetworkStorageSession(SoupSession*); 64 void setSoupSession(SoupSession* session) { m_session = session; } 65 SoupSession* soupSession() const { return m_session.get(); } 60 NetworkStorageSession(std::unique_ptr<SoupNetworkSession>); 61 ~NetworkStorageSession(); 62 SoupNetworkSession& soupNetworkSession() const; 63 void setSoupNetworkSession(std::unique_ptr<SoupNetworkSession>); 66 64 #else 67 65 NetworkStorageSession(NetworkingContext*); … … 75 73 RetainPtr<CFURLStorageSessionRef> m_platformSession; 76 74 #elif USE(SOUP) 77 GRefPtr<SoupSession> m_session;75 std::unique_ptr<SoupNetworkSession> m_session; 78 76 #else 79 77 RefPtr<NetworkingContext> m_context; -
trunk/Source/WebCore/platform/network/ResourceHandle.h
r161796 r161890 181 181 void ensureReadBuffer(); 182 182 size_t currentStreamPosition() const; 183 static SoupSession* defaultSession(); 184 static SoupSession* createTestingSession(); 185 static SoupSession* createPrivateBrowsingSession(); 183 void didStartRequest(); 186 184 static uint64_t getSoupRequestInitiatingPageID(SoupRequest*); 187 185 static void setHostAllowsAnyHTTPSCertificate(const String&); -
trunk/Source/WebCore/platform/network/soup/CookieJarSoup.cpp
r156550 r161890 27 27 #include "NetworkingContext.h" 28 28 #include "PlatformCookieJar.h" 29 #include " ResourceHandle.h"29 #include "SoupNetworkSession.h" 30 30 #include <wtf/gobject/GRefPtr.h> 31 31 #include <wtf/text/CString.h> … … 35 35 static SoupCookieJar* cookieJarForSession(const NetworkStorageSession& session) 36 36 { 37 ASSERT(session.soupSession()); 38 return SOUP_COOKIE_JAR(soup_session_get_feature(session.soupSession(), SOUP_TYPE_COOKIE_JAR)); 37 return session.soupNetworkSession().cookieJar(); 39 38 } 40 39 -
trunk/Source/WebCore/platform/network/soup/DNSSoup.cpp
r138413 r161890 30 30 31 31 #include "GOwnPtrSoup.h" 32 #include " ResourceHandle.h"32 #include "SoupNetworkSession.h" 33 33 #include <libsoup/soup.h> 34 34 #include <wtf/MainThread.h> … … 54 54 ASSERT(isMainThread()); 55 55 56 soup_session_prefetch_dns( ResourceHandle::defaultSession(), hostname.utf8().data(), 0, resolvedCallback, 0);56 soup_session_prefetch_dns(SoupNetworkSession::defaultSession().soupSession(), hostname.utf8().data(), nullptr, resolvedCallback, nullptr); 57 57 } 58 58 -
trunk/Source/WebCore/platform/network/soup/NetworkStorageSessionSoup.cpp
r157347 r161890 29 29 30 30 #include "ResourceHandle.h" 31 #include "SoupNetworkSession.h" 31 32 #include <wtf/MainThread.h> 32 33 #include <wtf/NeverDestroyed.h> … … 34 35 namespace WebCore { 35 36 36 NetworkStorageSession::NetworkStorageSession( SoupSession*session)37 : m_session( adoptGRef(session))37 NetworkStorageSession::NetworkStorageSession(std::unique_ptr<SoupNetworkSession> session) 38 : m_session(std::move(session)) 38 39 , m_isPrivate(false) 40 { 41 } 42 43 NetworkStorageSession::~NetworkStorageSession() 39 44 { 40 45 } … … 50 55 { 51 56 if (!defaultSession()) 52 defaultSession() = std::make_unique<NetworkStorageSession>( ResourceHandle::defaultSession());57 defaultSession() = std::make_unique<NetworkStorageSession>(nullptr); 53 58 return *defaultSession(); 54 59 } … … 56 61 std::unique_ptr<NetworkStorageSession> NetworkStorageSession::createPrivateBrowsingSession(const String&) 57 62 { 58 auto session = std::make_unique<NetworkStorageSession>( ResourceHandle::createPrivateBrowsingSession());63 auto session = std::make_unique<NetworkStorageSession>(SoupNetworkSession::createPrivateBrowsingSession()); 59 64 session->m_isPrivate = true; 60 65 return session; … … 63 68 void NetworkStorageSession::switchToNewTestingSession() 64 69 { 65 defaultSession() = std::make_unique<NetworkStorageSession>(ResourceHandle::createTestingSession()); 70 defaultSession() = std::make_unique<NetworkStorageSession>(SoupNetworkSession::createTestingSession()); 71 } 72 73 SoupNetworkSession& NetworkStorageSession::soupNetworkSession() const 74 { 75 return m_session ? *m_session : SoupNetworkSession::defaultSession(); 76 } 77 78 void NetworkStorageSession::setSoupNetworkSession(std::unique_ptr<SoupNetworkSession> session) 79 { 80 m_session = std::move(session); 66 81 } 67 82 -
trunk/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp
r161549 r161890 36 36 #include "HTTPParsers.h" 37 37 #include "LocalizedStrings.h" 38 #include "Logging.h"39 38 #include "MIMETypeRegistry.h" 40 39 #include "NetworkingContext.h" … … 45 44 #include "ResourceResponse.h" 46 45 #include "SharedBuffer.h" 46 #include "SoupNetworkSession.h" 47 47 #include "SoupURIUtils.h" 48 48 #include "TextEncoding.h" … … 73 73 namespace WebCore { 74 74 75 inline static void soupLogPrinter(SoupLogger*, SoupLoggerLogLevel, char direction, const char* data, gpointer)76 {77 #if LOG_DISABLED78 UNUSED_PARAM(direction);79 UNUSED_PARAM(data);80 #endif81 LOG(Network, "%c %s", direction, data);82 }83 84 75 static bool loadingSynchronousRequest = false; 85 76 static const size_t gDefaultReadBufferSize = 8192; … … 261 252 { 262 253 if (!context || !context->isValid()) 263 return ResourceHandle::defaultSession();264 return context->storageSession().soup Session();254 return SoupNetworkSession::defaultSession().soupSession(); 255 return context->storageSession().soupNetworkSession().soupSession(); 265 256 } 266 257 … … 270 261 } 271 262 272 static void ensureSessionIsInitialized(SoupSession* session)273 {274 if (g_object_get_data(G_OBJECT(session), "webkit-init"))275 return;276 277 if (session == ResourceHandle::defaultSession()) {278 SoupCookieJar* jar = SOUP_COOKIE_JAR(soup_session_get_feature(session, SOUP_TYPE_COOKIE_JAR));279 if (!jar)280 soup_session_add_feature(session, SOUP_SESSION_FEATURE(soupCookieJar()));281 else282 setSoupCookieJar(jar);283 }284 285 #if !LOG_DISABLED286 if (!soup_session_get_feature(session, SOUP_TYPE_LOGGER) && LogNetwork.state == WTFLogChannelOn) {287 SoupLogger* logger = soup_logger_new(static_cast<SoupLoggerLogLevel>(SOUP_LOGGER_LOG_BODY), -1);288 soup_session_add_feature(session, SOUP_SESSION_FEATURE(logger));289 soup_logger_set_printer(logger, soupLogPrinter, 0, 0);290 g_object_unref(logger);291 }292 #endif // !LOG_DISABLED293 294 g_object_set_data(G_OBJECT(session), "webkit-init", reinterpret_cast<void*>(0xdeadbeef));295 }296 297 263 SoupSession* ResourceHandleInternal::soupSession() 298 264 { 299 SoupSession* session = sessionFromContext(m_context.get()); 300 ensureSessionIsInitialized(session); 301 return session; 265 return sessionFromContext(m_context.get()); 302 266 } 303 267 … … 880 844 } 881 845 882 static void requestStartedCallback(SoupSession*, SoupMessage* soupMessage, SoupSocket*, gpointer) 883 { 884 RefPtr<ResourceHandle> handle = static_cast<ResourceHandle*>(g_object_get_data(G_OBJECT(soupMessage), "handle")); 885 if (!handle) 886 return; 887 888 ResourceHandleInternal* d = handle->getInternal(); 846 void ResourceHandle::didStartRequest() 847 { 848 ResourceHandleInternal* d = getInternal(); 889 849 if (!d->m_response.resourceLoadTiming()) 890 850 return; … … 1432 1392 } 1433 1393 1434 static void authenticateCallback(SoupSession* session, SoupMessage* soupMessage, SoupAuth* soupAuth, gboolean retrying)1435 {1436 RefPtr<ResourceHandle> handle = static_cast<ResourceHandle*>(g_object_get_data(G_OBJECT(soupMessage), "handle"));1437 if (!handle)1438 return;1439 handle->didReceiveAuthenticationChallenge(AuthenticationChallenge(session, soupMessage, soupAuth, retrying, handle.get()));1440 }1441 1442 static SoupSession* createSoupSession()1443 {1444 // Values taken from http://www.browserscope.org/ following1445 // the rule "Do What Every Other Modern Browser Is Doing". They seem1446 // to significantly improve page loading time compared to soup's1447 // default values.1448 static const int maxConnections = 35;1449 static const int maxConnectionsPerHost = 6;1450 1451 SoupSession* session = soup_session_async_new();1452 g_object_set(session,1453 SOUP_SESSION_MAX_CONNS, maxConnections,1454 SOUP_SESSION_MAX_CONNS_PER_HOST, maxConnectionsPerHost,1455 SOUP_SESSION_ADD_FEATURE_BY_TYPE, SOUP_TYPE_CONTENT_DECODER,1456 SOUP_SESSION_ADD_FEATURE_BY_TYPE, SOUP_TYPE_CONTENT_SNIFFER,1457 SOUP_SESSION_ADD_FEATURE_BY_TYPE, SOUP_TYPE_PROXY_RESOLVER_DEFAULT,1458 SOUP_SESSION_USE_THREAD_CONTEXT, TRUE,1459 NULL);1460 g_signal_connect(session, "authenticate", G_CALLBACK(authenticateCallback), 0);1461 1462 #if ENABLE(WEB_TIMING)1463 g_signal_connect(session, "request-started", G_CALLBACK(requestStartedCallback), 0);1464 #endif1465 1466 return session;1467 }1468 1469 SoupSession* ResourceHandle::defaultSession()1470 {1471 static SoupSession* session = createSoupSession();1472 return session;1473 }1474 1475 SoupSession* ResourceHandle::createTestingSession()1476 {1477 SoupSession* session = createSoupSession();1478 // The testing session operates with the default cookie jar.1479 soup_session_add_feature(session, SOUP_SESSION_FEATURE(soupCookieJar()));1480 return session;1481 }1482 1483 SoupSession* ResourceHandle::createPrivateBrowsingSession()1484 {1485 SoupSession* session = createSoupSession();1486 soup_session_add_feature(session, SOUP_SESSION_FEATURE(createPrivateBrowsingCookieJar()));1487 return session;1488 }1489 1490 1394 uint64_t ResourceHandle::getSoupRequestInitiatingPageID(SoupRequest* request) 1491 1395 { -
trunk/Source/WebKit/efl/ChangeLog
r161860 r161890 1 2014-01-13 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 [SOUP] Add SoupNetworkSession class to wrap a SoupSession 4 https://bugs.webkit.org/show_bug.cgi?id=126813 5 6 Reviewed by Gustavo Noronha Silva. 7 8 Use the new SoupNetworkSession API. 9 10 * ewk/ewk_cookies.cpp: 11 (ewk_cookies_file_set): 12 * ewk/ewk_main.cpp: 13 (_ewk_init_body): 14 * ewk/ewk_network.cpp: 15 (ewk_network_proxy_uri_set): 16 (ewk_network_proxy_uri_get): 17 (ewk_network_tls_certificate_check_get): 18 (ewk_network_tls_certificate_check_set): 19 (ewk_network_tls_ca_certificates_path_get): 20 (ewk_network_tls_ca_certificates_path_set): 21 (ewk_network_default_soup_session_get): 22 * ewk/ewk_view.cpp: 23 (ewk_view_soup_session_get): 24 (ewk_view_soup_session_set): 25 1 26 2014-01-12 Jinwoo Song <jinwoo7.song@samsung.com> 2 27 -
trunk/Source/WebKit/efl/ewk/ewk_cookies.cpp
r123604 r161890 23 23 24 24 #include "CookieJarSoup.h" 25 #include " ResourceHandle.h"25 #include "SoupNetworkSession.h" 26 26 #include <Eina.h> 27 27 #include <eina_safety_checks.h> … … 43 43 soup_cookie_jar_set_accept_policy(cookieJar, SOUP_COOKIE_JAR_ACCEPT_NO_THIRD_PARTY); 44 44 45 SoupSession* session = WebCore::ResourceHandle::defaultSession(); 46 SoupSessionFeature* oldjar = soup_session_get_feature(session, SOUP_TYPE_COOKIE_JAR); 47 if (oldjar) 48 soup_session_remove_feature(session, oldjar); 49 45 WebCore::SoupNetworkSession::defaultSession().setCookieJar(cookieJar); 50 46 WebCore::setSoupCookieJar(cookieJar); 51 soup_session_add_feature(session, SOUP_SESSION_FEATURE(cookieJar));47 g_object_unref(cookieJar); 52 48 53 49 return true; -
trunk/Source/WebKit/efl/ewk/ewk_main.cpp
r159486 r161890 30 30 #include "ScriptController.h" 31 31 #include "Settings.h" 32 #include "SoupNetworkSession.h" 32 33 #include "StorageTracker.h" 33 34 #include "StorageTrackerClientEfl.h" … … 205 206 WebCore::StorageTracker::initializeTracker(localStorageDirectory.utf8().data(), trackerClient()); 206 207 207 SoupSession* session = WebCore::ResourceHandle::defaultSession();208 208 SoupSessionFeature* auth_dialog = static_cast<SoupSessionFeature*>(g_object_new(EWK_TYPE_SOUP_AUTH_DIALOG, 0)); 209 soup_session_add_feature( session, auth_dialog);209 soup_session_add_feature(WebCore::SoupNetworkSession::defaultSession().soupSession(), auth_dialog); 210 210 211 211 WebCore::ResourceHandle::setIgnoreSSLErrors(true); -
trunk/Source/WebKit/efl/ewk/ewk_network.cpp
r148511 r161890 24 24 #include "ProxyResolverSoup.h" 25 25 #include "ResourceHandle.h" 26 #include "SoupNetworkSession.h" 26 27 #include "ewk_private.h" 27 28 #include <Eina.h> … … 31 32 void ewk_network_proxy_uri_set(const char* proxy) 32 33 { 33 SoupSession* session = WebCore::ResourceHandle::defaultSession(); 34 35 if (!proxy) { 34 if (!proxy) 36 35 ERR("no proxy uri. remove proxy feature in soup."); 37 soup_session_remove_feature_by_type(session, SOUP_TYPE_PROXY_URI_RESOLVER); 38 return; 39 } 40 41 SoupProxyURIResolver* resolverEfl = soupProxyResolverWkNew(proxy, 0); 42 soup_session_add_feature(session, SOUP_SESSION_FEATURE(resolverEfl)); 43 g_object_unref(resolverEfl); 36 WebCore::SoupNetworkSession::defaultSession().setHTTPProxy(proxy, 0); 44 37 } 45 38 46 39 const char* ewk_network_proxy_uri_get(void) 47 40 { 48 SoupURI* uri; 49 SoupSession* session = WebCore::ResourceHandle::defaultSession(); 50 SoupProxyURIResolver* resolver = SOUP_PROXY_URI_RESOLVER(soup_session_get_feature(session, SOUP_TYPE_PROXY_URI_RESOLVER)); 51 if (!resolver) 52 return 0; 53 54 g_object_get(resolver, SOUP_PROXY_RESOLVER_WK_PROXY_URI, &uri, NULL); 55 41 char* uri = WebCore::SoupNetworkSession::defaultSession().httpProxy(); 56 42 if (!uri) { 57 43 ERR("no proxy uri"); … … 59 45 } 60 46 61 WTF::String proxy = soup_uri_to_string(uri, false); 62 return eina_stringshare_add(proxy.utf8().data()); 47 return eina_stringshare_add(uri); 63 48 } 64 49 65 50 Eina_Bool ewk_network_tls_certificate_check_get() 66 51 { 67 bool checkCertificates = false; 68 69 SoupSession* defaultSession = WebCore::ResourceHandle::defaultSession(); 70 g_object_get(defaultSession, "ssl-strict", &checkCertificates, NULL); 71 72 return checkCertificates; 52 unsigned policy = WebCore::SoupNetworkSession::defaultSession().sslPolicy(); 53 return policy & WebCore::SoupNetworkSession::SSLStrict; 73 54 } 74 55 75 56 void ewk_network_tls_certificate_check_set(Eina_Bool checkCertificates) 76 57 { 77 SoupSession* defaultSession = WebCore::ResourceHandle::defaultSession();78 g_object_set(defaultSession, "ssl-strict", checkCertificates, NULL);58 unsigned policy = WebCore::SoupNetworkSession::defaultSession().sslPolicy(); 59 WebCore::SoupNetworkSession::defaultSession().setSSLPolicy(policy | WebCore::SoupNetworkSession::SSLStrict); 79 60 } 80 61 … … 83 64 const char* bundlePath = 0; 84 65 85 SoupSession* defaultSession = WebCore:: ResourceHandle::defaultSession();66 SoupSession* defaultSession = WebCore::SoupNetworkSession::defaultSession().soupSession(); 86 67 g_object_get(defaultSession, "ssl-ca-file", &bundlePath, NULL); 87 68 … … 91 72 void ewk_network_tls_ca_certificates_path_set(const char* bundlePath) 92 73 { 93 SoupSession* defaultSession = WebCore:: ResourceHandle::defaultSession();74 SoupSession* defaultSession = WebCore::SoupNetworkSession::defaultSession().soupSession(); 94 75 g_object_set(defaultSession, "ssl-ca-file", bundlePath, NULL); 95 76 } … … 97 78 SoupSession* ewk_network_default_soup_session_get() 98 79 { 99 return WebCore:: ResourceHandle::defaultSession();80 return WebCore::SoupNetworkSession::defaultSession().soupSession(); 100 81 } -
trunk/Source/WebKit/efl/ewk/ewk_view.cpp
r161744 r161890 66 66 #include "ScriptController.h" 67 67 #include "Settings.h" 68 #include "SoupNetworkSession.h" 68 69 #include "TiledBackingStore.h" 69 70 #include "c_instance.h" … … 4547 4548 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0); 4548 4549 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0); 4549 return priv->storageSession->soup Session();4550 return priv->storageSession->soupNetworkSession().soupSession(); 4550 4551 } 4551 4552 … … 4559 4560 return; 4560 4561 } 4561 priv->storageSession->setSoup Session(session);4562 priv->storageSession->setSoupNetworkSession(WebCore::SoupNetworkSession::createForSoupSession(session)); 4562 4563 } 4563 4564 -
trunk/Source/WebKit/gtk/ChangeLog
r161870 r161890 1 2014-01-13 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 [SOUP] Add SoupNetworkSession class to wrap a SoupSession 4 https://bugs.webkit.org/show_bug.cgi?id=126813 5 6 Reviewed by Gustavo Noronha Silva. 7 8 * webkit/webkitglobals.cpp: 9 (webkit_get_default_session): Use the new SoupNetworkSession API 10 to get the default SoupSession 11 1 12 2014-01-13 Carlos Garcia Campos <cgarcia@igalia.com> 2 13 -
trunk/Source/WebKit/gtk/webkit/webkitglobals.cpp
r155714 r161890 40 40 #include "ResourceResponse.h" 41 41 #include "SchemeRegistry.h" 42 #include "SoupNetworkSession.h" 42 43 #include "TextEncodingRegistry.h" 43 44 #include "webkitapplicationcache.h" … … 84 85 { 85 86 webkitInit(); 86 return ResourceHandle::defaultSession();87 return SoupNetworkSession::defaultSession().soupSession(); 87 88 } 88 89 -
trunk/Source/WebKit2/ChangeLog
r161882 r161890 1 2014-01-13 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 [SOUP] Add SoupNetworkSession class to wrap a SoupSession 4 https://bugs.webkit.org/show_bug.cgi?id=126813 5 6 Reviewed by Gustavo Noronha Silva. 7 8 Use the new SoupNetworkSession API. 9 10 * NetworkProcess/soup/NetworkProcessSoup.cpp: 11 (WebKit::NetworkProcess::platformInitializeNetworkProcess): 12 (WebKit::NetworkProcess::platformSetCacheModel): 13 (WebKit::NetworkProcess::clearCacheForAllOrigins): 14 * NetworkProcess/unix/NetworkProcessMainUnix.cpp: 15 (WebKit::NetworkProcessMain): 16 * WebProcess/Cookies/soup/WebCookieManagerSoup.cpp: 17 (WebKit::WebCookieManager::setCookiePersistentStorage): 18 * WebProcess/efl/WebProcessMainEfl.cpp: 19 (WebKit::WebProcessMainEfl): 20 * WebProcess/gtk/WebProcessMainGtk.cpp: 21 (WebKit::WebProcessMainGtk): 22 * WebProcess/soup/WebProcessSoup.cpp: 23 (WebKit::WebProcess::platformSetCacheModel): 24 (WebKit::WebProcess::platformClearResourceCaches): 25 (WebKit::setSoupSessionAcceptLanguage): 26 (WebKit::WebProcess::platformInitializeWebProcess): 27 * WebProcess/soup/WebSoupRequestManager.cpp: 28 (WebKit::WebSoupRequestManager::registerURIScheme): 29 1 30 2014-01-13 Zalan Bujtas <zalan@apple.com> 2 31 -
trunk/Source/WebKit2/NetworkProcess/soup/NetworkProcessSoup.cpp
r161112 r161890 36 36 #include <WebCore/NotImplemented.h> 37 37 #include <WebCore/ResourceHandle.h> 38 #include <WebCore/SoupNetworkSession.h> 38 39 #include <libsoup/soup.h> 39 40 #include <wtf/gobject/GOwnPtr.h> … … 79 80 ASSERT(!parameters.diskCacheDirectory.isEmpty()); 80 81 GRefPtr<SoupCache> soupCache = adoptGRef(soup_cache_new(parameters.diskCacheDirectory.utf8().data(), SOUP_CACHE_SINGLE_USER)); 81 soup_session_add_feature(WebCore::ResourceHandle::defaultSession(), SOUP_SESSION_FEATURE(soupCache.get()));82 SoupNetworkSession::defaultSession().setCache(soupCache.get()); 82 83 soup_cache_load(soupCache.get()); 83 84 … … 102 103 unsigned long urlCacheDiskCapacity = 0; 103 104 104 SoupSession* session = ResourceHandle::defaultSession(); 105 SoupCache* cache = SOUP_CACHE(soup_session_get_feature(session, SOUP_TYPE_CACHE)); 105 SoupCache* cache = SoupNetworkSession::defaultSession().cache(); 106 106 uint64_t diskFreeSize = getCacheDiskFreeSize(cache) / 1024 / 1024; 107 107 … … 130 130 return; 131 131 132 SoupSession* session = ResourceHandle::defaultSession(); 133 soup_cache_clear(SOUP_CACHE(soup_session_get_feature(session, SOUP_TYPE_CACHE))); 132 soup_cache_clear(SoupNetworkSession::defaultSession().cache()); 134 133 } 135 134 -
trunk/Source/WebKit2/NetworkProcess/unix/NetworkProcessMainUnix.cpp
r161816 r161890 32 32 #include "WKBase.h" 33 33 #include "WebKit2Initialize.h" 34 #include <WebCore/ ResourceHandle.h>34 #include <WebCore/SoupNetworkSession.h> 35 35 #include <WebKit2/NetworkProcess.h> 36 36 #include <error.h> … … 42 42 43 43 #if PLATFORM(EFL) 44 #include "ProxyResolverSoup.h"45 44 #include <Ecore.h> 46 45 #endif … … 69 68 InitializeWebKit2(); 70 69 71 #if USE(SOUP) 72 SoupSession* session = ResourceHandle::defaultSession(); 73 #if PLATFORM(EFL) 74 // Only for EFL because GTK port uses the default resolver, which uses GIO's proxy resolver. 75 const char* httpProxy = getenv("http_proxy"); 76 if (httpProxy) { 77 const char* noProxy = getenv("no_proxy"); 78 GRefPtr<SoupProxyURIResolver> resolver = adoptGRef(soupProxyResolverWkNew(httpProxy, noProxy)); 79 soup_session_add_feature(session, SOUP_SESSION_FEATURE(resolver.get())); 80 } 81 #endif 82 #endif 70 SoupNetworkSession::defaultSession().setupHTTPProxyFromEnvironment(); 83 71 84 72 int socket = atoi(argv[1]); … … 93 81 // accepting invalid certificates by default. New API will be 94 82 // added later to let client accept/discard invalid certificates. 95 g_object_set(session, SOUP_SESSION_SSL_USE_SYSTEM_CA_FILE, TRUE, 96 SOUP_SESSION_SSL_STRICT, FALSE, NULL); 83 SoupNetworkSession::defaultSession().setSSLPolicy(SoupNetworkSession::SSLUseSystemCAFile); 97 84 #endif 98 85 … … 100 87 101 88 #if USE(SOUP) 102 if (Soup SessionFeature* soupCache = soup_session_get_feature(session, SOUP_TYPE_CACHE)) {103 soup_cache_flush( SOUP_CACHE(soupCache));104 soup_cache_dump( SOUP_CACHE(soupCache));89 if (SoupCache* soupCache = SoupNetworkSession::defaultSession().cache()) { 90 soup_cache_flush(soupCache); 91 soup_cache_dump(soupCache); 105 92 } 106 93 #endif -
trunk/Source/WebKit2/WebProcess/Cookies/soup/WebCookieManagerSoup.cpp
r139261 r161890 30 30 #include "WebKitSoupCookieJarSqlite.h" 31 31 #include <WebCore/CookieJarSoup.h> 32 #include <WebCore/ ResourceHandle.h>32 #include <WebCore/SoupNetworkSession.h> 33 33 #include <libsoup/soup.h> 34 34 #include <wtf/gobject/GRefPtr.h> … … 97 97 } 98 98 99 SoupCookieJar* currentJar = WebCore::soupCookieJar(); 100 soup_cookie_jar_set_accept_policy(jar.get(), soup_cookie_jar_get_accept_policy(currentJar)); 101 SoupSession* session = ResourceHandle::defaultSession(); 102 soup_session_remove_feature(session, SOUP_SESSION_FEATURE(currentJar)); 103 soup_session_add_feature(session, SOUP_SESSION_FEATURE(jar.get())); 104 99 soup_cookie_jar_set_accept_policy(jar.get(), soup_cookie_jar_get_accept_policy(WebCore::soupCookieJar())); 100 SoupNetworkSession::defaultSession().setCookieJar(jar.get()); 105 101 WebCore::setSoupCookieJar(jar.get()); 106 102 } -
trunk/Source/WebKit2/WebProcess/efl/WebProcessMainEfl.cpp
r159001 r161890 36 36 #include <WebCore/AuthenticationChallenge.h> 37 37 #include <WebCore/NetworkingContext.h> 38 #include <WebCore/ ResourceHandle.h>38 #include <WebCore/SoupNetworkSession.h> 39 39 #include <WebKit2/WebProcess.h> 40 40 #include <libsoup/soup.h> … … 115 115 InitializeWebKit2(); 116 116 117 SoupSession* session = WebCore::ResourceHandle::defaultSession(); 118 const char* httpProxy = getenv("http_proxy"); 119 if (httpProxy) { 120 const char* noProxy = getenv("no_proxy"); 121 SoupProxyURIResolver* resolverEfl = soupProxyResolverWkNew(httpProxy, noProxy); 122 soup_session_add_feature(session, SOUP_SESSION_FEATURE(resolverEfl)); 123 g_object_unref(resolverEfl); 124 } 117 SoupNetworkSession::defaultSession().setupHTTPProxyFromEnvironment(); 125 118 126 119 int socket = atoi(argv[1]); … … 133 126 RunLoop::run(); 134 127 135 if (Soup SessionFeature* soupCache = soup_session_get_feature(session, SOUP_TYPE_CACHE)) {136 soup_cache_flush( SOUP_CACHE(soupCache));137 soup_cache_dump( SOUP_CACHE(soupCache));128 if (SoupCache* soupCache = SoupNetworkSession::defaultSession().cache()) { 129 soup_cache_flush(soupCache); 130 soup_cache_dump(soupCache); 138 131 } 139 132 -
trunk/Source/WebKit2/WebProcess/gtk/WebProcessMainGtk.cpp
r159001 r161890 32 32 #include <WebCore/AuthenticationChallenge.h> 33 33 #include <WebCore/NetworkingContext.h> 34 #include <WebCore/ ResourceHandle.h>34 #include <WebCore/SoupNetworkSession.h> 35 35 #include <WebKit2/WebProcess.h> 36 36 #include <gtk/gtk.h> … … 72 72 // accepting invalid certificates by default. New API will be 73 73 // added later to let client accept/discard invalid certificates. 74 SoupSession* session = WebCore::ResourceHandle::defaultSession(); 75 g_object_set(session, SOUP_SESSION_SSL_USE_SYSTEM_CA_FILE, TRUE, 76 SOUP_SESSION_SSL_STRICT, FALSE, NULL); 74 SoupNetworkSession::defaultSession().setSSLPolicy(SoupNetworkSession::SSLUseSystemCAFile); 77 75 78 76 RunLoop::run(); 79 77 80 if (Soup SessionFeature* soupCache = soup_session_get_feature(session, SOUP_TYPE_CACHE)) {81 soup_cache_flush( SOUP_CACHE(soupCache));82 soup_cache_dump( SOUP_CACHE(soupCache));78 if (SoupCache* soupCache = SoupNetworkSession::defaultSession().cache()) { 79 soup_cache_flush(soupCache); 80 soup_cache_dump(soupCache); 83 81 } 84 82 -
trunk/Source/WebKit2/WebProcess/soup/WebProcessSoup.cpp
r161272 r161890 41 41 #include <WebCore/PageCache.h> 42 42 #include <WebCore/ResourceHandle.h> 43 #include <WebCore/SoupNetworkSession.h> 43 44 #include <libsoup/soup.h> 44 45 #include <wtf/gobject/GOwnPtr.h> 45 46 #include <wtf/gobject/GRefPtr.h> 46 #include <wtf/text/CString.h>47 #include <wtf/text/StringBuilder.h>48 47 49 48 namespace WebKit { … … 95 94 96 95 if (!usesNetworkProcess()) { 97 cache = SOUP_CACHE(soup_session_get_feature(WebCore::ResourceHandle::defaultSession(), SOUP_TYPE_CACHE));96 cache = WebCore::SoupNetworkSession::defaultSession().cache(); 98 97 diskFreeSize = getCacheDiskFreeSize(cache) / 1024 / 1024; 99 98 } … … 123 122 return; 124 123 125 soup_cache_clear(SOUP_CACHE(soup_session_get_feature(WebCore::ResourceHandle::defaultSession(), SOUP_TYPE_CACHE))); 126 } 127 128 // This function is based on Epiphany code in ephy-embed-prefs.c. 129 static CString buildAcceptLanguages(Vector<String> languages) 130 { 131 // Ignore "C" locale. 132 size_t position = languages.find("c"); 133 if (position != notFound) 134 languages.remove(position); 135 136 // Fallback to "en" if the list is empty. 137 if (languages.isEmpty()) 138 return "en"; 139 140 // Calculate deltas for the quality values. 141 int delta; 142 if (languages.size() < 10) 143 delta = 10; 144 else if (languages.size() < 20) 145 delta = 5; 146 else 147 delta = 1; 148 149 // Set quality values for each language. 150 StringBuilder builder; 151 for (size_t i = 0; i < languages.size(); ++i) { 152 if (i) 153 builder.append(", "); 154 155 builder.append(languages[i]); 156 157 int quality = 100 - i * delta; 158 if (quality > 0 && quality < 100) { 159 char buffer[8]; 160 g_ascii_formatd(buffer, 8, "%.2f", quality / 100.0); 161 builder.append(String::format(";q=%s", buffer)); 162 } 163 } 164 165 return builder.toString().utf8(); 124 soup_cache_clear(WebCore::SoupNetworkSession::defaultSession().cache()); 166 125 } 167 126 168 127 static void setSoupSessionAcceptLanguage(Vector<String> languages) 169 128 { 170 g_object_set(WebCore::ResourceHandle::defaultSession(), "accept-language", buildAcceptLanguages(languages).data(), NULL);129 WebCore::SoupNetworkSession::defaultSession().setAcceptLanguages(languages); 171 130 } 172 131 … … 192 151 ASSERT(!parameters.diskCacheDirectory.isEmpty()); 193 152 GRefPtr<SoupCache> soupCache = adoptGRef(soup_cache_new(parameters.diskCacheDirectory.utf8().data(), SOUP_CACHE_SINGLE_USER)); 194 soup_session_add_feature(WebCore::ResourceHandle::defaultSession(), SOUP_SESSION_FEATURE(soupCache.get()));153 WebCore::SoupNetworkSession::defaultSession().setCache(soupCache.get()); 195 154 soup_cache_load(soupCache.get()); 196 155 -
trunk/Source/WebKit2/WebProcess/soup/WebSoupRequestManager.cpp
r161156 r161890 31 31 #include <WebCore/ResourceHandle.h> 32 32 #include <WebCore/ResourceRequest.h> 33 #include <WebCore/SoupNetworkSession.h> 33 34 #include <wtf/gobject/GOwnPtr.h> 34 35 #include <wtf/text/CString.h> … … 99 100 g_ptr_array_add(m_schemes.get(), 0); 100 101 101 SoupSession* session = WebCore:: ResourceHandle::defaultSession();102 SoupSession* session = WebCore::SoupNetworkSession::defaultSession().soupSession(); 102 103 SoupRequestClass* genericRequestClass = static_cast<SoupRequestClass*>(g_type_class_ref(WEBKIT_TYPE_SOUP_REQUEST_GENERIC)); 103 104 genericRequestClass->schemes = const_cast<const char**>(reinterpret_cast<char**>(m_schemes->pdata));
Note: See TracChangeset
for help on using the changeset viewer.