* This handles fcgi:(dest) URLs */
| 1106 | * This handles fcgi:(dest) URLs |
| 1107 | */ |
| 1108 | static int proxy_fcgi_handler(request_rec *r, proxy_worker *worker, |
| 1109 | proxy_server_conf *conf, |
| 1110 | char *url, const char *proxyname, |
| 1111 | apr_port_t proxyport) |
| 1112 | { |
| 1113 | int status; |
| 1114 | char server_portstr[32]; |
| 1115 | conn_rec *origin = NULL; |
| 1116 | proxy_conn_rec *backend = NULL; |
| 1117 | apr_bucket_brigade *input_brigade; |
| 1118 | apr_off_t input_bytes = 0; |
| 1119 | apr_uri_t *uri; |
| 1120 | |
| 1121 | proxy_dir_conf *dconf = ap_get_module_config(r->per_dir_config, |
| 1122 | &proxy_module); |
| 1123 | |
| 1124 | apr_pool_t *p = r->pool; |
| 1125 | |
| 1126 | |
| 1127 | ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(01076) |
| 1128 | "url: %s proxyname: %s proxyport: %d", |
| 1129 | url, proxyname, proxyport); |
| 1130 | |
| 1131 | if (ap_cstr_casecmpn(url, "fcgi:", 5) != 0) { |
| 1132 | ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(01077) "declining URL %s", url); |
| 1133 | return DECLINED; |
| 1134 | } |
| 1135 | |
| 1136 | ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(01078) "serving URL %s", url); |
| 1137 | |
| 1138 | /* Create space for state information */ |
| 1139 | status = ap_proxy_acquire_connection(FCGI_SCHEME, &backend, worker, |
| 1140 | r->server); |
| 1141 | if (status != OK) { |
| 1142 | if (backend) { |
| 1143 | backend->close = 1; |
| 1144 | ap_proxy_release_connection(FCGI_SCHEME, backend, r->server); |
| 1145 | } |
| 1146 | return status; |
| 1147 | } |
| 1148 | |
| 1149 | backend->is_ssl = 0; |
| 1150 | |
| 1151 | /* Step One: Determine Who To Connect To */ |
| 1152 | uri = apr_palloc(p, sizeof(*uri)); |
| 1153 | status = ap_proxy_determine_connection(p, r, conf, worker, backend, |
| 1154 | uri, &url, proxyname, proxyport, |
| 1155 | server_portstr, |
| 1156 | sizeof(server_portstr)); |
| 1157 | if (status != OK) { |
| 1158 | goto cleanup; |
| 1159 | } |
| 1160 | |
| 1161 | /* We possibly reuse input data prefetched in previous call(s), e.g. for a |
| 1162 | * balancer fallback scenario. |
| 1163 | */ |
| 1164 | apr_pool_userdata_get((void **)&input_brigade, "proxy-fcgi-input", p); |
| 1165 | if (input_brigade == NULL) { |
nothing calls this directly
no test coverage detected