You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ji...@apache.org on 2014/04/18 21:21:35 UTC

svn commit: r1588544 - in /httpd/httpd/trunk/modules: mappers/mod_rewrite.c proxy/mod_proxy.c proxy/proxy_util.c

Author: jim
Date: Fri Apr 18 19:21:35 2014
New Revision: 1588544

URL: http://svn.apache.org/r1588544
Log:
strncmp(r->filename, "proxy:", 6) is faster than a
note. Plus, allows for checking even if not due to
rewrite.

Modified:
    httpd/httpd/trunk/modules/mappers/mod_rewrite.c
    httpd/httpd/trunk/modules/proxy/mod_proxy.c
    httpd/httpd/trunk/modules/proxy/proxy_util.c

Modified: httpd/httpd/trunk/modules/mappers/mod_rewrite.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/mappers/mod_rewrite.c?rev=1588544&r1=1588543&r2=1588544&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/mappers/mod_rewrite.c (original)
+++ httpd/httpd/trunk/modules/mappers/mod_rewrite.c Fri Apr 18 19:21:35 2014
@@ -4193,7 +4193,6 @@ static int apply_rewrite_rule(rewriterul
                     r->filename));
 
         r->filename = apr_pstrcat(r->pool, "proxy:", r->filename, NULL);
-        apr_table_setn(r->notes, "rewrite-proxy", "1");
         return 1;
     }
 

Modified: httpd/httpd/trunk/modules/proxy/mod_proxy.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/mod_proxy.c?rev=1588544&r1=1588543&r2=1588544&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/proxy/mod_proxy.c (original)
+++ httpd/httpd/trunk/modules/proxy/mod_proxy.c Fri Apr 18 19:21:35 2014
@@ -938,7 +938,6 @@ static int proxy_handler(request_rec *r)
             strncmp(r->filename, "proxy:", 6) != 0) {
             r->proxyreq = PROXYREQ_REVERSE;
             r->filename = apr_pstrcat(r->pool, r->handler, r->filename, NULL);
-            apr_table_setn(r->notes, "rewrite-proxy", "1");
         }
         else {
             return DECLINED;

Modified: httpd/httpd/trunk/modules/proxy/proxy_util.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/proxy_util.c?rev=1588544&r1=1588543&r2=1588544&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/proxy/proxy_util.c (original)
+++ httpd/httpd/trunk/modules/proxy/proxy_util.c Fri Apr 18 19:21:35 2014
@@ -1949,11 +1949,8 @@ PROXY_DECLARE(int) ap_proxy_pre_request(
                  * 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
                  * 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:")) &&
                     (ptr = ap_strchr(ptr2, '|'))) {
                     apr_uri_t urisock;



Re: svn commit: r1588544 - in /httpd/httpd/trunk/modules: mappers/mod_rewrite.c proxy/mod_proxy.c proxy/proxy_util.c

Posted by Jim Jagielski <ji...@jaguNET.com>.
This is based on my testing in CentOS and OSX, and
it's because when using a note, we need to generate
a key, and thus we need to go thru each char of
the key string; it's quicker to instead check 6 chars
for equiv.

I saw no regressions... but more eyes will help in
verifying/confirming that :)

On Apr 18, 2014, at 3:21 PM, jim@apache.org wrote:

> Author: jim
> Date: Fri Apr 18 19:21:35 2014
> New Revision: 1588544
> 
> URL: http://svn.apache.org/r1588544
> Log:
> strncmp(r->filename, "proxy:", 6) is faster than a
> note. Plus, allows for checking even if not due to
> rewrite.
> 
> Modified:
>    httpd/httpd/trunk/modules/mappers/mod_rewrite.c
>    httpd/httpd/trunk/modules/proxy/mod_proxy.c
>    httpd/httpd/trunk/modules/proxy/proxy_util.c
> 
> Modified: httpd/httpd/trunk/modules/mappers/mod_rewrite.c
> URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/mappers/mod_rewrite.c?rev=1588544&r1=1588543&r2=1588544&view=diff
> ==============================================================================
> --- httpd/httpd/trunk/modules/mappers/mod_rewrite.c (original)
> +++ httpd/httpd/trunk/modules/mappers/mod_rewrite.c Fri Apr 18 19:21:35 2014
> @@ -4193,7 +4193,6 @@ static int apply_rewrite_rule(rewriterul
>                     r->filename));
> 
>         r->filename = apr_pstrcat(r->pool, "proxy:", r->filename, NULL);
> -        apr_table_setn(r->notes, "rewrite-proxy", "1");
>         return 1;
>     }
> 
> 
> Modified: httpd/httpd/trunk/modules/proxy/mod_proxy.c
> URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/mod_proxy.c?rev=1588544&r1=1588543&r2=1588544&view=diff
> ==============================================================================
> --- httpd/httpd/trunk/modules/proxy/mod_proxy.c (original)
> +++ httpd/httpd/trunk/modules/proxy/mod_proxy.c Fri Apr 18 19:21:35 2014
> @@ -938,7 +938,6 @@ static int proxy_handler(request_rec *r)
>             strncmp(r->filename, "proxy:", 6) != 0) {
>             r->proxyreq = PROXYREQ_REVERSE;
>             r->filename = apr_pstrcat(r->pool, r->handler, r->filename, NULL);
> -            apr_table_setn(r->notes, "rewrite-proxy", "1");
>         }
>         else {
>             return DECLINED;
> 
> Modified: httpd/httpd/trunk/modules/proxy/proxy_util.c
> URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/proxy_util.c?rev=1588544&r1=1588543&r2=1588544&view=diff
> ==============================================================================
> --- httpd/httpd/trunk/modules/proxy/proxy_util.c (original)
> +++ httpd/httpd/trunk/modules/proxy/proxy_util.c Fri Apr 18 19:21:35 2014
> @@ -1949,11 +1949,8 @@ PROXY_DECLARE(int) ap_proxy_pre_request(
>                  * 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
>                  * 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:")) &&
>                     (ptr = ap_strchr(ptr2, '|'))) {
>                     apr_uri_t urisock;
> 
>