Changeset 25221
- Timestamp:
- 09/03/2013 08:36:05 AM (13 years ago)
- File:
-
- 1 edited
-
trunk/src/wp-includes/class-http.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-http.php
r25176 r25221 16 16 * WordPress HTTP Class for managing HTTP Transports and making HTTP requests. 17 17 * 18 * This class is called for the functionality of making HTTP requests and replaces Snoopy 19 * functionality. There is no available functionality to add HTTP transport implementations, since 20 * most of the HTTP transports are added and available for use. 21 * 22 * There are no properties, because none are needed and for performance reasons. Some of the 23 * functions are static and while they do have some overhead over functions in PHP4, the purpose is 24 * maintainability. When PHP5 is finally the requirement, it will be easy to add the static keyword 25 * to the code. It is not as easy to convert a function to a method after enough code uses the old 26 * way. 18 * This class is used to consistently make outgoing HTTP requests easy for developers 19 * while still being compatible with the many PHP configurations under which 20 * WordPress runs. 27 21 * 28 22 * Debugging includes several actions, which pass different variables for debugging the HTTP API. … … 43 37 * 44 38 * The only URI that are supported in the HTTP Transport implementation are the HTTP and HTTPS 45 * protocols. HTTP and HTTPS are assumed so the server might not know how to handle the send 46 * headers. Other protocols are unsupported and most likely will fail. 39 * protocols. 47 40 * 48 41 * The defaults are 'method', 'timeout', 'redirection', 'httpversion', 'blocking' and … … 60 53 * value from $wp_version. 61 54 * 62 * 'blocking' is the default, which is used to tell the transport, whether it should halt PHP 63 * while it performs the request or continue regardless. Actually, that isn't entirely correct. 64 * Blocking mode really just means whether the fread should just pull what it can whenever it 65 * gets bytes or if it should wait until it has enough in the buffer to read or finishes reading 66 * the entire content. It doesn't actually always mean that PHP will continue going after making 67 * the request. 55 * The 'blocking' parameter can be used to specify if the calling code requires the result of 56 * the HTTP request. If set to false, the request will be sent to the remote server, and 57 * processing returned to the calling code immediately, the caller will know if the request 58 * suceeded or failed, but will not receive any response from the remote server. 68 59 * 69 60 * @access public 70 61 * @since 2.7.0 71 * @todo Refactor this code. The code in this method extends the scope of its original purpose72 * and should be refactored to allow for cleaner abstraction and reduce duplication of the73 * code. One suggestion is to create a class specifically for the arguments, however74 * preliminary refactoring to this affect has affect more than just the scope of the75 * arguments. Something to ponder at least.76 62 * 77 63 * @param string $url URI resource. … … 254 240 * The order for non-blocking requests is cURL, Streams and Fsockopen(). 255 241 * 256 * There are currently issues with "localhost" not resolving correctly with DNS. This may cause257 * an error "failed to open stream: A connection attempt failed because the connected party did258 * not properly respond after a period of time, or established connection failed because [the]259 * connected host has failed to respond."260 *261 242 * @since 3.2.0 262 243 * @access private … … 523 504 return false; 524 505 525 // parse_url() only handles http, https type URLs, and will emit E_WARNING on failure. 526 // This will be displayed on blogs, which is not reasonable. 527 $check = @parse_url($uri); 528 529 /* Malformed URL, can not process, but this could mean ssl, so let through anyway. 530 * 531 * This isn't very security sound. There are instances where a hacker might attempt 532 * to bypass the proxy and this check. However, the reason for this behavior is that 533 * WordPress does not do any checking currently for non-proxy requests, so it is keeps with 534 * the default unsecure nature of the HTTP request. 535 */ 536 if ( $check === false ) 537 return false; 506 $check = parse_url($uri); 507 if ( ! $check ) 508 return true; 538 509 539 510 $home = parse_url( get_option('siteurl') );
Note: See TracChangeset
for help on using the changeset viewer.