mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-12-22 05:35:20 +00:00
API: fix http hang for vmm.ping/vm.create/vm.info/vmm.shutdown
vmm.ping/vm.info will hang for PUT method, vm.create/vmm.shutdonw hang for GET method. Because these four APIs do not write the response body when the HTTP method does not match. Signed-off-by: LiHui <andrewli@kubesphere.io>
This commit is contained in:
parent
9d46890dc0
commit
b0be5ff8ad
@ -54,7 +54,7 @@ impl EndpointHandler for VmCreate {
|
||||
}
|
||||
}
|
||||
|
||||
_ => Response::new(Version::Http11, StatusCode::BadRequest),
|
||||
_ => error_response(HttpError::BadRequest, StatusCode::BadRequest),
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -237,7 +237,7 @@ impl EndpointHandler for VmInfo {
|
||||
}
|
||||
Err(e) => error_response(e, StatusCode::InternalServerError),
|
||||
},
|
||||
_ => Response::new(Version::Http11, StatusCode::BadRequest),
|
||||
_ => error_response(HttpError::BadRequest, StatusCode::BadRequest),
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -263,7 +263,8 @@ impl EndpointHandler for VmmPing {
|
||||
}
|
||||
Err(e) => error_response(e, StatusCode::InternalServerError),
|
||||
},
|
||||
_ => Response::new(Version::Http11, StatusCode::BadRequest),
|
||||
|
||||
_ => error_response(HttpError::BadRequest, StatusCode::BadRequest),
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -285,7 +286,7 @@ impl EndpointHandler for VmmShutdown {
|
||||
Err(e) => error_response(e, StatusCode::InternalServerError),
|
||||
}
|
||||
}
|
||||
_ => Response::new(Version::Http11, StatusCode::BadRequest),
|
||||
_ => error_response(HttpError::BadRequest, StatusCode::BadRequest),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user