| 223 | } |
| 224 | |
| 225 | void send(const Call& call) |
| 226 | { |
| 227 | Option<Error> error = validation::scheduler::call::validate(devolve(call)); |
| 228 | |
| 229 | if (error.isSome()) { |
| 230 | drop(call, error->message); |
| 231 | return; |
| 232 | } |
| 233 | |
| 234 | // TODO(vinod): Add support for sending MESSAGE calls directly |
| 235 | // to the slave, instead of relaying it through the master, as |
| 236 | // the scheduler driver does. |
| 237 | |
| 238 | process::http::Request request; |
| 239 | request.method = "POST"; |
| 240 | request.url = master.get(); |
| 241 | request.body = serialize(contentType, call); |
| 242 | request.keepAlive = true; |
| 243 | request.headers = {{"Accept", stringify(contentType)}, |
| 244 | {"Content-Type", stringify(contentType)}}; |
| 245 | |
| 246 | VLOG(1) << "Adding authentication headers to " << call.type() << " call to " |
| 247 | << master.get(); |
| 248 | |
| 249 | // TODO(tillt): Add support for multi-step authentication protocols. |
| 250 | authenticatee->authenticate(request, credential) |
| 251 | .onAny(defer(self(), &Self::_send, call, lambda::_1)); |
| 252 | } |
| 253 | |
| 254 | Future<APIResult> call(const Call& callMessage) |
| 255 | { |