Repository: mesos
Updated Branches:
  refs/heads/master 20cae7c96 -> e9eb5bb4f


Updated FirewallRule interface so is consistent with http::Response usage in 
the project.

In order to re-create consistency, the return value of `FirewallRule::apply()`
is being updated towards returning a copy of the http::Response instead of an
Owned pointer.

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


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

Branch: refs/heads/master
Commit: e9eb5bb4f86bb64d0bddf32e400be977841b3f67
Parents: 20cae7c
Author: Alexander Rojas <[email protected]>
Authored: Mon Jul 6 16:29:24 2015 +0200
Committer: Till Toenshoff <[email protected]>
Committed: Mon Jul 6 16:36:31 2015 +0200

----------------------------------------------------------------------
 3rdparty/libprocess/include/process/firewall.hpp | 7 +++----
 3rdparty/libprocess/src/process.cpp              | 8 +++-----
 2 files changed, 6 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/e9eb5bb4/3rdparty/libprocess/include/process/firewall.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/include/process/firewall.hpp 
b/3rdparty/libprocess/include/process/firewall.hpp
index 692e065..f92a6c5 100644
--- a/3rdparty/libprocess/include/process/firewall.hpp
+++ b/3rdparty/libprocess/include/process/firewall.hpp
@@ -56,7 +56,7 @@ public:
    *     HTTP error code and possibly a message indicating the reason
    *     for failure. Otherwise an unset 'Option' object.
    */
-  virtual Option<Owned<http::Response>> apply(
+  virtual Option<http::Response> apply(
       const network::Socket& socket,
       const http::Request& request) = 0;
 };
@@ -77,13 +77,12 @@ public:
 
   virtual ~DisabledEndpointsFirewallRule() {}
 
-  virtual Option<Owned<http::Response>> apply(
+  virtual Option<http::Response> apply(
       const network::Socket&,
       const http::Request& request)
   {
     if (paths.contains(request.path)) {
-      return Owned<http::Response>(
-          new http::Forbidden("Endpoint '" + request.path + "' is disabled"));
+      return http::Forbidden("Endpoint '" + request.path + "' is disabled");
     }
 
     return None();

http://git-wip-us.apache.org/repos/asf/mesos/blob/e9eb5bb4/3rdparty/libprocess/src/process.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/process.cpp 
b/3rdparty/libprocess/src/process.cpp
index 883776a..2f8072b 100644
--- a/3rdparty/libprocess/src/process.cpp
+++ b/3rdparty/libprocess/src/process.cpp
@@ -2211,11 +2211,9 @@ bool ProcessManager::handle(
     // Don't use a const reference, since it cannot be guaranteed
     // that the rules don't keep an internal state.
     foreach (Owned<FirewallRule>& rule, firewallRules) {
-      Option<Owned<Response>> rejection = rule->apply(socket, *request);
+      Option<Response> rejection = rule->apply(socket, *request);
       if (rejection.isSome()) {
-        CHECK(rejection.get().get() != NULL);
-
-        VLOG(1) << "Returning '"<< rejection.get()->status << "' for '"
+        VLOG(1) << "Returning '"<< rejection.get().status << "' for '"
                 << request->path << "' (firewall rule forbids request)";
 
         // TODO(arojas): Get rid of the duplicated code to return an
@@ -2229,7 +2227,7 @@ bool ProcessManager::handle(
         dispatch(
             proxy,
             &HttpProxy::enqueue,
-            *rejection.get(),
+            rejection.get(),
             *request);
 
         // Cleanup request.

Reply via email to