On 9/3/21 6:52 PM, yla...@apache.org wrote:
> Author: ylavic
> Date: Fri Sep  3 16:52:38 2021
> New Revision: 1892874
> 
> URL: http://svn.apache.org/viewvc?rev=1892874&view=rev
> Log:
> Merge r1892814, r1892853 from trunk:
> 
> mod_proxy: Faster unix socket path parsing in the "proxy:" URL.
> 
> The actual r->filename format is "[proxy:]unix:path|url" for UDS, no need to
> strstr(,"unix:") since it's at the start of the string.
> 
> 
> mod_proxy: Follow up to r1892814.
> 
> Save some few cycles in ap_proxy_de_socketfy() too.
> 
> 
> Submitted by: ylavic
> Reviewed by: ylavic, covener, rpluem
> 
> Added:
>     httpd/httpd/branches/2.4.x/changes-entries/fix_uds_filename.txt
>       - copied unchanged from r1892814, 
> httpd/httpd/trunk/changes-entries/fix_uds_filename.txt
> Modified:
>     httpd/httpd/branches/2.4.x/   (props changed)
>     httpd/httpd/branches/2.4.x/modules/proxy/mod_proxy.c
>     httpd/httpd/branches/2.4.x/modules/proxy/proxy_util.c
> 
> Propchange: httpd/httpd/branches/2.4.x/
> ------------------------------------------------------------------------------
>   Merged /httpd/httpd/trunk:r1892814,1892853
> 
> Modified: httpd/httpd/branches/2.4.x/modules/proxy/mod_proxy.c
> URL: 
> http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/modules/proxy/mod_proxy.c?rev=1892874&r1=1892873&r2=1892874&view=diff
> ==============================================================================
> --- httpd/httpd/branches/2.4.x/modules/proxy/mod_proxy.c (original)
> +++ httpd/httpd/branches/2.4.x/modules/proxy/mod_proxy.c Fri Sep  3 16:52:38 
> 2021
> @@ -1975,7 +1975,7 @@ PROXY_DECLARE(const char *) ap_proxy_de_
>       * the UDS path... ignore it
>       */
>      if (!ap_cstr_casecmpn(url, "unix:", 5) &&
> -        ((ptr = ap_strchr_c(url, '|')) != NULL)) {
> +        ((ptr = ap_strchr_c(url + 5, '|')) != NULL)) {
>          /* move past the 'unix:...|' UDS path info */
>          const char *ret, *c;
>  
> 
> Modified: httpd/httpd/branches/2.4.x/modules/proxy/proxy_util.c
> URL: 
> http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/modules/proxy/proxy_util.c?rev=1892874&r1=1892873&r2=1892874&view=diff
> ==============================================================================
> --- httpd/httpd/branches/2.4.x/modules/proxy/proxy_util.c (original)
> +++ httpd/httpd/branches/2.4.x/modules/proxy/proxy_util.c Fri Sep  3 16:52:38 
> 2021
> @@ -2281,8 +2281,8 @@ static void fix_uds_filename(request_rec
>      if (!r || !r->filename) return;
>  
>      if (!strncmp(r->filename, "proxy:", 6) &&
> -            (ptr2 = ap_strcasestr(r->filename, "unix:")) &&
> -            (ptr = ap_strchr(ptr2, '|'))) {
> +            !ap_cstr_casecmpn(r->filename + 6, "unix:", 5) &&
> +            (ptr2 = r->filename + 6 + 5, ptr = ap_strchr(ptr2, '|'))) {

I know that I voted for it to be backported, but after rethinking this 
shouldn't this be

(ptr2 = r->filename + 6, ptr = ap_strchr(ptr2 + 5, '|')))

as ptr2 is later used in

        rv = apr_uri_parse(r->pool, ptr2, &urisock);

With the old code and with my proposal above ptr2 points to the 'u' of 'unix:' 
with the current code it points to the char after
'unix:' likely //.

Regards

RĂ¼diger

Reply via email to