| 3080 | |
| 3081 | |
| 3082 | Future<Response> Http::containerizerDebug( |
| 3083 | const Request& request, |
| 3084 | const Option<Principal>& principal) const |
| 3085 | { |
| 3086 | // TODO(a10gupta): Remove check for enabled |
| 3087 | // authorization as part of MESOS-5346. |
| 3088 | if (request.method != "GET" && slave->authorizer.isSome()) { |
| 3089 | return MethodNotAllowed({"GET"}, request.method); |
| 3090 | } |
| 3091 | |
| 3092 | Try<string> endpoint = extractEndpoint(request.url); |
| 3093 | if (endpoint.isError()) { |
| 3094 | return Failure("Failed to extract endpoint: " + endpoint.error()); |
| 3095 | } |
| 3096 | |
| 3097 | return authorizeEndpoint( |
| 3098 | endpoint.get(), |
| 3099 | request.method, |
| 3100 | slave->authorizer, |
| 3101 | principal) |
| 3102 | .then(defer( |
| 3103 | slave->self(), |
| 3104 | [this, request](bool authorized) -> Future<Response> { |
| 3105 | if (!authorized) { |
| 3106 | return Forbidden(); |
| 3107 | } |
| 3108 | |
| 3109 | return _containerizerDebug() |
| 3110 | .then([request](const JSON::Object& result) -> Response { |
| 3111 | return process::http::OK(result, request.url.query.get("jsonp")); |
| 3112 | }); |
| 3113 | })); |
| 3114 | } |
| 3115 | |
| 3116 | |
| 3117 | Future<JSON::Object> Http::_containerizerDebug() const |
no test coverage detected