[wp-trac] [WordPress Trac] #24201: Error in RegEx for proxy excluded URL in function send_through_proxy

WordPress Trac noreply at wordpress.org
Fri Apr 26 13:51:27 UTC 2013


#24201: Error in RegEx for proxy excluded URL in function send_through_proxy
--------------------------+------------------------------
 Reporter:  erich1978     |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  HTTP          |     Version:  3.1
 Severity:  normal        |  Resolution:
 Keywords:                |
--------------------------+------------------------------
Changes (by SergeyBiryukov):

 * version:  3.5.1 => 3.1


Old description:

> Dear WordPress Team,
>
> I've detected a bug in the function send_through_proxy in the class
> WP_HTTP_Proxy. The coded regex for wildcarded domains only works for
> subdomains containing characters (a-zA-Z0-9) and . (dot) but not for
> subdomains containing characters (a-zA-Z0-9) and - (dash).
>
> File: wp-includes/class-http.php around line 1411
>
> Example:
> define(WP_PROXY_BYPASS_HOSTS, '*.example.com');
>
> foo.bar.example.com will not use proxy.
> foo-bar.example.com will use proxy.
>
> POSSIBLE SOLUTION:
> Change the line 1411 from
>      $wildcard_regex[] = str_replace('\*', '[\w.]+?', preg_quote($host,
> '/'));
> to
>      $wildcard_regex[] = str_replace('\*', '[\w.-]+?', preg_quote($host,
> '/'));
>
> [[BR]]
>

> Yours,
> [[BR]]
>

> Erich Lerch

New description:

 Dear WordPress Team,

 I've detected a bug in the function send_through_proxy in the class
 WP_HTTP_Proxy. The coded regex for wildcarded domains only works for
 subdomains containing characters (a-zA-Z0-9) and . (dot) but not for
 subdomains containing characters (a-zA-Z0-9) and - (dash).

 File: wp-includes/class-http.php around line 1411

 Example:
 {{{
 define(WP_PROXY_BYPASS_HOSTS, '*.example.com');
 }}}
 foo.bar.example.com will not use proxy.
 foo-bar.example.com will use proxy.

 POSSIBLE SOLUTION:
 Change the line 1411 from
 {{{
      $wildcard_regex[] = str_replace('\*', '[\w.]+?', preg_quote($host,
 '/'));
 }}}
 to
 {{{
      $wildcard_regex[] = str_replace('\*', '[\w.-]+?', preg_quote($host,
 '/'));
 }}}

 Yours,
 Erich Lerch

--

Comment:

 Related: [15911]

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/24201#comment:1>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list