[wp-trac] Re: [WordPress Trac] #4779: Proposal for HTTP POST and REQUEST API

WordPress Trac wp-trac at lists.automattic.com
Mon Aug 4 01:47:26 GMT 2008


#4779: Proposal for HTTP POST and REQUEST API
-------------------------------------------+--------------------------------
 Reporter:  darkdragon                     |        Owner:  jacobsantos
     Type:  enhancement                    |       Status:  new        
 Priority:  normal                         |    Milestone:  2.7        
Component:  Optimization                   |      Version:             
 Severity:  normal                         |   Resolution:             
 Keywords:  has-patch tested dev-feedback  |  
-------------------------------------------+--------------------------------
Comment (by DD32):

 > DD32: Would a simple str_replace('localhost', '127.0.0.1', $host); work?

 Maybe {{{str_replace('http://localhost/', 'http://127.0.0.1/', $url); }}}
 would work, But that has the side effect that the HOST header will
 probably be set wrong..

 With FSockOpen its a simple fix, Just replace the hostname to connect to
 with localhost, But with FOpen/ExtHTTP/Streams i dont think you can set
 the hostname and the IP to connect to seperately. I have a feeling just
 substituting 127.0.0.1 for localhost would probably work in 95% of cases,
 the other 5% there probably isnt a particuallly clean method.

 Any comments on: {{{ attachment 4779.encode.post.data.2.diff added. }}} ?
 The header thing is probably not the best on second thoughts, maybe
 something like the following, but the Encoding of the data should be fine
 (Which is exactly whats in {{{attachment 4779.encode.post.data.diff
 added.}}}}

 {{{
 if ( is_null($headers) )
 $headers = array();

 if ( ! is_array($headers) ) {
 $headers = <process headers>();
 }
 }}}

-- 
Ticket URL: <http://trac.wordpress.org/ticket/4779#comment:84>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list