Commit c7afd229 authored by webchick's avatar webchick

Issue #2304081 by damiankloip: Upgrade Guzzle to version 4.1.3.

parent 01d85e15
......@@ -459,21 +459,21 @@
},
{
"name": "guzzlehttp/guzzle",
"version": "4.1.0",
"version": "4.1.3",
"source": {
"type": "git",
"url": "https://github.com/guzzle/guzzle.git",
"reference": "85a0ba7de064493c928a8bcdc5eef01e0bde9953"
"reference": "012b2aecbda4e38f119c19580898685851015fa7"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/guzzle/guzzle/zipball/85a0ba7de064493c928a8bcdc5eef01e0bde9953",
"reference": "85a0ba7de064493c928a8bcdc5eef01e0bde9953",
"url": "https://api.github.com/repos/guzzle/guzzle/zipball/012b2aecbda4e38f119c19580898685851015fa7",
"reference": "012b2aecbda4e38f119c19580898685851015fa7",
"shasum": ""
},
"require": {
"ext-json": "*",
"guzzlehttp/streams": "~1.0",
"guzzlehttp/streams": "~1.3",
"php": ">=5.4.0"
},
"require-dev": {
......@@ -487,7 +487,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "4.0.x-dev"
"dev-master": "4.1.x-dev"
}
},
"autoload": {
......@@ -520,32 +520,32 @@
"rest",
"web service"
],
"time": "2014-05-28 05:13:19"
"time": "2014-07-16 03:01:02"
},
{
"name": "guzzlehttp/streams",
"version": "1.0.0",
"version": "1.3.0",
"source": {
"type": "git",
"url": "https://github.com/guzzle/streams.git",
"reference": "d249beffe5fa5e0da3855974bcc2dd9082069ccf"
"reference": "d6aaa91cfdbae86355dd2a168a3ca536755898a2"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/guzzle/streams/zipball/d249beffe5fa5e0da3855974bcc2dd9082069ccf",
"reference": "d249beffe5fa5e0da3855974bcc2dd9082069ccf",
"url": "https://api.github.com/repos/guzzle/streams/zipball/d6aaa91cfdbae86355dd2a168a3ca536755898a2",
"reference": "d6aaa91cfdbae86355dd2a168a3ca536755898a2",
"shasum": ""
},
"require": {
"php": ">=5.4.0"
},
"require-dev": {
"phpunit/phpunit": "4.*"
"phpunit/phpunit": "~4.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
"dev-master": "1.2.x-dev"
}
},
"autoload": {
......@@ -573,7 +573,7 @@
"Guzzle",
"stream"
],
"time": "2014-03-25 18:31:28"
"time": "2014-07-15 22:02:02"
},
{
"name": "kriswallsmith/assetic",
......@@ -2393,12 +2393,8 @@
"time": "2013-06-12 19:46:58"
}
],
"packages-dev": [
],
"aliases": [
],
"packages-dev": [],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": {
"symfony/yaml": 20,
......@@ -2411,7 +2407,5 @@
"platform": {
"php": ">=5.4.2"
},
"platform-dev": [
]
"platform-dev": []
}
......@@ -202,10 +202,11 @@ public function set($prefix, $paths)
* Registers a set of PSR-4 directories for a given namespace,
* replacing any others previously set for this namespace.
*
* @param string $prefix The prefix/namespace, with trailing '\\'
* @param array|string $paths The PSR-4 base directories
* @param string $prefix The prefix/namespace, with trailing '\\'
* @param array|string $paths The PSR-4 base directories
*/
public function setPsr4($prefix, $paths) {
public function setPsr4($prefix, $paths)
{
if (!$prefix) {
$this->fallbackDirsPsr4 = (array) $paths;
} else {
......
......@@ -23,9 +23,6 @@ public static function getLoader()
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
spl_autoload_unregister(array('ComposerAutoloaderInitDrupal8', 'loadClassLoader'));
$vendorDir = dirname(__DIR__);
$baseDir = dirname(dirname($vendorDir));
$includePaths = require __DIR__ . '/include_paths.php';
array_push($includePaths, get_include_path());
set_include_path(join(PATH_SEPARATOR, $includePaths));
......
......@@ -1623,61 +1623,6 @@
"description": "Symfony Yaml Component",
"homepage": "http://symfony.com"
},
{
"name": "guzzlehttp/streams",
"version": "1.0.0",
"version_normalized": "1.0.0.0",
"source": {
"type": "git",
"url": "https://github.com/guzzle/streams.git",
"reference": "d249beffe5fa5e0da3855974bcc2dd9082069ccf"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/guzzle/streams/zipball/d249beffe5fa5e0da3855974bcc2dd9082069ccf",
"reference": "d249beffe5fa5e0da3855974bcc2dd9082069ccf",
"shasum": ""
},
"require": {
"php": ">=5.4.0"
},
"require-dev": {
"phpunit/phpunit": "4.*"
},
"time": "2014-03-25 18:31:28",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"GuzzleHttp\\Stream\\": "src/"
},
"files": [
"src/functions.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Michael Dowling",
"email": "mtdowling@gmail.com",
"homepage": "https://github.com/mtdowling"
}
],
"description": "Provides a simple abstraction over streams of data (Guzzle 4+)",
"homepage": "http://guzzlephp.org/",
"keywords": [
"Guzzle",
"stream"
]
},
{
"name": "symfony/css-selector",
"version": "v2.4.4",
......@@ -1733,73 +1678,6 @@
"description": "Symfony CssSelector Component",
"homepage": "http://symfony.com"
},
{
"name": "guzzlehttp/guzzle",
"version": "4.1.0",
"version_normalized": "4.1.0.0",
"source": {
"type": "git",
"url": "https://github.com/guzzle/guzzle.git",
"reference": "85a0ba7de064493c928a8bcdc5eef01e0bde9953"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/guzzle/guzzle/zipball/85a0ba7de064493c928a8bcdc5eef01e0bde9953",
"reference": "85a0ba7de064493c928a8bcdc5eef01e0bde9953",
"shasum": ""
},
"require": {
"ext-json": "*",
"guzzlehttp/streams": "~1.0",
"php": ">=5.4.0"
},
"require-dev": {
"ext-curl": "*",
"phpunit/phpunit": "~4.0",
"psr/log": "~1.0"
},
"suggest": {
"ext-curl": "Guzzle will use specific adapters if cURL is present"
},
"time": "2014-05-28 05:13:19",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "4.0.x-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"GuzzleHttp\\": "src/"
},
"files": [
"src/functions.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Michael Dowling",
"email": "mtdowling@gmail.com",
"homepage": "https://github.com/mtdowling"
}
],
"description": "Guzzle is a PHP HTTP client library and framework for building RESTful web service clients",
"homepage": "http://guzzlephp.org/",
"keywords": [
"client",
"curl",
"framework",
"http",
"http client",
"rest",
"web service"
]
},
{
"name": "sebastian/version",
"version": "1.0.3",
......@@ -2470,5 +2348,127 @@
"mock",
"xunit"
]
},
{
"name": "guzzlehttp/streams",
"version": "1.3.0",
"version_normalized": "1.3.0.0",
"source": {
"type": "git",
"url": "https://github.com/guzzle/streams.git",
"reference": "d6aaa91cfdbae86355dd2a168a3ca536755898a2"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/guzzle/streams/zipball/d6aaa91cfdbae86355dd2a168a3ca536755898a2",
"reference": "d6aaa91cfdbae86355dd2a168a3ca536755898a2",
"shasum": ""
},
"require": {
"php": ">=5.4.0"
},
"require-dev": {
"phpunit/phpunit": "~4.0"
},
"time": "2014-07-15 22:02:02",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.2.x-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"GuzzleHttp\\Stream\\": "src/"
},
"files": [
"src/functions.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Michael Dowling",
"email": "mtdowling@gmail.com",
"homepage": "https://github.com/mtdowling"
}
],
"description": "Provides a simple abstraction over streams of data (Guzzle 4+)",
"homepage": "http://guzzlephp.org/",
"keywords": [
"Guzzle",
"stream"
]
},
{
"name": "guzzlehttp/guzzle",
"version": "4.1.3",
"version_normalized": "4.1.3.0",
"source": {
"type": "git",
"url": "https://github.com/guzzle/guzzle.git",
"reference": "012b2aecbda4e38f119c19580898685851015fa7"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/guzzle/guzzle/zipball/012b2aecbda4e38f119c19580898685851015fa7",
"reference": "012b2aecbda4e38f119c19580898685851015fa7",
"shasum": ""
},
"require": {
"ext-json": "*",
"guzzlehttp/streams": "~1.3",
"php": ">=5.4.0"
},
"require-dev": {
"ext-curl": "*",
"phpunit/phpunit": "~4.0",
"psr/log": "~1.0"
},
"suggest": {
"ext-curl": "Guzzle will use specific adapters if cURL is present"
},
"time": "2014-07-16 03:01:02",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "4.1.x-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"GuzzleHttp\\": "src/"
},
"files": [
"src/functions.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Michael Dowling",
"email": "mtdowling@gmail.com",
"homepage": "https://github.com/mtdowling"
}
],
"description": "Guzzle is a PHP HTTP client library and framework for building RESTful web service clients",
"homepage": "http://guzzlephp.org/",
"keywords": [
"client",
"curl",
"framework",
"http",
"http client",
"rest",
"web service"
]
}
]
CHANGELOG
=========
4.1.3 (2014-07-15)
------------------
* Various fixes to multipart/form-data POST uploads
* Wrapping function.php in an if-statement to ensure Guzzle can be used
globally and in a Composer install
* Fixed an issue with generating and merging in events to an event array
* POST headers are only applied before sending a request to allow you to change
the query aggregator used before uploading
* Added much more robust query string parsing
* Fixed various parsing and normalization issues with URLs
* Fixing an issue where multi-valued headers were not being utilized correctly
in the StreamAdapter
4.1.2 (2014-06-18)
------------------
* Added support for sending payloads with GET requests
4.1.1 (2014-06-08)
------------------
* Fixed an issue related to using custom message factory options in subclasses
* Fixed an issue with nested form fields in a multi-part POST
* Fixed an issue with using the `json` request option for POST requests
* Added `ToArrayInterface` to `GuzzleHttp\Cookie\CookieJar`
4.1.0 (2014-05-27)
------------------
......
......@@ -17,7 +17,7 @@
"require": {
"php": ">=5.4.0",
"ext-json": "*",
"guzzlehttp/streams": "~1.0"
"guzzlehttp/streams": "~1.3"
},
"suggest": {
......@@ -30,7 +30,11 @@
},
"files": ["src/functions.php"]
},
"autoload-dev": {
"psr-4": {
"GuzzleHttp\\Tests\\": "tests/"
}
},
"require-dev": {
"ext-curl": "*",
"psr/log": "~1.0",
......@@ -39,7 +43,7 @@
"extra": {
"branch-alias": {
"dev-master": "4.0.x-dev"
"dev-master": "4.1.x-dev"
}
}
}
......@@ -70,7 +70,7 @@ base URL that is a URI template with parameters.
use GuzzleHttp\Client;
$client = new Client([
'base_url' => ['https://api.twitter.com/{version}', ['version' => 'v1.1']],
'base_url' => ['https://api.twitter.com/{version}/', ['version' => 'v1.1']],
'defaults' => [
'headers' => ['Foo' => 'Bar'],
'query' => ['testing' => '123'],
......@@ -203,7 +203,7 @@ The ``sendAll()`` method accepts the following associative array of options:
The "before", "complete", and "error" event options accept a callable or an
array of associative arrays where each associative array contains a "fn" key
with a callable value, an optional "priority" key representing the event
priority (with a default value is 0), and an optional "once" key that can be
priority (with a default value of 0), and an optional "once" key that can be
set to true so that the event listener will be removed from the request after
it is first triggered.
......@@ -289,7 +289,7 @@ Throwing Errors Immediately
~~~~~~~~~~~~~~~~~~~~~~~~~~~
It sometimes is useful to throw exceptions immediately when the occur. The
following exmaple shows how to use an event listener to throw exceptions
following example shows how to use an event listener to throw exceptions
immeditaley and prevent subsequent requests from being sent.
.. code-block:: php
......@@ -308,7 +308,7 @@ Batching Requests
-----------------
Sometimes you just want to send a few requests in parallel and then process
the results all at once after they've sent. Guzzle provides a convenience
the results all at once after they've been sent. Guzzle provides a convenience
function ``GuzzleHttp\batch()`` that makes this very simple:
.. code-block:: php
......@@ -339,7 +339,7 @@ function ``GuzzleHttp\batch()`` that makes this very simple:
``GuzzleHttp\batch()`` accepts an optional associative array of options in the
third argument that allows you to specify the 'before', 'complete' and 'error'
events as well as specify the maximum number of request to send in parallel
events as well as specify the maximum number of requests to send in parallel
using the 'parallel' option key. This options array is the exact same format as
the options array exposed in ``GuzzleHttp\ClientInterface::sendAll()``.
......@@ -699,7 +699,7 @@ to an open Guzzle stream:
events
------
:Summary: Associative array mapping event names to a callable. or an
:Summary: An associative array mapping event names to a callable. Or an
associative array containing the 'fn' key that maps to a callable, an
optional 'priority' key used to specify the event priority, and an optional
'once' key used to specify if the event should remove itself the first time
......@@ -896,7 +896,7 @@ Pass a string to specify a proxy for all protocols.
.. code-block:: php
$client->get('/', ['proxy' => 'tcp://localhost:8124']);
$client->get('/', ['proxy' => 'tcp://localhost:8125']);
Pass an associative array to specify HTTP proxies for specific URI schemes
(i.e., "http", "https").
......@@ -905,7 +905,7 @@ Pass an associative array to specify HTTP proxies for specific URI schemes
$client->get('/', [
'proxy' => [
'http' => 'tcp://localhost:8124', // Use this proxy with "http"
'http' => 'tcp://localhost:8125', // Use this proxy with "http"
'https' => 'tcp://localhost:9124' // Use this proxy with "https"
]
]);
......@@ -1103,7 +1103,7 @@ behavior of the library.
``HTTP_PROXY``
Defines the proxy to use when sending requests using the "http" protocol.
``HTTPS_PROXY``
Defines the proxy to use when sending requests using the "https": protocol.
Defines the proxy to use when sending requests using the "https" protocol.
Relevant ini Settings
---------------------
......
......@@ -18,7 +18,7 @@ easily test the client.
Procedural API
--------------
Here's an example of sending a ``GET`` request using the procedural API.
Here's an example of sending a ``POST`` request using the procedural API.
.. code-block:: php
......@@ -377,7 +377,7 @@ Guzzle can maintain a cookie session for you if instructed using the
- Set to ``true`` to use a shared cookie session associated with the client.
- Pass an associative array containing cookies to send in the request and start
a new cookie session.
- Set to a ``GuzzleHttp\Subscriber\CookieJar\CookieJarInterface`` object to uss
- Set to a ``GuzzleHttp\Subscriber\CookieJar\CookieJarInterface`` object to use
an existing cookie jar.
Redirects
......@@ -437,7 +437,7 @@ Guzzle throws exceptions for errors that occur during a transfer.
}
}
- A ``GuzzleHttp\Exception\ClientErrorResponseException`` is thrown for 400
- A ``GuzzleHttp\Exception\ClientException`` is thrown for 400
level errors if the ``exceptions`` request option is set to true. This
exception extends from ``GuzzleHttp\Exception\BadResponseException`` and
``GuzzleHttp\Exception\BadResponseException`` extends from
......@@ -445,16 +445,16 @@ Guzzle throws exceptions for errors that occur during a transfer.
.. code-block:: php
use GuzzleHttp\Exception\ClientErrorResponseException;
use GuzzleHttp\Exception\ClientException;
try {
$client->get('https://github.com/_abc_123_404');
} catch (ClientErrorResponseException $e) {
} catch (ClientException $e) {
echo $e->getRequest();
echo $e->getResponse();
}
- A ``GuzzleHttp\Exception\ServerErrorResponse`` is thrown for 500 level
- A ``GuzzleHttp\Exception\ServerException`` is thrown for 500 level
errors if the ``exceptions`` request option is set to true. This
exception extends from ``GuzzleHttp\Exception\BadResponseException``.
- A ``GuzzleHttp\Exception\TooManyRedirectsException`` is thrown when too
......
......@@ -173,16 +173,12 @@ Guzzle ships with a node.js test server that receives requests and returns
responses from a queue. The test server exposes a simple API that is used to
enqueue responses and inspect the requests that it has received.
In order to use the web server, you'll need to manually require
``tests/Server.php``. Any operation on the ``Server`` object will ensure that
Any operation on the ``Server`` object will ensure that
the server is running and wait until it is able to receive requests before
returning.
.. code-block:: php
// Require the test server (using something like this).
require __DIR__ . '/../vendor/guzzlehttp/guzzle/tests/Server.php';
use GuzzleHttp\Client;
use GuzzleHttp\Tests\Server;
......
......@@ -97,10 +97,7 @@ protected function getDefaultOptions(
private function applyMethod(RequestInterface $request, array &$options)
{
$method = $request->getMethod();
if ($method == 'GET') {
$options[CURLOPT_HTTPGET] = true;
unset($options[CURLOPT_READFUNCTION]);
} elseif ($method == 'HEAD') {
if ($method == 'HEAD') {
$options[CURLOPT_NOBODY] = true;
unset($options[CURLOPT_WRITEFUNCTION], $options[CURLOPT_READFUNCTION]);
} else {
......
......@@ -100,18 +100,9 @@ private function createResponseObject(
$options['reason_phrase'] = $parts[2];
}
// Set the size on the stream if it was returned in the response
$responseHeaders = [];
foreach ($headers as $header) {
$headerParts = explode(':', $header, 2);
$responseHeaders[$headerParts[0]] = isset($headerParts[1])