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

Function make_sub_request

server/request.c:2015–2105  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2013 */
2014
2015static request_rec *make_sub_request(const request_rec *r,
2016 ap_filter_t *next_filter)
2017{
2018 apr_pool_t *rrp;
2019 request_rec *rnew;
2020
2021 apr_pool_create(&rrp, r->pool);
2022 apr_pool_tag(rrp, "subrequest");
2023 rnew = apr_pcalloc(rrp, sizeof(request_rec));
2024 rnew->pool = rrp;
2025
2026 rnew->hostname = r->hostname;
2027 rnew->request_time = r->request_time;
2028 rnew->connection = r->connection;
2029 rnew->server = r->server;
2030 rnew->log = r->log;
2031
2032 rnew->request_config = ap_create_request_config(rnew->pool);
2033
2034 /* Start a clean config from this subrequest's vhost. Optimization in
2035 * Location/File/Dir walks from the parent request assure that if the
2036 * config blocks of the subrequest match the parent request, no merges
2037 * will actually occur (and generally a minimal number of merges are
2038 * required, even if the parent and subrequest aren't quite identical.)
2039 */
2040 rnew->per_dir_config = r->server->lookup_defaults;
2041
2042 rnew->htaccess = r->htaccess;
2043 rnew->allowed_methods = ap_make_method_list(rnew->pool, 2);
2044
2045 /* make a copy of the allowed-methods list */
2046 ap_copy_method_list(rnew->allowed_methods, r->allowed_methods);
2047
2048 /* start with the same set of output filters */
2049 if (next_filter) {
2050 ap_filter_t *scan = next_filter;
2051
2052 /* while there are no input filters for a subrequest, we will
2053 * try to insert some, so if we don't have valid data, the code
2054 * will seg fault.
2055 */
2056 rnew->input_filters = r->input_filters;
2057 rnew->proto_input_filters = r->proto_input_filters;
2058 rnew->output_filters = next_filter;
2059 rnew->proto_output_filters = r->proto_output_filters;
2060 while (scan && (scan != r->proto_output_filters)) {
2061 if (scan->frec == ap_subreq_core_filter_handle) {
2062 break;
2063 }
2064 scan = scan->next;
2065 }
2066 if (!scan || scan == r->proto_output_filters) {
2067 ap_add_output_filter_handle(ap_subreq_core_filter_handle,
2068 NULL, rnew, rnew->connection);
2069 }
2070 }
2071 else {
2072 /* If NULL - we are expecting to be internal_fast_redirect'ed

Callers 3

ap_sub_req_method_uriFunction · 0.85
ap_sub_req_lookup_direntFunction · 0.85
ap_sub_req_lookup_fileFunction · 0.85

Calls 5

ap_create_request_configFunction · 0.85
ap_make_method_listFunction · 0.85
ap_copy_method_listFunction · 0.85
ap_set_sub_req_protocolFunction · 0.85

Tested by

no test coverage detected