1
0
Fork 0

/_admin/shutdown will now need a DELETE request

This commit is contained in:
Andreas Streichardt 2016-06-08 15:26:53 +02:00
parent 0ffed98bd3
commit 496454df3f
6 changed files with 16 additions and 5 deletions

View File

@ -718,6 +718,10 @@ API:
- `/_api/structure`: an older unfinished and unpromoted API for data format and type
checks, superseded by Foxx applications.
!SUBSECTION Administration APIs
- `/_admin/shutdown` now needs to be called with the DELETE method
!SUBSECTION Handling of CORS requests
It can now be controlled in detail for which origin hosts CORS (Cross-origin resource

View File

@ -2,7 +2,7 @@
@startDocuBlock JSF_get_api_initiate
@brief initiates the shutdown sequence
@RESTHEADER{GET /_admin/shutdown, Initiate shutdown sequence}
@RESTHEADER{DELETE /_admin/shutdown, Initiate shutdown sequence}
@RESTDESCRIPTION
This call initiates a clean shutdown sequence.

View File

@ -42,6 +42,11 @@ bool RestShutdownHandler::isDirect() const { return true; }
////////////////////////////////////////////////////////////////////////////////
HttpHandler::status_t RestShutdownHandler::execute() {
if (_request->requestType() != GeneralRequest::RequestType::DELETE_REQ) {
generateError(GeneralResponse::ResponseCode::METHOD_NOT_ALLOWED, 405);
return HttpHandler::status_t(HANDLER_DONE);
}
ApplicationServer::server->beginShutdown();
try {

View File

@ -2333,7 +2333,7 @@
}
},
"/_admin/shutdown": {
"get": {
"delete": {
"description": "\n\nThis call initiates a clean shutdown sequence.\n\n",
"parameters": [],
"responses": {

View File

@ -1146,9 +1146,11 @@ function shutdownArangod(arangod, options) {
}
if (arangod.exitStatus === undefined ||
arangod.exitStatus.status === "RUNNING") {
const requestOptions = makeAuthorizationHeaders(options);
requestOptions.method = "DELETE";
print(arangod.url + "/_admin/shutdown");
download(arangod.url + "/_admin/shutdown", "",
makeAuthorizationHeaders(options));
download(arangod.url + "/_admin/shutdown", "", requestOptions);
} else {
print("Server already dead, doing nothing.");
}

View File

@ -193,7 +193,7 @@ function main(argv) {
if (startServer) {
if (typeof(instanceInfo.exitStatus) === 'undefined') {
download(instanceInfo.url + "/_admin/shutdown", "");
download(instanceInfo.url + "/_admin/shutdown", "", {method: "DELETE"});
print("Waiting for server shut down");
count = 0;