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

Function ap_invoke_handler

server/config.c:389–470  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

387}
388
389AP_CORE_DECLARE(int) ap_invoke_handler(request_rec *r)
390{
391 const char *handler;
392 const char *p;
393 int result;
394 const char *old_handler = r->handler;
395 const char *ignore;
396
397 /*
398 * The new insert_filter stage makes the most sense here. We only use
399 * it when we are going to run the request, so we must insert filters
400 * if any are available. Since the goal of this phase is to allow all
401 * modules to insert a filter if they want to, this filter returns
402 * void. I just can't see any way that this filter can reasonably
403 * fail, either your modules inserts something or it doesn't. rbb
404 */
405 ap_run_insert_filter(r);
406
407 /* Before continuing, allow each filter that is in the two chains to
408 * run their init function to let them do any magic before we could
409 * start generating data.
410 */
411 result = invoke_filter_init(r, r->input_filters);
412 if (result != OK) {
413 return result;
414 }
415 result = invoke_filter_init(r, r->output_filters);
416 if (result != OK) {
417 return result;
418 }
419
420 if (!r->handler) {
421 if (r->content_type && AP_REQUEST_IS_TRUSTED_CT(r)) {
422 handler = r->content_type;
423 if ((p=ap_strchr_c(handler, ';')) != NULL) {
424 char *new_handler = (char *)apr_pmemdup(r->pool, handler,
425 p - handler + 1);
426 char *p2 = new_handler + (p - handler);
427 handler = new_handler;
428
429 /* exclude media type arguments */
430 while (p2 > handler && p2[-1] == ' ')
431 --p2; /* strip trailing spaces */
432
433 *p2='\0';
434 }
435 }
436 else {
437 handler = AP_DEFAULT_HANDLER_NAME;
438 }
439
440 r->handler = handler;
441 }
442
443 result = ap_run_handler(r);
444
445 r->handler = old_handler;
446

Callers 5

ap_process_async_requestFunction · 0.85
ap_internal_redirectFunction · 0.85
ap_run_sub_reqFunction · 0.85
http_config.hFile · 0.85

Calls 2

invoke_filter_initFunction · 0.85
ap_strchr_cFunction · 0.85

Tested by

no test coverage detected