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.
Built from https://develop.svn.wordpress.org/trunk@38164


git-svn-id: http://core.svn.wordpress.org/trunk@38105 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Dominik Schilling
2016-07-27 15:32:27 +00:00
parent 962f107035
commit b2607f8d78
4 changed files with 59 additions and 9 deletions

View File

@@ -176,9 +176,9 @@ class WP_HTTP_Requests_Response extends WP_HTTP_Response {
$cookies[] = new WP_Http_Cookie( array(
'name' => $cookie->name,
'value' => urldecode( $cookie->value ),
'expires' => $cookie->attributes['expires'],
'path' => $cookie->attributes['path'],
'domain' => $cookie->attributes['domain'],
'expires' => isset( $cookie->attributes['expires'] ) ? $cookie->attributes['expires'] : null,
'path' => isset( $cookie->attributes['path'] ) ? $cookie->attributes['path'] : null,
'domain' => isset( $cookie->attributes['domain'] ) ? $cookie->attributes['domain'] : null,
));
}