Changeset 238659 in webkit
- Timestamp:
- Nov 28, 2018 8:14:02 PM (5 years ago)
- Location:
- trunk/Source/WebKit
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r238658 r238659 1 2018-11-28 Vivek Seth <v_seth@apple.com> 2 3 Consult dummy storage for HTTPS Upgrade, Apply If Appropriate 4 https://bugs.webkit.org/show_bug.cgi?id=192094 5 <rdar://problem/45851103> HTTPS Upgrade: Consult dummy storage for HTTPS Upgrade, Apply If Appropriate 6 7 Reviewed by Chris Dumez. 8 9 For main page loads upgrade HTTP requests to HTTPS if the hostname belongs to a set of upgradable hostnames. 10 11 * NetworkProcess/NetworkLoadChecker.cpp: 12 (WebKit::NetworkLoadChecker::applyHTTPSUpgradeIfNeeded): 13 (WebKit::NetworkLoadChecker::checkRequest): 14 * NetworkProcess/NetworkLoadChecker.h: 15 * NetworkProcess/NetworkResourceLoader.cpp: 16 (WebKit::NetworkResourceLoader::start): 17 1 18 2018-11-28 Simon Fraser <simon.fraser@apple.com> 2 19 -
trunk/Source/WebKit/NetworkProcess/NetworkLoadChecker.cpp
r235101 r238659 191 191 } 192 192 193 #if ENABLE(HTTPS_UPGRADE) 194 bool NetworkLoadChecker::applyHTTPSUpgradeIfNeeded(ResourceRequest& request) 195 { 196 // Use dummy list for now. 197 static NeverDestroyed<HashSet<String>> upgradableHosts = std::initializer_list<String> { 198 "www.bbc.com"_s, // (source: https://whynohttps.com) 199 "www.speedtest.net"_s, // (source: https://whynohttps.com) 200 "www.bea.gov"_s // (source: https://pulse.cio.gov/data/domains/https.csv) 201 }; 202 203 auto& url = request.url(); 204 205 // Only upgrade http urls. 206 if (!url.protocolIs("http")) 207 return false; 208 209 if (!upgradableHosts.get().contains(url.host().toString())) 210 return false; 211 212 auto newURL = url; 213 newURL.setProtocol("https"_s); 214 request.setURL(newURL); 215 return true; 216 217 return false; 218 } 219 #endif // ENABLE(HTTPS_UPGRADE) 220 193 221 void NetworkLoadChecker::checkRequest(ResourceRequest&& request, ContentSecurityPolicyClient* client, ValidationHandler&& handler) 194 222 { 223 224 #if ENABLE(HTTPS_UPGRADE) 225 if (request.requester() == ResourceRequest::Requester::Main) { 226 if (applyHTTPSUpgradeIfNeeded(request)) 227 ASSERT(request.url().protocolIs("https")); 228 } 229 230 #endif // ENABLE(HTTPS_UPGRADE) 231 195 232 if (auto* contentSecurityPolicy = this->contentSecurityPolicy()) { 196 233 if (isRedirected()) { -
trunk/Source/WebKit/NetworkProcess/NetworkLoadChecker.h
r234626 r238659 139 139 bool m_shouldCaptureExtraNetworkLoadMetrics { false }; 140 140 WebCore::NetworkLoadInformation m_loadInformation; 141 142 #if ENABLE(HTTPS_UPGRADE) 143 static bool applyHTTPSUpgradeIfNeeded(WebCore::ResourceRequest&); 144 #endif // ENABLE(HTTPS_UPGRADE) 145 141 146 }; 142 147 -
trunk/Source/WebKit/NetworkProcess/NetworkResourceLoader.cpp
r238630 r238659 193 193 return; 194 194 } 195 if (this->canUseCache(this->originalRequest())) { 195 196 auto currentRequest = result.value(); 197 if (this->canUseCache(currentRequest)) { 196 198 RELEASE_LOG_IF_ALLOWED("start: Checking cache for resource (pageID = %" PRIu64 ", frameID = %" PRIu64 ", resourceID = %" PRIu64 ", isMainResource = %d, isSynchronous = %d)", m_parameters.webPageID, m_parameters.webFrameID, m_parameters.identifier, this->isMainResource(), this->isSynchronous()); 197 this->retrieveCacheEntry( this->originalRequest());199 this->retrieveCacheEntry(currentRequest); 198 200 return; 199 201 }
Note: See TracChangeset
for help on using the changeset viewer.