ext/common/agents/HelperAgent/AdminServer.h in passenger-5.0.8 vs ext/common/agents/HelperAgent/AdminServer.h in passenger-5.0.9

- old
+ new

@@ -195,11 +195,11 @@ int threadNumber = extractThreadNumberFromClientName(results.str(1)); P_WARN(results.str(1)); P_WARN(threadNumber); if (threadNumber < 1 || (unsigned int) threadNumber > requestHandlers.size()) { HeaderTable headers; - headers.insert(req->pool, "content-type", "application/json"); + headers.insert(req->pool, "Content-Type", "application/json"); writeSimpleResponse(client, 400, &headers, "{ \"status\": \"error\", \"reason\": \"Invalid thread number\" }"); if (!req->ended()) { endRequest(&client, &req); } @@ -208,11 +208,11 @@ requestHandlers[threadNumber - 1]->getContext()->libev->runLater(boost::bind( disconnectClient, requestHandlers[threadNumber - 1], results.str(1))); HeaderTable headers; - headers.insert(req->pool, "content-type", "application/json"); + headers.insert(req->pool, "Content-Type", "application/json"); writeSimpleResponse(client, 200, &headers, "{ \"status\": \"ok\" }"); if (!req->ended()) { endRequest(&client, &req); } @@ -226,11 +226,11 @@ } void processServerStatus(Client *client, Request *req) { if (authorize(client, req, READONLY)) { HeaderTable headers; - headers.insert(req->pool, "content-type", "application/json"); + headers.insert(req->pool, "Content-Type", "application/json"); Json::Value doc; doc["threads"] = (Json::UInt) requestHandlers.size(); for (unsigned int i = 0; i < requestHandlers.size(); i++) { Json::Value json; @@ -254,11 +254,11 @@ void processPoolStatusXml(Client *client, Request *req) { if (authorize(client, req, READONLY)) { try { VariantMap params = parseQueryString(req->getQueryString()); HeaderTable headers; - headers.insert(req->pool, "content-type", "text/xml"); + headers.insert(req->pool, "Content-Type", "text/xml"); writeSimpleResponse(client, 200, &headers, psg_pstrdup(req->pool, appPool->toXml( params.getBool("secrets", false, false)))); } catch (const SyntaxError &e) { SKC_ERROR(client, e.what()); @@ -275,11 +275,11 @@ if (authorize(client, req, READONLY)) { try { ApplicationPool2::Pool::InspectOptions options( parseQueryString(req->getQueryString())); HeaderTable headers; - headers.insert(req->pool, "content-type", "text/plain"); + headers.insert(req->pool, "Content-Type", "text/plain"); writeSimpleResponse(client, 200, &headers, psg_pstrdup(req->pool, appPool->inspect(options))); } catch (const SyntaxError &e) { SKC_ERROR(client, e.what()); } @@ -306,12 +306,12 @@ void processPoolRestartAppGroupBody(Client *client, Request *req) { HeaderTable headers; RestartMethod method = ApplicationPool2::RM_DEFAULT; - headers.insert(req->pool, "content-type", "application/json"); - headers.insert(req->pool, "cache-control", "no-cache, no-store, must-revalidate"); + headers.insert(req->pool, "Content-Type", "application/json"); + headers.insert(req->pool, "Cache-Control", "no-cache, no-store, must-revalidate"); if (!req->jsonBody.isMember("name")) { endAsBadRequest(&client, &req, "Name required"); return; } @@ -356,12 +356,12 @@ void processPoolDetachProcessBody(Client *client, Request *req) { HeaderTable headers; const char *response; - headers.insert(req->pool, "content-type", "application/json"); - headers.insert(req->pool, "cache-control", "no-cache, no-store, must-revalidate"); + headers.insert(req->pool, "Content-Type", "application/json"); + headers.insert(req->pool, "Cache-Control", "no-cache, no-store, must-revalidate"); if (req->jsonBody.isMember("pid")) { pid_t pid = (pid_t) req->jsonBody["pid"].asUInt(); if (appPool->detachProcess(pid)) { response = "{ \"detached\": true }"; @@ -378,11 +378,11 @@ } void processBacktraces(Client *client, Request *req) { if (authorize(client, req, READONLY)) { HeaderTable headers; - headers.insert(req->pool, "content-type", "text/plain"); + headers.insert(req->pool, "Content-Type", "text/plain"); writeSimpleResponse(client, 200, &headers, psg_pstrdup(req->pool, oxt::thread::all_backtraces())); if (!req->ended()) { endRequest(&client, &req); } @@ -392,12 +392,12 @@ } void processPing(Client *client, Request *req) { if (authorize(client, req, READONLY)) { HeaderTable headers; - headers.insert(req->pool, "cache-control", "no-cache, no-store, must-revalidate"); - headers.insert(req->pool, "content-type", "application/json"); + headers.insert(req->pool, "Cache-Control", "no-cache, no-store, must-revalidate"); + headers.insert(req->pool, "Content-Type", "application/json"); writeSimpleResponse(client, 200, &headers, "{ \"status\": \"ok\" }"); if (!req->ended()) { endRequest(&client, &req); } } else { @@ -408,11 +408,11 @@ void processShutdown(Client *client, Request *req) { if (req->method != HTTP_PUT) { respondWith405(client, req); } else if (authorize(client, req, FULL)) { HeaderTable headers; - headers.insert(req->pool, "content-type", "application/json"); + headers.insert(req->pool, "Content-Type", "application/json"); exitEvent->notify(); writeSimpleResponse(client, 200, &headers, "{ \"status\": \"ok\" }"); if (!req->ended()) { endRequest(&client, &req); } @@ -434,11 +434,11 @@ void processGc(Client *client, Request *req) { if (req->method != HTTP_PUT) { respondWith405(client, req); } else if (authorize(client, req, FULL)) { HeaderTable headers; - headers.insert(req->pool, "content-type", "application/json"); + headers.insert(req->pool, "Content-Type", "application/json"); for (unsigned int i = 0; i < requestHandlers.size(); i++) { requestHandlers[i]->getContext()->libev->runLater(boost::bind( garbageCollect, requestHandlers[i])); } writeSimpleResponse(client, 200, &headers, "{ \"status\": \"ok\" }"); @@ -462,11 +462,11 @@ HeaderTable headers; string logFile = getLogFile(); string fileDescriptorLogFile = getFileDescriptorLogFile(); - headers.insert(req->pool, "content-type", "application/json"); + headers.insert(req->pool, "Content-Type", "application/json"); Json::Value doc; requestHandlers[0]->getContext()->libev->runSync(boost::bind( getRequestHandlerConfig, requestHandlers[0], &doc)); doc["log_level"] = getLogLevel(); if (!logFile.empty()) { @@ -499,12 +499,12 @@ void processConfigBody(Client *client, Request *req) { HeaderTable headers; Json::Value &json = req->jsonBody; - headers.insert(req->pool, "content-type", "application/json"); - headers.insert(req->pool, "cache-control", "no-cache, no-store, must-revalidate"); + headers.insert(req->pool, "Content-Type", "application/json"); + headers.insert(req->pool, "Cache-Control", "no-cache, no-store, must-revalidate"); if (json.isMember("log_level")) { setLogLevel(json["log_level"].asInt()); } if (json.isMember("log_file")) { @@ -554,11 +554,11 @@ if (req->method != HTTP_POST) { respondWith405(client, req); } else if (authorize(client, req, FULL)) { int e; HeaderTable headers; - headers.insert(req->pool, "content-type", "application/json"); + headers.insert(req->pool, "Content-Type", "application/json"); string logFile = getLogFile(); if (logFile.empty()) { writeSimpleResponse(client, 500, &headers, "{ \"status\": \"error\", " "\"code\": \"NO_LOG_FILE\", " @@ -618,48 +618,48 @@ && req->body.size() > limit); } void respondWith401(Client *client, Request *req) { HeaderTable headers; - headers.insert(req->pool, "cache-control", "no-cache, no-store, must-revalidate"); - headers.insert(req->pool, "www-authenticate", "Basic realm=\"admin\""); + headers.insert(req->pool, "Cache-Control", "no-cache, no-store, must-revalidate"); + headers.insert(req->pool, "WWW-Authenticate", "Basic realm=\"admin\""); writeSimpleResponse(client, 401, &headers, "Unauthorized"); if (!req->ended()) { endRequest(&client, &req); } } void respondWith404(Client *client, Request *req) { HeaderTable headers; - headers.insert(req->pool, "cache-control", "no-cache, no-store, must-revalidate"); + headers.insert(req->pool, "Cache-Control", "no-cache, no-store, must-revalidate"); writeSimpleResponse(client, 404, &headers, "Not found"); if (!req->ended()) { endRequest(&client, &req); } } void respondWith405(Client *client, Request *req) { HeaderTable headers; - headers.insert(req->pool, "cache-control", "no-cache, no-store, must-revalidate"); + headers.insert(req->pool, "Cache-Control", "no-cache, no-store, must-revalidate"); writeSimpleResponse(client, 405, &headers, "Method not allowed"); if (!req->ended()) { endRequest(&client, &req); } } void respondWith413(Client *client, Request *req) { HeaderTable headers; - headers.insert(req->pool, "cache-control", "no-cache, no-store, must-revalidate"); + headers.insert(req->pool, "Cache-Control", "no-cache, no-store, must-revalidate"); writeSimpleResponse(client, 413, &headers, "Request body too large"); if (!req->ended()) { endRequest(&client, &req); } } void respondWith422(Client *client, Request *req, const StaticString &body) { HeaderTable headers; - headers.insert(req->pool, "cache-control", "no-cache, no-store, must-revalidate"); - headers.insert(req->pool, "content-type", "text/plain; charset=utf-8"); + headers.insert(req->pool, "Cache-Control", "no-cache, no-store, must-revalidate"); + headers.insert(req->pool, "Content-Type", "text/plain; charset=utf-8"); writeSimpleResponse(client, 422, &headers, body); if (!req->ended()) { endRequest(&client, &req); } }