Skip to content

Commit

Permalink
Add trusted flag to content we set
Browse files Browse the repository at this point in the history
  • Loading branch information
jajik committed Aug 7, 2024
1 parent 1f80da6 commit 4ed1b63
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions native/mod_manager/mod_manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -1574,11 +1574,11 @@ static char *process_dump(request_rec *r, int *errtype)
(void)errtype;

if (accept_header && strstr((char *)accept_header, "text/xml") != NULL) {
ap_set_content_type(r, "text/xml");
ap_set_content_type_ex(r, "text/xml", 1);
type = TEXT_XML;
ap_rprintf(r, "<?xml version=\"1.0\" standalone=\"yes\" ?>\n");
} else {
ap_set_content_type(r, "text/plain");
ap_set_content_type_ex(r, "text/plain", 1);
type = TEXT_PLAIN;
}

Expand Down Expand Up @@ -1773,11 +1773,11 @@ static char *process_info(request_rec *r, int *errtype)
(void)errtype;

if (accept_header && strstr((char *)accept_header, "text/xml") != NULL) {
ap_set_content_type(r, "text/xml");
ap_set_content_type_ex(r, "text/xml", 1);
type = TEXT_XML;
ap_rprintf(r, "<?xml version=\"1.0\" standalone=\"yes\" ?>\n");
} else {
ap_set_content_type(r, "text/plain");
ap_set_content_type_ex(r, "text/plain", 1);
type = TEXT_PLAIN;
}

Expand Down Expand Up @@ -2254,7 +2254,7 @@ static char *process_appl_cmd(request_rec *r, char **ptr, int status, int *errty
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, "process_appl_cmd: STOP-APP nbrequests %d",
ou->nbrequests);
if (fromnode) {
ap_set_content_type(r, "text/plain");
ap_set_content_type_ex(r, "text/plain", 1);
ap_rprintf(r, "Type=STOP-APP-RSP&JvmRoute=%.*s&Alias=%.*s&Context=%.*s&Requests=%d",
(int)sizeof(nodeinfo.mess.JVMRoute), nodeinfo.mess.JVMRoute, (int)sizeof(vhost->host),
vhost->host, (int)sizeof(vhost->context), vhost->context, ou->nbrequests);
Expand Down Expand Up @@ -2352,7 +2352,7 @@ static char *process_status(request_rec *r, const char *const *ptr, int *errtype
* If the node is usualable do a ping/pong to prevent Split-Brain Syndrome
* and update the worker status and load factor acccording to the test result.
*/
ap_set_content_type(r, "text/plain");
ap_set_content_type_ex(r, "text/plain", 1);
ap_rprintf(r, "Type=STATUS-RSP&JVMRoute=%.*s", (int)sizeof(nodeinfo.mess.JVMRoute), nodeinfo.mess.JVMRoute);

ap_rprintf(r, isnode_up(r, node->mess.id, Load) != OK ? "&State=NOTOK" : "&State=OK");
Expand All @@ -2373,12 +2373,12 @@ static char *process_version(request_rec *r, const char *const *const ptr, int *
(void)errtype;

if (accept_header && strstr((char *)accept_header, "text/xml") != NULL) {
ap_set_content_type(r, "text/xml");
ap_set_content_type_ex(r, "text/xml", 1);
ap_rprintf(r, "<?xml version=\"1.0\" standalone=\"yes\" ?>\n");
ap_rprintf(r, "<version><release>%s</release><protocol>%s</protocol></version>", MOD_CLUSTER_EXPOSED_VERSION,
VERSION_PROTOCOL);
} else {
ap_set_content_type(r, "text/plain");
ap_set_content_type_ex(r, "text/plain", 1);
ap_rprintf(r, "release: %s, protocol: %s", MOD_CLUSTER_EXPOSED_VERSION, VERSION_PROTOCOL);
}
ap_rprintf(r, "\n");
Expand Down Expand Up @@ -2428,14 +2428,14 @@ static char *process_ping(request_rec *r, const char *const *ptr, int *errtype)
if (nodeinfo.mess.id == -1) {
/* PING scheme, host, port or just httpd */
if (scheme == NULL && host == NULL && port == NULL) {
ap_set_content_type(r, "text/plain");
ap_set_content_type_ex(r, "text/plain", 1);
ap_rprintf(r, "Type=PING-RSP&State=OK");
} else {
if (scheme == NULL || host == NULL || port == NULL) {
*errtype = TYPESYNTAX;
return apr_psprintf(r->pool, SMISFLD);
}
ap_set_content_type(r, "text/plain");
ap_set_content_type_ex(r, "text/plain", 1);
ap_rprintf(r, "Type=PING-RSP");
ap_rprintf(r, ishost_up(r, scheme, host, port) != OK ? "&State=NOTOK" : "&State=OK");
}
Expand All @@ -2454,7 +2454,7 @@ static char *process_ping(request_rec *r, const char *const *ptr, int *errtype)
* If the node is usualable do a ping/pong to prevent Split-Brain Syndrome
* and update the worker status and load factor acccording to the test result.
*/
ap_set_content_type(r, "text/plain");
ap_set_content_type_ex(r, "text/plain", 1);
ap_rprintf(r, "Type=PING-RSP&JVMRoute=%.*s", (int)sizeof(nodeinfo.mess.JVMRoute), nodeinfo.mess.JVMRoute);

ap_rprintf(r, isnode_up(r, node->mess.id, -2) != OK ? "&State=NOTOK" : "&State=OK");
Expand Down Expand Up @@ -3219,7 +3219,7 @@ static const char *process_params(request_rec *r, apr_table_t *params, int allow

static void print_fileheader(request_rec *r, const mod_manager_config *mconf, const char *errstring)
{
ap_set_content_type(r, "text/html; charset=ISO-8859-1");
ap_set_content_type_ex(r, "text/html; charset=ISO-8859-1", 1);
ap_rputs(DOCTYPE_HTML_3_2 "<html><head>\n<title>Mod_cluster Status</title>\n</head><body>\n", r);
ap_rvputs(r, "<h1>", MOD_CLUSTER_EXPOSED_VERSION, "</h1>", NULL);

Expand Down

0 comments on commit 4ed1b63

Please sign in to comment.