WordPress.org

Make WordPress Core

Ticket #39043: 30943.patch

File 30943.patch, 2.3 KB (added by lots.0.logs, 5 years ago)
  • src/wp-includes/class-http.php

    diff --git a/src/wp-includes/class-http.php b/src/wp-includes/class-http.php
    index b9f5ab5..094c328 100644
    a b class WP_Http { 
    135135         *     @type string       sslcertificates      Absolute path to an SSL certificate .crt file.
    136136         *                                             Default ABSPATH . WPINC . '/certificates/ca-bundle.crt'.
    137137         *     @type bool         $stream              Whether to stream to a file. If set to true and no filename was
    138          *                                             given, it will be droped it in the WP temp dir and its name will
    139          *                                             be set using the basename of the URL. Default false.
     138         *                                             given, the stream will be output to a new file in the WP temp dir
     139         *                                             using a name generated from the basename of the URL. Default false.
    140140         *     @type string       $filename            Filename of the file to write to when streaming. $stream must be
    141141         *                                             set to true. Default null.
    142142         *     @type int          $limit_response_size Size in bytes to limit the response to. Default null.
     143         *     @type bool|null    $data_format         How the `$data` should be sent ('query' or 'body'). Default null.
     144         *                                             If null, data will be sent as 'query' for HEAD/GET and as
     145         *                                             'body' for POST/PUT/OPTIONS/PATCH/DELETE.
    143146         *
    144147         * }
    145148         * @return array|WP_Error Array containing 'headers', 'body', 'response', 'cookies', 'filename'.
    class WP_Http { 
    202205                        'stream' => false,
    203206                        'filename' => null,
    204207                        'limit_response_size' => null,
     208                        'data_format' => null,
    205209                );
    206210
    207211                // Pre-parse for the HEAD checks.
    class WP_Http { 
    333337                        $options['verify'] = $r['sslcertificates'];
    334338                }
    335339
    336                 // All non-GET/HEAD requests should put the arguments in the form body.
    337                 if ( 'HEAD' !== $type && 'GET' !== $type ) {
     340                if ( null !== $r['data_format'] ) {
     341                        $options['data_format'] = $r['data_format'];
     342
     343                } elseif ( 'HEAD' !== $type && 'GET' !== $type ) {
     344                        // All non-GET/HEAD requests should put the arguments in the form body.
    338345                        $options['data_format'] = 'body';
    339346                }
    340347