Repository: mesos Updated Branches: refs/heads/master 7ee9881d6 -> 68c66b496
Made ProcessBase::route hard-fail rather than soft fail. It is an API expectation that the path start with '/', and if it doesn't it should be a programmer error. No code actually checked the return code. If a developer did get this wrong previously it would silently do nothing and in debugging their endpoint just wouldn't appear. This makes it simple/easy for them to find. Review: https://reviews.apache.org/r/27660 Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/68c66b49 Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/68c66b49 Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/68c66b49 Branch: refs/heads/master Commit: 68c66b4962554997b1c8cd00c31feb980dabe1d6 Parents: 7ee9881 Author: Cody Maloney <[email protected]> Authored: Tue Nov 18 14:44:16 2014 -0800 Committer: Adam B <[email protected]> Committed: Tue Nov 18 14:44:16 2014 -0800 ---------------------------------------------------------------------- 3rdparty/libprocess/include/process/process.hpp | 6 +++--- 3rdparty/libprocess/src/process.cpp | 8 +++----- 2 files changed, 6 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/68c66b49/3rdparty/libprocess/include/process/process.hpp ---------------------------------------------------------------------- diff --git a/3rdparty/libprocess/include/process/process.hpp b/3rdparty/libprocess/include/process/process.hpp index cb3e0a6..3708f98 100644 --- a/3rdparty/libprocess/include/process/process.hpp +++ b/3rdparty/libprocess/include/process/process.hpp @@ -121,13 +121,13 @@ protected: HttpRequestHandler; // Setup a handler for an HTTP request. - bool route( + void route( const std::string& name, const Option<std::string>& help, const HttpRequestHandler& handler); template <typename T> - bool route( + void route( const std::string& name, const Option<std::string>& help, Future<http::Response> (T::*method)(const http::Request&)) @@ -137,7 +137,7 @@ protected: // multiple callback interfaces). HttpRequestHandler handler = lambda::bind(method, dynamic_cast<T*>(this), lambda::_1); - return route(name, help, handler); + route(name, help, handler); } // Provide the static asset(s) at the specified _absolute_ path for http://git-wip-us.apache.org/repos/asf/mesos/blob/68c66b49/3rdparty/libprocess/src/process.cpp ---------------------------------------------------------------------- diff --git a/3rdparty/libprocess/src/process.cpp b/3rdparty/libprocess/src/process.cpp index 404a32d..7a986d7 100644 --- a/3rdparty/libprocess/src/process.cpp +++ b/3rdparty/libprocess/src/process.cpp @@ -2974,17 +2974,15 @@ UPID ProcessBase::link(const UPID& to) } -bool ProcessBase::route( +void ProcessBase::route( const string& name, const Option<string>& help_, const HttpRequestHandler& handler) { - if (name.find('/') != 0) { - return false; - } + // Routes must start with '/'. + CHECK(name.find('/') == 0); handlers.http[name.substr(1)] = handler; dispatch(help, &Help::add, pid.id, name, help_); - return true; }
