MCPcopy Create free account
hub / github.com/cloud-hypervisor/cloud-hypervisor / handle_http_request

Function handle_http_request

vmm/src/api/http/mod.rs:303–323  ·  view source on GitHub ↗
(
    request: &Request,
    api_notifier: &EventFd,
    api_sender: &Sender<ApiRequest>,
)

Source from the content-addressed store, hash-verified

301});
302
303fn handle_http_request(
304 request: &Request,
305 api_notifier: &EventFd,
306 api_sender: &Sender<ApiRequest>,
307) -> Response {
308 let path = request.uri().get_abs_path().to_string();
309 let mut response = match HTTP_ROUTES.routes.get(&path) {
310 Some(route) => match api_notifier.try_clone() {
311 Ok(notifier) => route.handle_request(request, notifier, api_sender.clone()),
312 Err(_) => error_response(
313 HttpError::InternalServerError,
314 StatusCode::InternalServerError,
315 ),
316 },
317 None => error_response(HttpError::NotFound, StatusCode::NotFound),
318 };
319
320 response.set_server("Cloud Hypervisor API");
321 response.set_content_type(MediaType::ApplicationJson);
322 response
323}
324
325fn start_http_thread(
326 mut server: HttpServer,

Callers 1

start_http_threadFunction · 0.85

Calls 5

error_responseFunction · 0.85
getMethod · 0.45
try_cloneMethod · 0.45
handle_requestMethod · 0.45
cloneMethod · 0.45

Tested by

no test coverage detected