src/agent/Shared/ApiServerUtils.h in passenger-5.0.21 vs src/agent/Shared/ApiServerUtils.h in passenger-5.0.22
- old
+ new
@@ -687,24 +687,32 @@
}
}
template<typename Server, typename Client, typename Request>
inline void
-apiServerProcessVersion(Server *server, Client *client, Request *req) {
+apiServerProcessInfo(Server *server, Client *client, Request *req,
+ const boost::function<void (Json::Value &response)> &postprocessResponse =
+ boost::function<void (Json::Value &)>())
+{
Authorization auth(authorize(server, client, req));
if (auth.canReadPool || auth.canInspectState) {
ServerKit::HeaderTable headers;
headers.insert(req->pool, "Content-Type", "application/json");
Json::Value response;
+ response["pid"] = (Json::UInt64) getpid();
response["program_name"] = PROGRAM_NAME;
response["program_version"] = PASSENGER_VERSION;
response["api_version"] = PASSENGER_API_VERSION;
response["api_version_major"] = PASSENGER_API_VERSION_MAJOR;
response["api_version_minor"] = PASSENGER_API_VERSION_MINOR;
#ifdef PASSENGER_IS_ENTERPRISE
response["passenger_enterprise"] = true;
#endif
+
+ if (postprocessResponse) {
+ postprocessResponse(response);
+ }
server->writeSimpleResponse(client, 200, &headers,
response.toStyledString());
if (!req->ended()) {
server->endRequest(&client, &req);