| 2621 | } |
| 2622 | |
| 2623 | PROXY_DECLARE(int) ap_proxy_pre_request(proxy_worker **worker, |
| 2624 | proxy_balancer **balancer, |
| 2625 | request_rec *r, |
| 2626 | proxy_server_conf *conf, char **url) |
| 2627 | { |
| 2628 | int access_status; |
| 2629 | |
| 2630 | access_status = proxy_run_pre_request(worker, balancer, r, conf, url); |
| 2631 | if (access_status == DECLINED && *balancer == NULL) { |
| 2632 | /* UDS path stripped from *url by proxy_fixup() already */ |
| 2633 | *worker = ap_proxy_get_worker_ex(r->pool, NULL, conf, *url, |
| 2634 | AP_PROXY_WORKER_NO_UDS); |
| 2635 | if (*worker) { |
| 2636 | ap_log_rerror(APLOG_MARK, APLOG_TRACE2, 0, r, |
| 2637 | "%s: found worker %s for %s", |
| 2638 | (*worker)->s->scheme, (*worker)->s->name_ex, *url); |
| 2639 | access_status = OK; |
| 2640 | } |
| 2641 | else if (r->proxyreq == PROXYREQ_PROXY) { |
| 2642 | if (conf->forward) { |
| 2643 | ap_log_rerror(APLOG_MARK, APLOG_TRACE2, 0, r, |
| 2644 | "*: found forward proxy worker for %s", *url); |
| 2645 | *worker = conf->forward; |
| 2646 | access_status = OK; |
| 2647 | /* |
| 2648 | * The forward worker does not keep connections alive, so |
| 2649 | * ensure that mod_proxy_http does the correct thing |
| 2650 | * regarding the Connection header in the request. |
| 2651 | */ |
| 2652 | apr_table_setn(r->subprocess_env, "proxy-nokeepalive", "1"); |
| 2653 | } |
| 2654 | } |
| 2655 | else if (r->proxyreq == PROXYREQ_REVERSE) { |
| 2656 | if (conf->reverse) { |
| 2657 | ap_log_rerror(APLOG_MARK, APLOG_TRACE2, 0, r, |
| 2658 | "*: using default reverse proxy worker for %s " |
| 2659 | "(no keepalive)", *url); |
| 2660 | *worker = conf->reverse; |
| 2661 | access_status = OK; |
| 2662 | /* |
| 2663 | * The reverse worker does not keep connections alive, so |
| 2664 | * ensure that mod_proxy_http does the correct thing |
| 2665 | * regarding the Connection header in the request. |
| 2666 | */ |
| 2667 | apr_table_setn(r->subprocess_env, "proxy-nokeepalive", "1"); |
| 2668 | } |
| 2669 | } |
| 2670 | } |
| 2671 | else if (access_status == DECLINED && *balancer != NULL) { |
| 2672 | /* All the workers are busy */ |
| 2673 | ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(00934) |
| 2674 | "all workers are busy. Unable to serve %s", *url); |
| 2675 | access_status = HTTP_SERVICE_UNAVAILABLE; |
| 2676 | } |
| 2677 | |
| 2678 | return access_status; |
| 2679 | } |
| 2680 |
no test coverage detected