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

Function send_environment

modules/proxy/mod_proxy_fcgi.c:349–526  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

347}
348
349static apr_status_t send_environment(proxy_conn_rec *conn, request_rec *r,
350 apr_pool_t *temp_pool,
351 apr_uint16_t request_id)
352{
353 const apr_array_header_t *envarr;
354 const apr_table_entry_t *elts;
355 struct iovec vec[2];
356 ap_fcgi_header header;
357 unsigned char farray[AP_FCGI_HEADER_LEN];
358 char *body;
359 apr_status_t rv;
360 apr_size_t avail_len, len, required_len;
361 int next_elem, starting_elem;
362 fcgi_req_config_t *rconf = ap_get_module_config(r->request_config, &proxy_fcgi_module);
363 fcgi_dirconf_t *dconf = ap_get_module_config(r->per_dir_config, &proxy_fcgi_module);
364 char *proxy_filename = r->filename;
365
366 /* Resolve SCRIPT_NAME/FILENAME from the filesystem? */
367 if (rconf && rconf->dirwalk_uri_path) {
368 char *saved_uri = r->uri;
369 char *saved_path_info = r->path_info;
370 char *saved_canonical_filename = r->canonical_filename;
371 int saved_filetype = r->finfo.filetype;
372 int i = 0;
373
374 r->proxyreq = PROXYREQ_NONE;
375 do {
376 r->path_info = NULL;
377 r->finfo.filetype = APR_NOFILE;
378 r->uri = r->filename = r->canonical_filename = rconf->dirwalk_uri_path;
379 /* Try without than with DocumentRoot prefix */
380 if (i && ap_core_translate(r) != OK) {
381 continue;
382 }
383 ap_directory_walk(r);
384 } while (r->finfo.filetype != APR_REG && ++i < 2);
385 r->proxyreq = PROXYREQ_REVERSE;
386
387 /* If no actual script was found, fall back to the "proxy:"
388 * SCRIPT_FILENAME dealt with below or by FPM directly.
389 */
390 if (r->finfo.filetype != APR_REG) {
391 r->filename = proxy_filename;
392 r->canonical_filename = saved_canonical_filename;
393 r->finfo.filetype = saved_filetype;
394 r->path_info = saved_path_info;
395 }
396
397 /* Restore REQUEST_URI in any case */
398 r->uri = saved_uri;
399 }
400
401 /* Strip "proxy:" prefixes? */
402 if (r->filename == proxy_filename) {
403 char *newfname = NULL;
404
405 if (!strncmp(r->filename, "proxy:balancer://", 17)) {
406 newfname = apr_pstrdup(r->pool, r->filename+17);

Callers 1

fcgi_do_requestFunction · 0.70

Calls 12

ap_get_module_configFunction · 0.85
ap_core_translateFunction · 0.85
ap_directory_walkFunction · 0.85
ap_strchrFunction · 0.85
ap_add_common_varsFunction · 0.85
ap_add_cgi_varsFunction · 0.85
fix_cgivarsFunction · 0.85
ap_fcgi_encoded_env_lenFunction · 0.85
ap_fcgi_encode_envFunction · 0.85
ap_fcgi_fill_in_headerFunction · 0.85
ap_fcgi_header_to_arrayFunction · 0.85
send_dataFunction · 0.85

Tested by

no test coverage detected