You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by ji...@apache.org on 2017/01/18 16:22:42 UTC
mesos git commit: Fixed issues with the Docker fetcher when using a
proxy.
Repository: mesos
Updated Branches:
refs/heads/master 3d21d776d -> ef138309e
Fixed issues with the Docker fetcher when using a proxy.
When behing a proxy, 'curl' uses HTTP CONNECT tunneling to access HTTPS.
This lead to problems with our HTTP parser because the response of a
'CONNECT' doesn't have neither headers nor a body.
Review: https://reviews.apache.org/r/55621/
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/ef138309
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/ef138309
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/ef138309
Branch: refs/heads/master
Commit: ef138309e3ff747dc5bdd5947570c0284784a98c
Parents: 3d21d77
Author: Jan Schlicht <ja...@mesosphere.io>
Authored: Wed Jan 18 16:35:29 2017 +0100
Committer: Jie Yu <yu...@gmail.com>
Committed: Wed Jan 18 17:20:27 2017 +0100
----------------------------------------------------------------------
src/uri/fetchers/docker.cpp | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/ef138309/src/uri/fetchers/docker.cpp
----------------------------------------------------------------------
diff --git a/src/uri/fetchers/docker.cpp b/src/uri/fetchers/docker.cpp
index 027e748..5dd7b91 100644
--- a/src/uri/fetchers/docker.cpp
+++ b/src/uri/fetchers/docker.cpp
@@ -165,6 +165,25 @@ static Future<http::Response> curl(
Try<vector<http::Response>> responses =
http::decodeResponses(output.get());
+ // TODO(nfnt): If we're behing a proxy, curl will use 'HTTP
+ // CONNECT tunneling' to access HTTPS. The HTTP parser will
+ // put the actual response(s) to the body of the 'CONNECT'
+ // response. Therefore, in that case, we'll parse the body of
+ // 'CONNECT' response again. See MESOS-6010 for more details.
+ bool hasProxy =
+ os::getenv("https_proxy").isSome() ||
+ os::getenv("HTTPS_PROXY").isSome();
+
+ if (hasProxy && responses.isSome() && responses->size() == 1) {
+ const http::Response& response = responses->back();
+
+ if (response.code == 200 &&
+ !response.headers.contains("Content-Length") &&
+ response.headers.get("Transfer-Encoding") != Some("chunked")) {
+ responses = http::decodeResponses(response.body);
+ }
+ }
+
if (responses.isError()) {
return Failure(
"Failed to decode HTTP responses: " + responses.error() +