MCPcopy Create free account
hub / github.com/apache/httpd / balancer_process_balancer_worker

Function balancer_process_balancer_worker

modules/proxy/mod_proxy_balancer.c:1129–1394  ·  view source on GitHub ↗

* Process the paramters and add or update the worker of the * balancer. Must only be called if the nonce has been validated to * match, to avoid XSS attacks. */

Source from the content-addressed store, hash-verified

1127 * match, to avoid XSS attacks.
1128 */
1129static int balancer_process_balancer_worker(request_rec *r, proxy_server_conf *conf,
1130 proxy_balancer *bsel,
1131 proxy_worker *wsel,
1132 apr_table_t *params)
1133
1134{
1135 apr_status_t rv;
1136 /* First set the params */
1137 if (wsel) {
1138 const char *val;
1139 int was_usable = PROXY_WORKER_IS_USABLE(wsel);
1140
1141 ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(01192) "settings worker params");
1142
1143 if ((val = apr_table_get(params, "w_lf"))) {
1144 int ival;
1145 double fval = atof(val);
1146 ival = fval * 100.0;
1147 if (ival >= 100 && ival <= 10000) {
1148 wsel->s->lbfactor = ival;
1149 if (bsel)
1150 recalc_factors(bsel);
1151 }
1152 }
1153 if ((val = apr_table_get(params, "w_wr"))) {
1154 if (strlen(val) && strlen(val) < sizeof(wsel->s->route))
1155 strcpy(wsel->s->route, val);
1156 else
1157 *wsel->s->route = '\0';
1158 }
1159 if ((val = apr_table_get(params, "w_rr"))) {
1160 if (strlen(val) && strlen(val) < sizeof(wsel->s->redirect))
1161 strcpy(wsel->s->redirect, val);
1162 else
1163 *wsel->s->redirect = '\0';
1164 }
1165 /*
1166 * TODO: Look for all 'w_status_#' keys and then loop thru
1167 * on that # character, since the character == the flag
1168 */
1169 if ((val = apr_table_get(params, "w_status_I"))) {
1170 ap_proxy_set_wstatus(PROXY_WORKER_IGNORE_ERRORS_FLAG, atoi(val), wsel);
1171 }
1172 if ((val = apr_table_get(params, "w_status_N"))) {
1173 ap_proxy_set_wstatus(PROXY_WORKER_DRAIN_FLAG, atoi(val), wsel);
1174 }
1175 if ((val = apr_table_get(params, "w_status_D"))) {
1176 ap_proxy_set_wstatus(PROXY_WORKER_DISABLED_FLAG, atoi(val), wsel);
1177 }
1178 if ((val = apr_table_get(params, "w_status_H"))) {
1179 ap_proxy_set_wstatus(PROXY_WORKER_HOT_STANDBY_FLAG, atoi(val), wsel);
1180 }
1181 if ((val = apr_table_get(params, "w_status_R"))) {
1182 ap_proxy_set_wstatus(PROXY_WORKER_HOT_SPARE_FLAG, atoi(val), wsel);
1183 }
1184 if ((val = apr_table_get(params, "w_status_S"))) {
1185 ap_proxy_set_wstatus(PROXY_WORKER_STOPPED_FLAG, atoi(val), wsel);
1186 }

Callers 2

balancer_manageFunction · 0.85
balancer_handlerFunction · 0.85

Calls 9

recalc_factorsFunction · 0.85
ap_proxy_set_wstatusFunction · 0.85
ap_cstr_casecmpFunction · 0.85
ap_lookup_providerFunction · 0.85
ap_proxy_get_workerFunction · 0.85
ap_proxy_define_workerFunction · 0.85
ap_proxy_share_workerFunction · 0.85

Tested by

no test coverage detected