1
0
mirror of https://github.com/apache/httpd.git synced 2025-08-08 15:02:10 +03:00

strncmp(r->filename, "proxy:", 6) is faster than a

note. Plus, allows for checking even if not due to
rewrite.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1588544 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jim Jagielski
2014-04-18 19:21:35 +00:00
parent 9ba346e885
commit 2aa898bb2f
3 changed files with 1 additions and 6 deletions

View File

@@ -4193,7 +4193,6 @@ static int apply_rewrite_rule(rewriterule_entry *p, rewrite_ctx *ctx)
r->filename)); r->filename));
r->filename = apr_pstrcat(r->pool, "proxy:", r->filename, NULL); r->filename = apr_pstrcat(r->pool, "proxy:", r->filename, NULL);
apr_table_setn(r->notes, "rewrite-proxy", "1");
return 1; return 1;
} }

View File

@@ -938,7 +938,6 @@ static int proxy_handler(request_rec *r)
strncmp(r->filename, "proxy:", 6) != 0) { strncmp(r->filename, "proxy:", 6) != 0) {
r->proxyreq = PROXYREQ_REVERSE; r->proxyreq = PROXYREQ_REVERSE;
r->filename = apr_pstrcat(r->pool, r->handler, r->filename, NULL); r->filename = apr_pstrcat(r->pool, r->handler, r->filename, NULL);
apr_table_setn(r->notes, "rewrite-proxy", "1");
} }
else { else {
return DECLINED; return DECLINED;

View File

@@ -1949,11 +1949,8 @@ PROXY_DECLARE(int) ap_proxy_pre_request(proxy_worker **worker,
* In the case of the generic reverse proxy, we need to see if we * In the case of the generic reverse proxy, we need to see if we
* were passed a UDS url (eg: from mod_proxy) and adjust uds_path * were passed a UDS url (eg: from mod_proxy) and adjust uds_path
* as required. * as required.
*
* NOTE: Here we use a quick note lookup, but we could also
* check to see if r->filename starts with 'proxy:'
*/ */
if (apr_table_get(r->notes, "rewrite-proxy") && if (!strncmp(r->filename, "proxy:", 6) &&
(ptr2 = ap_strcasestr(r->filename, "unix:")) && (ptr2 = ap_strcasestr(r->filename, "unix:")) &&
(ptr = ap_strchr(ptr2, '|'))) { (ptr = ap_strchr(ptr2, '|'))) {
apr_uri_t urisock; apr_uri_t urisock;