| 3295 | |
| 3296 | |
| 3297 | string ProcessManager::absolutePath(const string& path) |
| 3298 | { |
| 3299 | // Return directly when delegate is empty. |
| 3300 | if (delegate.isNone()) { |
| 3301 | return path; |
| 3302 | } |
| 3303 | |
| 3304 | vector<string> tokens = strings::tokenize(path, "/"); |
| 3305 | |
| 3306 | // Return delegate when path is root. |
| 3307 | if (tokens.size() == 0) { |
| 3308 | return "/" + delegate.get(); |
| 3309 | } |
| 3310 | |
| 3311 | Try<string> decode = http::decode(tokens[0]); |
| 3312 | |
| 3313 | // Return path when decode failed |
| 3314 | if (decode.isError()) { |
| 3315 | VLOG(1) << "Failed to decode URL path: " << decode.error(); |
| 3316 | return path; |
| 3317 | } |
| 3318 | |
| 3319 | if (processes.find(decode.get()) != processes.end()) { |
| 3320 | // Return path when the first token is a process id. |
| 3321 | return path; |
| 3322 | } else { |
| 3323 | return "/" + delegate.get() + path; |
| 3324 | } |
| 3325 | } |
| 3326 | |
| 3327 | |
| 3328 | void ProcessManager::enqueue(ProcessBase* process) |
no test coverage detected