]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-includes/class-http.php
WordPress 4.6.1
[autoinstalls/wordpress.git] / wp-includes / class-http.php
index d3a893787cb18847e7697e35edb0df756aa9f7b9..c0272ba487fbc89d42cc9cfff28e4890e9317db7 100644 (file)
@@ -362,6 +362,9 @@ class WP_Http {
                        }
                }
 
+               // Work around a bug in Requests when the path starts with // See https://github.com/rmccue/Requests/issues/231
+               $url = preg_replace( '!^(\w+://[^/]+)//(.*)$!i', '$1/$2', $url );
+
                try {
                        $requests_response = Requests::request( $url, $headers, $data, $type, $options );
 
@@ -433,7 +436,7 @@ class WP_Http {
                foreach ( $cookies as $name => $value ) {
                        if ( $value instanceof WP_Http_Cookie ) {
                                $cookie_jar[ $value->name ] = new Requests_Cookie( $value->name, $value->value, $value->get_attributes() );
-                       } elseif ( is_string( $value ) ) {
+                       } elseif ( is_scalar( $value ) ) {
                                $cookie_jar[ $name ] = new Requests_Cookie( $name, $value );
                        }
                }