| 2240 | } |
| 2241 | |
| 2242 | AP_DECLARE(request_rec *) ap_sub_req_method_uri(const char *method, |
| 2243 | const char *new_uri, |
| 2244 | const request_rec *r, |
| 2245 | ap_filter_t *next_filter) |
| 2246 | { |
| 2247 | request_rec *rnew; |
| 2248 | /* Initialise res, to avoid a gcc warning */ |
| 2249 | int res = HTTP_INTERNAL_SERVER_ERROR; |
| 2250 | char *udir; |
| 2251 | |
| 2252 | rnew = make_sub_request(r, next_filter); |
| 2253 | |
| 2254 | /* would be nicer to pass "method" to ap_set_sub_req_protocol */ |
| 2255 | rnew->method = method; |
| 2256 | rnew->method_number = ap_method_number_of(method); |
| 2257 | |
| 2258 | if (new_uri[0] == '/') { |
| 2259 | ap_parse_uri(rnew, new_uri); |
| 2260 | } |
| 2261 | else { |
| 2262 | udir = ap_make_dirstr_parent(rnew->pool, r->uri); |
| 2263 | udir = ap_escape_uri(rnew->pool, udir); /* re-escape it */ |
| 2264 | ap_parse_uri(rnew, ap_make_full_path(rnew->pool, udir, new_uri)); |
| 2265 | } |
| 2266 | |
| 2267 | /* We cannot return NULL without violating the API. So just turn this |
| 2268 | * subrequest into a 500 to indicate the failure. */ |
| 2269 | if (ap_is_recursion_limit_exceeded(r)) { |
| 2270 | rnew->status = HTTP_INTERNAL_SERVER_ERROR; |
| 2271 | return rnew; |
| 2272 | } |
| 2273 | |
| 2274 | /* lookup_uri |
| 2275 | * If the content can be served by the quick_handler, we can |
| 2276 | * safely bypass request_internal processing. |
| 2277 | * |
| 2278 | * If next_filter is NULL we are expecting to be |
| 2279 | * internal_fast_redirect'ed to the subrequest, or the subrequest will |
| 2280 | * never be invoked. We need to make sure that the quickhandler is not |
| 2281 | * invoked by any lookups. Since an internal_fast_redirect will always |
| 2282 | * occur too late for the quickhandler to handle the request. |
| 2283 | */ |
| 2284 | if (next_filter) { |
| 2285 | res = ap_run_quick_handler(rnew, 1); |
| 2286 | } |
| 2287 | |
| 2288 | if (next_filter == NULL || res != OK) { |
| 2289 | if ((res = ap_process_request_internal(rnew))) { |
| 2290 | rnew->status = res; |
| 2291 | } |
| 2292 | } |
| 2293 | |
| 2294 | return rnew; |
| 2295 | } |
| 2296 | |
| 2297 | AP_DECLARE(request_rec *) ap_sub_req_lookup_uri(const char *new_uri, |
| 2298 | const request_rec *r, |
no test coverage detected