WordPress.org

Make WordPress Core


Ignore:
Timestamp:
07/27/2016 03:31:48 PM (5 years ago)
Author:
ocean90
Message:

HTTP API: Normalize cookies before passing them to Requests.

Requests has its own cookie object in form of Requests_Cookie. Therefore we have to convert WP_Http_Cookie objects to Requests_Cookie.
This introduces WP_Http_Cookie::get_attributes() to retrieve cookie attributes of a WP_Http_Cookie object and WP_Http::normalize_cookies() to convert the cookie objects.

Fixes #37437.

File:
1 edited

Legend:

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

    r37492 r38164  
    217217        return 'Cookie: ' . $this->getHeaderValue();
    218218    }
     219
     220    /**
     221     * Retrieves cookie attributes.
     222     *
     223     * @since 4.6.0
     224     * @access public
     225     *
     226     * @return array {
     227     *    List of attributes.
     228     *
     229     *    @type string $expires When the cookie expires.
     230     *    @type string $path    Cookie URL path.
     231     *    @type string $domain  Cookie domain.
     232     * }
     233     */
     234    public function get_attributes() {
     235        return array(
     236            'expires' => $this->expires,
     237            'path'    => $this->path,
     238            'domain'  => $this->domain,
     239        );
     240    }
    219241}
Note: See TracChangeset for help on using the changeset viewer.