Make WordPress Core


Ignore:
Timestamp:
05/11/2021 07:40:41 PM (5 years ago)
Author:
desrosj
Message:

External Libraries: Update the Requests library to version 1.8.0.

While some of the changes in the 1.8.0 release have already been copied to WordPress Core in earlier releases (see [38727], [46258], [47902] and [49382]), this release contains additional improvements, including:

  • A significant performance fix when using cURL.
  • Improved compliance with RFC2616.

The library has also been moved under the WordPress project’s GitHub organization and can now be found at ​https://github.com/WordPress/Requests.

Props jrf, dd32, rmccue, justinahinon, netweb, schlessera, TimothyBJacobs, soulseekah, ozh, skithund, carlalexander, travisnorthcutt, desrosj.
Fixes #53101.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/Requests/Cookie.php

    r46586 r50842  
    6666         */
    6767        public function __construct($name, $value, $attributes = array(), $flags = array(), $reference_time = null) {
    68                 $this->name = $name;
    69                 $this->value = $value;
     68                $this->name       = $name;
     69                $this->value      = $value;
    7070                $this->attributes = $attributes;
    71                 $default_flags = array(
    72                         'creation' => time(),
     71                $default_flags    = array(
     72                        'creation'    => time(),
    7373                        'last-access' => time(),
    74                         'persistent' => false,
    75                         'host-only' => true,
     74                        'persistent'  => false,
     75                        'host-only'   => true,
    7676                );
    77                 $this->flags = array_merge($default_flags, $flags);
     77                $this->flags      = array_merge($default_flags, $flags);
    7878
    7979                $this->reference_time = time();
    … …  
    229229                foreach ($this->attributes as $key => $value) {
    230230                        $orig_value = $value;
    231                         $value = $this->normalize_attribute($key, $value);
     231                        $value      = $this->normalize_attribute($key, $value);
    232232                        if ($value === null) {
    233233                                unset($this->attributes[$key]);
    … …  
    386386         */
    387387        public static function parse($string, $name = '', $reference_time = null) {
    388                 $parts = explode(';', $string);
     388                $parts   = explode(';', $string);
    389389                $kvparts = array_shift($parts);
    390390
    … …  
    398398                        //
    399399                        // https://bugzilla.mozilla.org/show_bug.cgi?id=169091
    400                         $name = '';
     400                        $name  = '';
    401401                        $value = $kvparts;
    402402                }
    … …  
    404404                        list($name, $value) = explode('=', $kvparts, 2);
    405405                }
    406                 $name = trim($name);
     406                $name  = trim($name);
    407407                $value = trim($value);
    408408
    … …  
    413413                        foreach ($parts as $part) {
    414414                                if (strpos($part, '=') === false) {
    415                                         $part_key = $part;
     415                                        $part_key   = $part;
    416416                                        $part_value = true;
    417417                                }
    418418                                else {
    419419                                        list($part_key, $part_value) = explode('=', $part, 2);
    420                                         $part_value = trim($part_value);
    421                                 }
    422 
    423                                 $part_key = trim($part_key);
     420                                        $part_value                  = trim($part_value);
     421                                }
     422
     423                                $part_key              = trim($part_key);
    424424                                $attributes[$part_key] = $part_value;
    425425                        }
    … …  
    450450                        if (empty($parsed->attributes['domain']) && !empty($origin)) {
    451451                                $parsed->attributes['domain'] = $origin->host;
    452                                 $parsed->flags['host-only'] = true;
     452                                $parsed->flags['host-only']   = true;
    453453                        }
    454454                        else {
    … …  
    498498         * @codeCoverageIgnore
    499499         * @deprecated Use {@see Requests_Cookie::parse_from_headers}
    500          * @return string
     500         * @return array
    501501         */
    502502        public static function parseFromHeaders(Requests_Response_Headers $headers) {
Note: See TracChangeset for help on using the changeset viewer.