From dfe0d39dc7d2e66c67447846a93c417a4df45aeb Mon Sep 17 00:00:00 2001 From: Fujii Hironori Date: Tue, 26 Apr 2016 18:27:08 +0000 Subject: [PATCH] [curl] Requests interrupted when using https via proxy https://bugs.webkit.org/show_bug.cgi?id=157028 Patch by Fujii Hironori on 2016-04-26 Reviewed by Alex Christensen. A proxy responds "200 Connection Established" to a CONNECT method. This response doesn't have Content-Type, then the request is canceled due to a unsupported MIME type. This is not a real response from the recipient server. It should not be processed normally. Just ignore the response. * platform/network/curl/ResourceHandleManager.cpp: (WebCore::headerCallback): Do nothing if httpCode is 0. This is the case of "200 Connection Established". Canonical link: https://commits.webkit.org/175155@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@200100 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- Source/WebCore/ChangeLog | 17 +++++++++++++++++ .../network/curl/ResourceHandleManager.cpp | 4 ++++ 2 files changed, 21 insertions(+) diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog index 14f7e96ec8aa..fd0a2342996c 100644 --- a/Source/WebCore/ChangeLog +++ b/Source/WebCore/ChangeLog @@ -1,3 +1,20 @@ +2016-04-26 Fujii Hironori + + [curl] Requests interrupted when using https via proxy + https://bugs.webkit.org/show_bug.cgi?id=157028 + + Reviewed by Alex Christensen. + + A proxy responds "200 Connection Established" to a CONNECT + method. This response doesn't have Content-Type, then the + request is canceled due to a unsupported MIME type. This is not + a real response from the recipient server. It should not be + processed normally. Just ignore the response. + + * platform/network/curl/ResourceHandleManager.cpp: + (WebCore::headerCallback): + Do nothing if httpCode is 0. This is the case of "200 Connection Established". + 2016-04-26 Chris Dumez Drop Dictionary from CanUseWTFOptionalForParameter() diff --git a/Source/WebCore/platform/network/curl/ResourceHandleManager.cpp b/Source/WebCore/platform/network/curl/ResourceHandleManager.cpp index a63a572f4ca3..3821fb991432 100644 --- a/Source/WebCore/platform/network/curl/ResourceHandleManager.cpp +++ b/Source/WebCore/platform/network/curl/ResourceHandleManager.cpp @@ -482,6 +482,10 @@ static size_t headerCallback(char* ptr, size_t size, size_t nmemb, void* data) long httpCode = 0; curl_easy_getinfo(h, CURLINFO_RESPONSE_CODE, &httpCode); + if (!httpCode) { + // Comes here when receiving 200 Connection Established. Just return. + return totalSize; + } if (isHttpInfo(httpCode)) { // Just return when receiving http info, e.g. HTTP/1.1 100 Continue. // If not, the request might be cancelled, because the MIME type will be empty for this response.