Make WordPress Core

Changeset 25221


Ignore:
Timestamp:
09/03/2013 08:36:05 AM (13 years ago)
Author:
dd32
Message:

WP_HTTP: Clean up some comments style and remove outdated information.
The change to the proxy block here is for consistency, WP_HTTP_Proxy::block_request() is never called before parse_url() has successfully operated on the URL, and in the event we cannot read the URL, it shouldn't be requested.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-http.php

    r25176 r25221  
    1616 * WordPress HTTP Class for managing HTTP Transports and making HTTP requests.
    1717 *
    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.
    2721 *
    2822 * Debugging includes several actions, which pass different variables for debugging the HTTP API.
     
    4337     *
    4438     * 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.
    4740     *
    4841     * The defaults are 'method', 'timeout', 'redirection', 'httpversion', 'blocking' and
     
    6053     * value from $wp_version.
    6154     *
    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.
    6859     *
    6960     * @access public
    7061     * @since 2.7.0
    71      * @todo Refactor this code. The code in this method extends the scope of its original purpose
    72      *      and should be refactored to allow for cleaner abstraction and reduce duplication of the
    73      *      code. One suggestion is to create a class specifically for the arguments, however
    74      *      preliminary refactoring to this affect has affect more than just the scope of the
    75      *      arguments. Something to ponder at least.
    7662     *
    7763     * @param string $url URI resource.
     
    254240     * The order for non-blocking requests is cURL, Streams and Fsockopen().
    255241     *
    256      * There are currently issues with "localhost" not resolving correctly with DNS. This may cause
    257      * an error "failed to open stream: A connection attempt failed because the connected party did
    258      * not properly respond after a period of time, or established connection failed because [the]
    259      * connected host has failed to respond."
    260      *
    261242     * @since 3.2.0
    262243     * @access private
     
    523504            return false;
    524505
    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;
    538509
    539510        $home = parse_url( get_option('siteurl') );
Note: See TracChangeset for help on using the changeset viewer.