[wp-trac] [WordPress Trac] #14636: Support wildcard expressions in WP_PROXY_BYPASS_HOSTS (and WP_ACCESSIBLE_HOSTS)

WordPress Trac wp-trac at lists.automattic.com
Sat Aug 21 16:06:00 UTC 2010


#14636: Support wildcard expressions in WP_PROXY_BYPASS_HOSTS (and
WP_ACCESSIBLE_HOSTS)
-------------------------+--------------------------------------------------
 Reporter:  sit          |       Owner:                 
     Type:  enhancement  |      Status:  new            
 Priority:  normal       |   Milestone:  Awaiting Review
Component:  HTTP         |     Version:                 
 Severity:  normal       |    Keywords:                 
-------------------------+--------------------------------------------------

Comment(by jacobsantos):

 .PAC probably not going to be supported any time soon. I suppose would be
 better to setup some filters to allow for the Proxy to have a plugin
 manage it all. Really I think a better algorithm in this specific (and not
 general) case would be as follows:

 {{{
 <?php
 // Only enter this branch when the wildcard is used.
 if( false !== strpos(domain, '*.') ) {
     // '*' is a wildcard, but in preg regex it means nothing on its own.
     // Convert it to its rightful wildcard regex and make it and the
 subdomain
     // optional. We also want to make the wildcard nongreedy to prevent
 matching
     // the entire domain.
     $regex = preg_quote( str_replace('*.', '(.*?\.)?' domain) );
     if( false !== preg_match( '/'.$regex.'/i', domain ) ) {
         return true;
     }
 }

 // Do it the old way.
 }}}

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


More information about the wp-trac mailing list