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

Function scgi_request_status

modules/proxy/mod_proxy_scgi.c:474–530  ·  view source on GitHub ↗

* Internal redirect / subrequest handler, working on request_status hook */

Source from the content-addressed store, hash-verified

472 * Internal redirect / subrequest handler, working on request_status hook
473 */
474static int scgi_request_status(int *status, request_rec *r)
475{
476 scgi_request_config *req_conf;
477
478 if ( (*status == OK)
479 && (req_conf = ap_get_module_config(r->request_config,
480 &proxy_scgi_module))) {
481 switch (req_conf->type) {
482 case scgi_internal_redirect:
483 ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(00862)
484 "Internal redirect to %s", req_conf->location);
485
486 r->status_line = NULL;
487 if (r->method_number != M_GET) {
488 /* keep HEAD, which is passed around as M_GET, too */
489 r->method = "GET";
490 r->method_number = M_GET;
491 }
492 apr_table_unset(r->headers_in, "Content-Length");
493 ap_internal_redirect_handler(req_conf->location, r);
494 return OK;
495 /* break; */
496
497 case scgi_sendfile:
498 ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(00863)
499 "File subrequest to %s", req_conf->location);
500 do {
501 request_rec *rr;
502
503 rr = ap_sub_req_lookup_file(req_conf->location, r,
504 r->output_filters);
505 if (rr->status == HTTP_OK && rr->finfo.filetype != APR_NOFILE) {
506 /*
507 * We don't touch Content-Length here. It might be
508 * borked (there's plenty of room for a race condition).
509 * Either the backend sets it or it's gonna be chunked.
510 */
511 ap_run_sub_req(rr);
512 }
513 else {
514 ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(00864)
515 "Subrequest to file '%s' not possible. "
516 "(rr->status=%d, rr->finfo.filetype=%d)",
517 req_conf->location, rr->status,
518 rr->finfo.filetype);
519 *status = HTTP_INTERNAL_SERVER_ERROR;
520 return *status;
521 }
522 } while (0);
523
524 return OK;
525 /* break; */
526 }
527 }
528
529 return DECLINED;
530}
531

Callers

nothing calls this directly

Calls 4

ap_get_module_configFunction · 0.85
ap_sub_req_lookup_fileFunction · 0.85
ap_run_sub_reqFunction · 0.85

Tested by

no test coverage detected