You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by ti...@apache.org on 2016/01/20 22:41:36 UTC

[3/4] mesos git commit: Removed deprecated constructor of http::Unauthorized in libprocess.

Removed deprecated constructor of http::Unauthorized in libprocess.

The constructor of `process::http::Unauthorized(const std::string&)`
is marked as deprecated. This patch fully removes the constructor and
cleans up its usage in the libprocess codebase.

This change also allows to use initializer lists on the
`process::http::Unauthorized(const std::vector<std::string>&)`
constructor since there is no longer an ambiguity.

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


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

Branch: refs/heads/master
Commit: 8351fe5308de69f52dfa18cff145abfc63b4f2e0
Parents: 1776671
Author: Alexander Rojas <al...@mesosphere.io>
Authored: Wed Jan 20 22:00:52 2016 +0100
Committer: Till Toenshoff <to...@me.com>
Committed: Wed Jan 20 22:00:52 2016 +0100

----------------------------------------------------------------------
 3rdparty/libprocess/include/process/http.hpp | 13 -------------
 3rdparty/libprocess/src/authenticator.cpp    |  2 +-
 3rdparty/libprocess/src/tests/http_tests.cpp | 10 +++++-----
 3 files changed, 6 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/8351fe53/3rdparty/libprocess/include/process/http.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/include/process/http.hpp b/3rdparty/libprocess/include/process/http.hpp
index 1d9a944..bcba304 100644
--- a/3rdparty/libprocess/include/process/http.hpp
+++ b/3rdparty/libprocess/include/process/http.hpp
@@ -548,19 +548,6 @@ struct Unauthorized : Response
     // same header.
     headers["WWW-Authenticate"] = strings::join(", ", challenges);
   }
-
-  // TODO(arojas): Remove this in favor of the
-  // explicit challenge constructor above.
-  explicit Unauthorized(const std::string& realm)
-    : Unauthorized(
-          std::vector<std::string>{"Basic realm=\"" + realm + "\""}) {}
-
-  // TODO(arojas): Remove this in favor of the
-  // explicit challenge constructor above.
-  Unauthorized(const std::string& realm, const std::string& body)
-    : Unauthorized(
-          std::vector<std::string>{"Basic realm=\"" + realm + "\""},
-          body) {}
 };
 
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/8351fe53/3rdparty/libprocess/src/authenticator.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/authenticator.cpp b/3rdparty/libprocess/src/authenticator.cpp
index 7371a62..16b48cd 100644
--- a/3rdparty/libprocess/src/authenticator.cpp
+++ b/3rdparty/libprocess/src/authenticator.cpp
@@ -61,7 +61,7 @@ Future<AuthenticationResult> BasicAuthenticatorProcess::authenticate(
 {
   AuthenticationResult unauthorized;
   unauthorized.unauthorized =
-    Unauthorized(vector<string>({"Basic realm=\"" + realm_ + "\""}));
+    Unauthorized({"Basic realm=\"" + realm_ + "\""});
 
   Option<string> credentials = request.headers.get("Authorization");
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/8351fe53/3rdparty/libprocess/src/tests/http_tests.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/tests/http_tests.cpp b/3rdparty/libprocess/src/tests/http_tests.cpp
index 7e1567f..5a66d84 100644
--- a/3rdparty/libprocess/src/tests/http_tests.cpp
+++ b/3rdparty/libprocess/src/tests/http_tests.cpp
@@ -1246,7 +1246,7 @@ TEST_F(HttpAuthenticationTest, Unauthorized)
 
   AuthenticationResult authentication;
   authentication.unauthorized =
-    http::Unauthorized(vector<string>({"Basic realm=\"realm\""}));
+    http::Unauthorized({"Basic realm=\"realm\""});
 
   EXPECT_CALL(*authenticator, authenticate(_))
     .WillOnce(Return(authentication));
@@ -1255,7 +1255,7 @@ TEST_F(HttpAuthenticationTest, Unauthorized)
     http::get(http.process->self(), "authenticated");
 
   AWAIT_EXPECT_RESPONSE_STATUS_EQ(
-      http::Unauthorized(vector<string>()).status,
+      http::Unauthorized({}).status,
       response);
 
   EXPECT_EQ(
@@ -1390,7 +1390,7 @@ TEST_F(HttpAuthenticationTest, Basic)
     Future<http::Response> response = http::get(*http.process, "authenticated");
 
     AWAIT_EXPECT_RESPONSE_STATUS_EQ(
-        http::Unauthorized(vector<string>()).status,
+        http::Unauthorized({}).status,
         response);
   }
 
@@ -1404,7 +1404,7 @@ TEST_F(HttpAuthenticationTest, Basic)
       http::get(http.process->self(), "authenticated", None(), headers);
 
     AWAIT_EXPECT_RESPONSE_STATUS_EQ(
-        http::Unauthorized(vector<string>()).status,
+        http::Unauthorized({}).status,
         response);
   }
 
@@ -1418,7 +1418,7 @@ TEST_F(HttpAuthenticationTest, Basic)
       http::get(http.process->self(), "authenticated", None(), headers);
 
     AWAIT_EXPECT_RESPONSE_STATUS_EQ(
-        http::Unauthorized(vector<string>()).status,
+        http::Unauthorized({}).status,
         response);
   }