From adfe966c465e46acf77d387231ace671fe302aa3 Mon Sep 17 00:00:00 2001 From: Pavel Kovalenko Date: Wed, 11 Nov 2020 12:30:32 +0300 Subject: [PATCH] Support HTTP proxy and HTTPS S3 endpoint configuration. --- src/IO/S3/PocoHTTPClient.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/IO/S3/PocoHTTPClient.cpp b/src/IO/S3/PocoHTTPClient.cpp index 49ccb6dc1b3..00cc5f497dc 100644 --- a/src/IO/S3/PocoHTTPClient.cpp +++ b/src/IO/S3/PocoHTTPClient.cpp @@ -168,12 +168,16 @@ void PocoHTTPClient::makeRequestInternal( auto request_configuration = per_request_configuration(request); if (!request_configuration.proxyHost.empty()) + { + /// Turn on tunnel mode if proxy scheme is HTTP while endpoint scheme is HTTPS. + bool use_tunnel = request_configuration.proxyScheme == Aws::Http::Scheme::HTTP && poco_uri.getScheme() == "https"; session->setProxy( request_configuration.proxyHost, request_configuration.proxyPort, Aws::Http::SchemeMapper::ToString(request_configuration.proxyScheme), - false /// Disable proxy tunneling by default + use_tunnel ); + } Poco::Net::HTTPRequest poco_request(Poco::Net::HTTPRequest::HTTP_1_1);