* This handles ajp:// URLs */
| 769 | * This handles ajp:// URLs |
| 770 | */ |
| 771 | static int proxy_ajp_handler(request_rec *r, proxy_worker *worker, |
| 772 | proxy_server_conf *conf, |
| 773 | char *url, const char *proxyname, |
| 774 | apr_port_t proxyport) |
| 775 | { |
| 776 | int status; |
| 777 | char server_portstr[32]; |
| 778 | conn_rec *origin = NULL; |
| 779 | proxy_conn_rec *backend = NULL; |
| 780 | const char *scheme = "AJP"; |
| 781 | int retry; |
| 782 | proxy_dir_conf *dconf = ap_get_module_config(r->per_dir_config, |
| 783 | &proxy_module); |
| 784 | apr_pool_t *p = r->pool; |
| 785 | apr_uri_t *uri; |
| 786 | |
| 787 | if (ap_cstr_casecmpn(url, "ajp:", 4) != 0) { |
| 788 | ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(00894) "declining URL %s", url); |
| 789 | return DECLINED; |
| 790 | } |
| 791 | |
| 792 | uri = apr_palloc(p, sizeof(*uri)); |
| 793 | ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(00895) "serving URL %s", url); |
| 794 | |
| 795 | /* create space for state information */ |
| 796 | status = ap_proxy_acquire_connection(scheme, &backend, worker, |
| 797 | r->server); |
| 798 | if (status != OK) { |
| 799 | if (backend) { |
| 800 | backend->close = 1; |
| 801 | ap_proxy_release_connection(scheme, backend, r->server); |
| 802 | } |
| 803 | return status; |
| 804 | } |
| 805 | |
| 806 | backend->is_ssl = 0; |
| 807 | backend->close = 0; |
| 808 | |
| 809 | retry = 0; |
| 810 | while (retry < 2) { |
| 811 | char *locurl = url; |
| 812 | /* Step One: Determine Who To Connect To */ |
| 813 | status = ap_proxy_determine_connection(p, r, conf, worker, backend, |
| 814 | uri, &locurl, proxyname, proxyport, |
| 815 | server_portstr, |
| 816 | sizeof(server_portstr)); |
| 817 | |
| 818 | if (status != OK) |
| 819 | break; |
| 820 | |
| 821 | /* Step Two: Make the Connection */ |
| 822 | if (ap_proxy_check_connection(scheme, backend, r->server, 0, |
| 823 | PROXY_CHECK_CONN_EMPTY) |
| 824 | && ap_proxy_connect_backend(scheme, backend, worker, |
| 825 | r->server)) { |
| 826 | ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(00896) |
| 827 | "failed to make connection to backend: %s", |
| 828 | backend->hostname); |
nothing calls this directly
no test coverage detected