MCPcopy Index your code
hub / github.com/apache/httpd / proxy_status_hook

Function proxy_status_hook

modules/proxy/mod_proxy.c:3134–3250  ·  view source on GitHub ↗

* proxy Extension to mod_status */

Source from the content-addressed store, hash-verified

3132 * proxy Extension to mod_status
3133 */
3134static int proxy_status_hook(request_rec *r, int flags)
3135{
3136 int i, n;
3137 void *sconf = r->server->module_config;
3138 proxy_server_conf *conf = (proxy_server_conf *)
3139 ap_get_module_config(sconf, &proxy_module);
3140 proxy_balancer *balancer = NULL;
3141 proxy_worker **worker = NULL;
3142
3143 if (conf->balancers->nelts == 0 ||
3144 conf->proxy_status == status_off)
3145 return OK;
3146
3147 balancer = (proxy_balancer *)conf->balancers->elts;
3148 for (i = 0; i < conf->balancers->nelts; i++) {
3149 if (!(flags & AP_STATUS_SHORT)) {
3150 ap_rputs("<hr />\n<h1>Proxy LoadBalancer Status for ", r);
3151 ap_rvputs(r, balancer->s->name, "</h1>\n\n", NULL);
3152 ap_rputs("\n\n<table border=\"0\"><tr>"
3153 "<th>SSes</th><th>Timeout</th><th>Method</th>"
3154 "</tr>\n<tr>", r);
3155 if (*balancer->s->sticky) {
3156 if (strcmp(balancer->s->sticky, balancer->s->sticky_path)) {
3157 ap_rvputs(r, "<td>", balancer->s->sticky, " | ",
3158 balancer->s->sticky_path, NULL);
3159 }
3160 else {
3161 ap_rvputs(r, "<td>", balancer->s->sticky, NULL);
3162 }
3163 }
3164 else {
3165 ap_rputs("<td> - ", r);
3166 }
3167 ap_rprintf(r, "</td><td>%" APR_TIME_T_FMT "</td>",
3168 apr_time_sec(balancer->s->timeout));
3169 ap_rprintf(r, "<td>%s</td>\n",
3170 balancer->lbmethod->name);
3171 ap_rputs("</table>\n", r);
3172 ap_rputs("\n\n<table border=\"0\"><tr>"
3173 "<th>Sch</th><th>Host</th><th>Stat</th>"
3174 "<th>Route</th><th>Redir</th>"
3175 "<th>F</th><th>Set</th><th>Acc</th><th>Busy</th><th>Wr</th><th>Rd</th>"
3176 "</tr>\n", r);
3177 }
3178 else {
3179 ap_rprintf(r, "ProxyBalancer[%d]Name: %s\n", i, balancer->s->name);
3180 }
3181
3182 worker = (proxy_worker **)balancer->workers->elts;
3183 for (n = 0; n < balancer->workers->nelts; n++) {
3184 char fbuf[50];
3185 if (!(flags & AP_STATUS_SHORT)) {
3186 ap_rvputs(r, "<tr>\n<td>", (*worker)->s->scheme, "</td>", NULL);
3187 ap_rvputs(r, "<td>", (*worker)->s->hostname_ex, "</td><td>", NULL);
3188 ap_rvputs(r, ap_proxy_parse_wstatus(r->pool, *worker), NULL);
3189 ap_rvputs(r, "</td><td>", (*worker)->s->route, NULL);
3190 ap_rvputs(r, "</td><td>", (*worker)->s->redirect, NULL);
3191 ap_rprintf(r, "</td><td>%.2f</td>", (float)((*worker)->s->lbfactor)/100.0);

Callers

nothing calls this directly

Calls 5

ap_get_module_configFunction · 0.85
ap_rputsFunction · 0.85
ap_rvputsFunction · 0.85
ap_rprintfFunction · 0.85
ap_proxy_parse_wstatusFunction · 0.85

Tested by

no test coverage detected