You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by ya...@apache.org on 2016/07/29 23:47:06 UTC

[2/3] mesos git commit: Fixed the incomplete redirect url in `Master::Http::redirect()`.

Fixed the incomplete redirect url in `Master::Http::redirect()`.

When the request which contains query parameters is sent to a
non-leading master, the master would redirect ignoring the query
parameters. This patch changes redirect() to include them.

Review: https://reviews.apache.org/r/50488/


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/85b168eb
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/85b168eb
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/85b168eb

Branch: refs/heads/master
Commit: 85b168ebffdd5f31259a796560cc663087f38f34
Parents: e5630fd
Author: haosdent huang <ha...@gmail.com>
Authored: Fri Jul 29 16:10:16 2016 -0700
Committer: Jiang Yan Xu <xu...@apple.com>
Committed: Fri Jul 29 16:26:13 2016 -0700

----------------------------------------------------------------------
 src/master/http.cpp | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/85b168eb/src/master/http.cpp
----------------------------------------------------------------------
diff --git a/src/master/http.cpp b/src/master/http.cpp
index 1cbec97..e26dc2f 100644
--- a/src/master/http.cpp
+++ b/src/master/http.cpp
@@ -2035,7 +2035,11 @@ Future<Response> Master::Http::redirect(const Request& request) const
     // base url of leading master to avoid infinite redirect loop.
     return TemporaryRedirect(basePath);
   } else {
-    return TemporaryRedirect(basePath + request.url.path);
+    // `request.url` is not absolute so we can safely append it to
+    // `basePath`. See https://tools.ietf.org/html/rfc2616#section-5.1.2
+    // for details.
+    CHECK(!request.url.isAbsolute());
+    return TemporaryRedirect(basePath + stringify(request.url));
   }
 }