WordPress.org

Make WordPress Core

Opened 12 months ago

Last modified 8 months ago

#24201 closed defect (bug)

Error in RegEx for proxy excluded URL in function send_through_proxy — at Version 1

Reported by: erich1978 Owned by:
Milestone: 3.7 Priority: normal
Severity: normal Version: 3.1
Component: HTTP API Keywords:
Focuses: Cc:

Description (last modified by SergeyBiryukov)

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

Change History (1)

comment:1 SergeyBiryukov12 months ago

  • Description modified (diff)
  • Version changed from 3.5.1 to 3.1

Related: [15911]

Note: See TracTickets for help on using tickets.