WordPress.org

Make WordPress Core

Ticket #25747: 25747.3.diff

File 25747.3.diff, 1.8 KB (added by johnbillion, 6 months ago)
  • src/wp-includes/class-http.php

    diff --git a/src/wp-includes/class-http.php b/src/wp-includes/class-http.php
    index 2a458eb705..421a5f9fc5 100644
    a b class WP_Http { 
    272272                $arrURL = @parse_url( $url );
    273273
    274274                if ( empty( $url ) || empty( $arrURL['scheme'] ) ) {
    275                         return new WP_Error( 'http_request_failed', __( 'A valid URL was not provided.' ) );
     275                        $response = new WP_Error( 'http_request_failed', __( 'A valid URL was not provided.' ) );
     276                        /** This action is documented in wp-includes/class-http.php */
     277                        do_action( 'http_api_debug', $response, 'response', 'Requests', $r, $url );
     278                        return $response;
    276279                }
    277280
    278281                if ( $this->block_request( $url ) ) {
    279                         return new WP_Error( 'http_request_failed', __( 'User has blocked requests through HTTP.' ) );
     282                        $response = new WP_Error( 'http_request_blocked', __( 'User has blocked requests through HTTP.' ) );
     283                        /** This action is documented in wp-includes/class-http.php */
     284                        do_action( 'http_api_debug', $response, 'response', 'Requests', $r, $url );
     285                        return $response;
    280286                }
    281287
    282288                // If we are streaming to a file but no filename was given drop it in the WP temp dir
    class WP_Http { 
    289295                        // Force some settings if we are streaming to a file and check for existence and perms of destination directory
    290296                        $r['blocking'] = true;
    291297                        if ( ! wp_is_writable( dirname( $r['filename'] ) ) ) {
    292                                 return new WP_Error( 'http_request_failed', __( 'Destination directory for file streaming does not exist or is not writable.' ) );
     298                                $response = new WP_Error( 'http_request_failed', __( 'Destination directory for file streaming does not exist or is not writable.' ) );
     299                                /** This action is documented in wp-includes/class-http.php */
     300                                do_action( 'http_api_debug', $response, 'response', 'Requests', $r, $url );
     301                                return $response;
    293302                        }
    294303                }
    295304