Detect if an absoluteURI should be proxied or not. Note that we * have to do this during this phase because later phases are * "short-circuiting"... i.e. translate_names will end when the first * module returns OK. So for example, if the request is something like: * * GET http://othervhost/cgi-bin/printenv HTTP/1.0 * * mod_alias will notice the /cgi-bin part and ScriptAlias it and * shor
| 789 | * configuration file. |
| 790 | */ |
| 791 | static int proxy_detect(request_rec *r) |
| 792 | { |
| 793 | void *sconf = r->server->module_config; |
| 794 | proxy_server_conf *conf = |
| 795 | (proxy_server_conf *) ap_get_module_config(sconf, &proxy_module); |
| 796 | |
| 797 | /* Ick... msvc (perhaps others) promotes ternary short results to int */ |
| 798 | |
| 799 | if (conf->req && r->parsed_uri.scheme) { |
| 800 | /* but it might be something vhosted */ |
| 801 | if (!r->parsed_uri.hostname |
| 802 | || ap_cstr_casecmp(r->parsed_uri.scheme, ap_http_scheme(r)) != 0 |
| 803 | || !ap_matches_request_vhost(r, r->parsed_uri.hostname, |
| 804 | (apr_port_t)(r->parsed_uri.port_str |
| 805 | ? r->parsed_uri.port |
| 806 | : ap_default_port(r)))) { |
| 807 | r->proxyreq = PROXYREQ_PROXY; |
| 808 | r->uri = r->unparsed_uri; |
| 809 | r->filename = apr_pstrcat(r->pool, "proxy:", r->uri, NULL); |
| 810 | r->handler = "proxy-server"; |
| 811 | } |
| 812 | } |
| 813 | /* We need special treatment for CONNECT proxying: it has no scheme part */ |
| 814 | else if (conf->req && r->method_number == M_CONNECT |
| 815 | && r->parsed_uri.hostname |
| 816 | && r->parsed_uri.port_str) { |
| 817 | r->proxyreq = PROXYREQ_PROXY; |
| 818 | r->uri = r->unparsed_uri; |
| 819 | r->filename = apr_pstrcat(r->pool, "proxy:", r->uri, NULL); |
| 820 | r->handler = "proxy-server"; |
| 821 | } |
| 822 | return DECLINED; |
| 823 | } |
| 824 | |
| 825 | PROXY_DECLARE(int) ap_proxy_trans_match(request_rec *r, struct proxy_alias *ent, |
| 826 | proxy_dir_conf *dconf) |
nothing calls this directly
no test coverage detected