Changeset 231350 in webkit
- Timestamp:
- May 4, 2018 3:14:27 AM (6 years ago)
- Location:
- trunk
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r231346 r231350 1 2018-05-04 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 [GTK] Epiphany (GNOME Web) says "Error downloading: Service Unavailable." when trying to download an image from discogs.com 4 https://bugs.webkit.org/show_bug.cgi?id=174730 5 6 Reviewed by Michael Catanzaro. 7 8 Export ResourceRequestBase::hasHTTPHeaderField(). 9 10 * platform/network/ResourceRequestBase.h: 11 1 12 2018-05-03 Yusuke Suzuki <utatane.tea@gmail.com> 2 13 -
trunk/Source/WebCore/platform/network/ResourceRequestBase.h
r230944 r231350 104 104 WEBCORE_EXPORT void addHTTPHeaderFieldIfNotPresent(HTTPHeaderName, const String&); 105 105 106 bool hasHTTPHeaderField(HTTPHeaderName) const;106 WEBCORE_EXPORT bool hasHTTPHeaderField(HTTPHeaderName) const; 107 107 108 108 // Instead of passing a string literal to any of these functions, just use a HTTPHeaderName instead. -
trunk/Source/WebKit/ChangeLog
r231349 r231350 1 2018-05-04 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 [GTK] Epiphany (GNOME Web) says "Error downloading: Service Unavailable." when trying to download an image from discogs.com 4 https://bugs.webkit.org/show_bug.cgi?id=174730 5 6 Reviewed by Michael Catanzaro. 7 8 The problem is that we don't send any User-Agent HTTP header for downloads started by WebProcessPool::download(). 9 10 * UIProcess/API/glib/WebKitDownload.cpp: 11 (webkitDownloadUpdateRequest): Helper to update the cached request. 12 (webkitDownloadStarted): Updated the cached request if we have one. 13 (webkit_download_get_request): Use webkitDownloadUpdateRequest(). 14 * UIProcess/API/glib/WebKitDownloadClient.cpp: 15 * UIProcess/API/glib/WebKitDownloadPrivate.h: 16 * UIProcess/WebProcessPool.cpp: 17 (WebKit::WebProcessPool::download): Set the User-Agent HTTP header if there isn't any. 18 1 19 2018-05-04 Carlos Garcia Campos <cgarcia@igalia.com> 2 20 -
trunk/Source/WebKit/UIProcess/API/glib/WebKitDownload.cpp
r218487 r231350 324 324 } 325 325 326 static void webkitDownloadUpdateRequest(WebKitDownload* download) 327 { 328 download->priv->request = adoptGRef(webkitURIRequestCreateForResourceRequest(download->priv->download->request())); 329 } 330 331 void webkitDownloadStarted(WebKitDownload* download) 332 { 333 // Update with the final request if needed. 334 if (download->priv->request) 335 webkitDownloadUpdateRequest(download); 336 } 337 326 338 void webkitDownloadSetResponse(WebKitDownload* download, WebKitURIResponse* response) 327 339 { … … 437 449 WebKitURIRequest* webkit_download_get_request(WebKitDownload* download) 438 450 { 439 g_return_val_if_fail(WEBKIT_IS_DOWNLOAD(download), 0);451 g_return_val_if_fail(WEBKIT_IS_DOWNLOAD(download), nullptr); 440 452 441 453 WebKitDownloadPrivate* priv = download->priv; 442 454 if (!priv->request) 443 priv->request = adoptGRef(webkitURIRequestCreateForResourceRequest(priv->download->request()));455 webkitDownloadUpdateRequest(download); 444 456 return priv->request.get(); 445 457 } -
trunk/Source/WebKit/UIProcess/API/glib/WebKitDownloadClient.cpp
r223730 r231350 44 44 { 45 45 GRefPtr<WebKitDownload> download = webkitWebContextGetOrCreateDownload(&downloadProxy); 46 webkitDownloadStarted(download.get()); 46 47 webkitWebContextDownloadStarted(m_webContext, download.get()); 47 48 } -
trunk/Source/WebKit/UIProcess/API/glib/WebKitDownloadPrivate.h
r218487 r231350 25 25 26 26 WebKitDownload* webkitDownloadCreate(WebKit::DownloadProxy*); 27 void webkitDownloadStarted(WebKitDownload*); 27 28 bool webkitDownloadIsCancelled(WebKitDownload*); 28 29 void webkitDownloadSetResponse(WebKitDownload*, WebKitURIResponse*); -
trunk/Source/WebKit/UIProcess/WebProcessPool.cpp
r231306 r231350 1216 1216 updatedRequest.setFirstPartyForCookies(initiatingPageURL); 1217 1217 updatedRequest.setIsSameSite(registrableDomainsAreEqual(initiatingPageURL, request.url())); 1218 if (!updatedRequest.hasHTTPHeaderField(HTTPHeaderName::UserAgent)) 1219 updatedRequest.setHTTPUserAgent(initiatingPage->userAgent()); 1218 1220 } else { 1219 1221 updatedRequest.setFirstPartyForCookies(URL()); 1220 1222 updatedRequest.setIsSameSite(false); 1223 if (!updatedRequest.hasHTTPHeaderField(HTTPHeaderName::UserAgent)) 1224 updatedRequest.setHTTPUserAgent(WebPageProxy::standardUserAgent()); 1221 1225 } 1222 1226 updatedRequest.setIsTopSite(false); -
trunk/Tools/ChangeLog
r231336 r231350 1 2018-05-04 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 [GTK] Epiphany (GNOME Web) says "Error downloading: Service Unavailable." when trying to download an image from discogs.com 4 https://bugs.webkit.org/show_bug.cgi?id=174730 5 6 Reviewed by Michael Catanzaro. 7 8 Update unit tests to check that User-Agent header is included in HTTP download requests. 9 10 * TestWebKitAPI/Tests/WebKitGLib/TestDownloads.cpp: 11 (testDownloadRemoteFile): 12 (testWebViewDownloadURI): 13 (testPolicyResponseDownload): 14 (testPolicyResponseDownloadCancel): 15 (testDownloadMIMEType): 16 (testContextMenuDownloadActions): 17 1 18 2018-05-03 Ross Kirsling <ross.kirsling@sony.com> 2 19 -
trunk/Tools/TestWebKitAPI/Tests/WebKitGLib/TestDownloads.cpp
r224192 r231350 454 454 ASSERT_CMP_CSTRING(webkit_uri_request_get_uri(request), ==, kServer->getURIForPath("/test.pdf")); 455 455 456 auto headers = webkit_uri_request_get_http_headers(request); 457 g_assert_nonnull(soup_message_headers_get_one(headers, "User-Agent")); 458 456 459 g_assert(webkit_download_get_destination(download.get())); 457 460 g_assert_cmpfloat(webkit_download_get_estimated_progress(download.get()), ==, 1); … … 567 570 test->waitUntilDownloadStarted(); 568 571 g_assert(test->m_webView == webkit_download_get_web_view(download.get())); 572 573 WebKitURIRequest* request = webkit_download_get_request(download.get()); 574 g_assert(request); 575 ASSERT_CMP_CSTRING(webkit_uri_request_get_uri(request), ==, kServer->getURIForPath("/test.pdf")); 576 577 auto headers = webkit_uri_request_get_http_headers(request); 578 g_assert_nonnull(soup_message_headers_get_one(headers, "User-Agent")); 569 579 test->waitUntilDownloadFinished(); 570 580 … … 620 630 621 631 g_assert(test->m_webView == webkit_download_get_web_view(test->m_download.get())); 632 633 auto headers = webkit_uri_request_get_http_headers(request); 634 g_assert_nonnull(soup_message_headers_get_one(headers, "User-Agent")); 622 635 test->waitUntilDownloadFinished(); 623 636 … … 639 652 640 653 g_assert(test->m_webView == webkit_download_get_web_view(test->m_download.get())); 654 655 auto headers = webkit_uri_request_get_http_headers(request); 656 g_assert_nonnull(soup_message_headers_get_one(headers, "User-Agent")); 641 657 test->cancelDownloadAndWaitUntilFinished(); 642 658 } … … 659 675 WEBKIT_IS_URI_REQUEST(request); 660 676 ASSERT_CMP_CSTRING(webkit_uri_request_get_uri(request), ==, kServer->getURIForPath("/unknown")); 677 678 auto headers = webkit_uri_request_get_http_headers(request); 679 g_assert_nonnull(soup_message_headers_get_one(headers, "User-Agent")); 661 680 662 681 WebKitURIResponse* response = webkit_download_get_response(download.get()); … … 719 738 720 739 g_assert(test->m_webView == webkit_download_get_web_view(test->m_download.get())); 740 741 WebKitURIRequest* request = webkit_download_get_request(test->m_download.get()); 742 WEBKIT_IS_URI_REQUEST(request); 743 ASSERT_CMP_CSTRING(webkit_uri_request_get_uri(request), ==, kServer->getURIForPath("/test.pdf")); 744 745 auto headers = webkit_uri_request_get_http_headers(request); 746 g_assert_nonnull(soup_message_headers_get_one(headers, "User-Agent")); 747 721 748 test->waitUntilDownloadFinished(); 722 749
Note: See TracChangeset
for help on using the changeset viewer.