Commit ed89a08f authored by alexpott's avatar alexpott

Issue #2461985 by stefan.r: Update Guzzle to latest release

parent 5271f8f0
......@@ -783,16 +783,16 @@
},
{
"name": "guzzlehttp/guzzle",
"version": "5.0.3",
"version": "5.2.0",
"source": {
"type": "git",
"url": "https://github.com/guzzle/guzzle.git",
"reference": "6c72627de1d66832e4270e36e56acdb0d1d8f282"
"reference": "475b29ccd411f2fa8a408e64576418728c032cfa"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/guzzle/guzzle/zipball/6c72627de1d66832e4270e36e56acdb0d1d8f282",
"reference": "6c72627de1d66832e4270e36e56acdb0d1d8f282",
"url": "https://api.github.com/repos/guzzle/guzzle/zipball/475b29ccd411f2fa8a408e64576418728c032cfa",
"reference": "475b29ccd411f2fa8a408e64576418728c032cfa",
"shasum": ""
},
"require": {
......@@ -837,20 +837,20 @@
"rest",
"web service"
],
"time": "2014-11-04 07:09:15"
"time": "2015-01-28 01:03:29"
},
{
"name": "guzzlehttp/ringphp",
"version": "1.0.3",
"version": "1.0.7",
"source": {
"type": "git",
"url": "https://github.com/guzzle/RingPHP.git",
"reference": "e7c28f96c5ac12ab0e63412cfc15989756fcb964"
"reference": "52d868f13570a9a56e5fce6614e0ec75d0f13ac2"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/guzzle/RingPHP/zipball/e7c28f96c5ac12ab0e63412cfc15989756fcb964",
"reference": "e7c28f96c5ac12ab0e63412cfc15989756fcb964",
"url": "https://api.github.com/repos/guzzle/RingPHP/zipball/52d868f13570a9a56e5fce6614e0ec75d0f13ac2",
"reference": "52d868f13570a9a56e5fce6614e0ec75d0f13ac2",
"shasum": ""
},
"require": {
......@@ -887,7 +887,8 @@
"homepage": "https://github.com/mtdowling"
}
],
"time": "2014-11-04 07:01:14"
"description": "Provides a simple API and specification that abstracts away the details of HTTP into a single PHP function.",
"time": "2015-03-30 01:43:20"
},
{
"name": "guzzlehttp/streams",
......
......@@ -1218,66 +1218,6 @@
"templating"
]
},
{
"name": "guzzlehttp/guzzle",
"version": "5.0.3",
"version_normalized": "5.0.3.0",
"source": {
"type": "git",
"url": "https://github.com/guzzle/guzzle.git",
"reference": "6c72627de1d66832e4270e36e56acdb0d1d8f282"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/guzzle/guzzle/zipball/6c72627de1d66832e4270e36e56acdb0d1d8f282",
"reference": "6c72627de1d66832e4270e36e56acdb0d1d8f282",
"shasum": ""
},
"require": {
"guzzlehttp/ringphp": "~1.0",
"php": ">=5.4.0"
},
"require-dev": {
"ext-curl": "*",
"phpunit/phpunit": "~4.0",
"psr/log": "~1.0"
},
"time": "2014-11-04 07:09:15",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "5.0-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"GuzzleHttp\\": "src/"
}
},
"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": "egulias/email-validator",
"version": "1.2.5",
......@@ -1382,58 +1322,6 @@
"hhvm"
]
},
{
"name": "guzzlehttp/ringphp",
"version": "1.0.3",
"version_normalized": "1.0.3.0",
"source": {
"type": "git",
"url": "https://github.com/guzzle/RingPHP.git",
"reference": "e7c28f96c5ac12ab0e63412cfc15989756fcb964"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/guzzle/RingPHP/zipball/e7c28f96c5ac12ab0e63412cfc15989756fcb964",
"reference": "e7c28f96c5ac12ab0e63412cfc15989756fcb964",
"shasum": ""
},
"require": {
"guzzlehttp/streams": "~3.0",
"php": ">=5.4.0",
"react/promise": "~2.0"
},
"require-dev": {
"ext-curl": "*",
"phpunit/phpunit": "~4.0"
},
"suggest": {
"ext-curl": "Guzzle will use specific adapters if cURL is present"
},
"time": "2014-11-04 07:01:14",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"GuzzleHttp\\Ring\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Michael Dowling",
"email": "mtdowling@gmail.com",
"homepage": "https://github.com/mtdowling"
}
]
},
{
"name": "easyrdf/easyrdf",
"version": "0.9.0",
......@@ -3156,5 +3044,118 @@
],
"description": "Symfony BrowserKit Component",
"homepage": "http://symfony.com"
},
{
"name": "guzzlehttp/guzzle",
"version": "5.2.0",
"version_normalized": "5.2.0.0",
"source": {
"type": "git",
"url": "https://github.com/guzzle/guzzle.git",
"reference": "475b29ccd411f2fa8a408e64576418728c032cfa"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/guzzle/guzzle/zipball/475b29ccd411f2fa8a408e64576418728c032cfa",
"reference": "475b29ccd411f2fa8a408e64576418728c032cfa",
"shasum": ""
},
"require": {
"guzzlehttp/ringphp": "~1.0",
"php": ">=5.4.0"
},
"require-dev": {
"ext-curl": "*",
"phpunit/phpunit": "~4.0",
"psr/log": "~1.0"
},
"time": "2015-01-28 01:03:29",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "5.0-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"GuzzleHttp\\": "src/"
}
},
"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": "guzzlehttp/ringphp",
"version": "1.0.7",
"version_normalized": "1.0.7.0",
"source": {
"type": "git",
"url": "https://github.com/guzzle/RingPHP.git",
"reference": "52d868f13570a9a56e5fce6614e0ec75d0f13ac2"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/guzzle/RingPHP/zipball/52d868f13570a9a56e5fce6614e0ec75d0f13ac2",
"reference": "52d868f13570a9a56e5fce6614e0ec75d0f13ac2",
"shasum": ""
},
"require": {
"guzzlehttp/streams": "~3.0",
"php": ">=5.4.0",
"react/promise": "~2.0"
},
"require-dev": {
"ext-curl": "*",
"phpunit/phpunit": "~4.0"
},
"suggest": {
"ext-curl": "Guzzle will use specific adapters if cURL is present"
},
"time": "2015-03-30 01:43:20",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"GuzzleHttp\\Ring\\": "src/"
}
},
"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 API and specification that abstracts away the details of HTTP into a single PHP function."
}
]
# CHANGELOG
## 5.2.0 - 2015-01-27
* Added `AppliesHeadersInterface` to make applying headers to a request based
on the body more generic and not specific to `PostBodyInterface`.
* Reduced the number of stack frames needed to send requests.
* Nested futures are now resolved in the client rather than the RequestFsm
* Finishing state transitions is now handled in the RequestFsm rather than the
RingBridge.
* Added a guard in the Pool class to not use recursion for request retries.
## 5.1.0 - 2014-12-19
* Pool class no longer uses recursion when a request is intercepted.
* The size of a Pool can now be dynamically adjusted using a callback.
See https://github.com/guzzle/guzzle/pull/943.
* Setting a request option to `null` when creating a request with a client will
ensure that the option is not set. This allows you to overwrite default
request options on a per-request basis.
See https://github.com/guzzle/guzzle/pull/937.
* Added the ability to limit which protocols are allowed for redirects by
specifying a `protocols` array in the `allow_redirects` request option.
* Nested futures due to retries are now resolved when waiting for synchronous
responses. See https://github.com/guzzle/guzzle/pull/947.
* `"0"` is now an allowed URI path. See
https://github.com/guzzle/guzzle/pull/935.
* `Query` no longer typehints on the `$query` argument in the constructor,
allowing for strings and arrays.
* Exceptions thrown in the `end` event are now correctly wrapped with Guzzle
specific exceptions if necessary.
## 5.0.3 - 2014-11-03
This change updates query strings so that they are treated as un-encoded values
......@@ -71,10 +101,10 @@ The breaking changes in this release are relatively minor. The biggest thing to
look out for is that request and response objects no longer implement fluent
interfaces.
* Removed the fluent interfaces (i.e., ``return $this``) from requests,
responses, ``GuzzleHttp\Collection``, ``GuzzleHttp\Url``,
``GuzzleHttp\Query``, ``GuzzleHttp\Post\PostBody``, and
``GuzzleHttp\Cookie\SetCookie``. This blog post provides a good outline of
* Removed the fluent interfaces (i.e., `return $this`) from requests,
responses, `GuzzleHttp\Collection`, `GuzzleHttp\Url`,
`GuzzleHttp\Query`, `GuzzleHttp\Post\PostBody`, and
`GuzzleHttp\Cookie\SetCookie`. This blog post provides a good outline of
why I did this: http://ocramius.github.io/blog/fluent-interfaces-are-evil/.
This also makes the Guzzle message interfaces compatible with the current
PSR-7 message proposal.
......@@ -84,7 +114,7 @@ interfaces.
moved to `GuzzleHttp\Utils::jsonDecode`. `GuzzleHttp\get_path` moved to
`GuzzleHttp\Utils::getPath`. `GuzzleHttp\set_path` moved to
`GuzzleHttp\Utils::setPath`. `GuzzleHttp\batch` should now be
`GuzzleHttp\Pool::batch`, which returns a bjectStorage`. Using functions.php
`GuzzleHttp\Pool::batch`, which returns an `objectStorage`. Using functions.php
caused problems for many users: they aren't PSR-4 compliant, require an
explicit include, and needed an if-guard to ensure that the functions are not
declared multiple times.
......@@ -105,10 +135,10 @@ interfaces.
written to.
* Removed the `asArray` parameter from
`GuzzleHttp\Message\MessageInterface::getHeader`. If you want to get a header
value as an array, then use the newly added ``getHeaderAsArray()`` method of
``MessageInterface``. This change makes the Guzzle interfaces compatible with
value as an array, then use the newly added `getHeaderAsArray()` method of
`MessageInterface`. This change makes the Guzzle interfaces compatible with
the PSR-7 interfaces.
* ``GuzzleHttp\Message\MessageFactory`` no longer allows subclasses to add
* `GuzzleHttp\Message\MessageFactory` no longer allows subclasses to add
custom request options using double-dispatch (this was an implementation
detail). Instead, you should now provide an associative array to the
constructor which is a mapping of the request option name mapping to a
......@@ -121,9 +151,9 @@ interfaces.
* `GuzzleHttp\Stream\StreamInterface::getContents()` no longer accepts a
`maxLen` parameter. This update makes the Guzzle streams project
compatible with the current PSR-7 proposal.
* ``GuzzleHttp\Stream\Stream::__construct``,
``GuzzleHttp\Stream\Stream::factory``, and
``GuzzleHttp\Stream\Utils::create`` no longer accept a size in the second
* `GuzzleHttp\Stream\Stream::__construct`,
`GuzzleHttp\Stream\Stream::factory`, and
`GuzzleHttp\Stream\Utils::create` no longer accept a size in the second
argument. They now accept an associative array of options, including the
"size" key and "metadata" key which can be used to provide custom metadata.
......@@ -359,7 +389,7 @@ interfaces.
* Bug fix: FilterIterator now relies on `\Iterator` instead of `\Traversable`.
* Bug fix: Gracefully handling malformed responses in RequestMediator::writeResponseBody()
* Bug fix: Replaced call to canCache with canCacheRequest in the CallbackCanCacheStrategy of the CachePlugin
* Bug fix: Visiting XML attributes first before visting XML children when serializing requests
* Bug fix: Visiting XML attributes first before visiting XML children when serializing requests
* Bug fix: Properly parsing headers that contain commas contained in quotes
* Bug fix: mimetype guessing based on a filename is now case-insensitive
......@@ -502,7 +532,7 @@ interfaces.
directly via interfaces
* Removed the injecting of a request object onto a response object. The methods to get and set a request still exist
but are a no-op until removed.
* Most classes that used to require a ``Guzzle\Service\Command\CommandInterface` typehint now request a
* Most classes that used to require a `Guzzle\Service\Command\CommandInterface` typehint now request a
`Guzzle\Service\Command\ArrayCommandInterface`.
* Added `Guzzle\Http\Message\RequestInterface::startResponse()` to the RequestInterface to handle injecting a response
on a request while the request is still being transferred
......@@ -517,7 +547,7 @@ interfaces.
## 3.5.0 - 2013-05-13
* Bug: Fixed a regression so that request responses are parsed only once per oncomplete event rather than multiple times
* Bug: Better cleanup of one-time events accross the board (when an event is meant to fire once, it will now remove
* Bug: Better cleanup of one-time events across the board (when an event is meant to fire once, it will now remove
itself from the EventDispatcher)
* Bug: `Guzzle\Log\MessageFormatter` now properly writes "total_time" and "connect_time" values
* Bug: Cloning an EntityEnclosingRequest now clones the EntityBody too
......@@ -833,15 +863,15 @@ interfaces.
* Bug: Fixed a bug in ExponentialBackoffPlugin that caused fatal errors when retrying an EntityEnclosingRequest that does not have a body
* Bug: Setting the response body of a request to null after completing a request, not when setting the state of a request to new
* Added multiple inheritance to service description commands
* Added an ApiCommandInterface and added ``getParamNames()`` and ``hasParam()``
* Added an ApiCommandInterface and added `getParamNames()` and `hasParam()`
* Removed the default 2mb size cutoff from the Md5ValidatorPlugin so that it now defaults to validating everything
* Changed CurlMulti::perform to pass a smaller timeout to CurlMulti::executeHandles
## 2.8.2 - 2012-07-24
* Bug: Query string values set to 0 are no longer dropped from the query string
* Bug: A Collection object is no longer created each time a call is made to ``Guzzle\Service\Command\AbstractCommand::getRequestHeaders()``
* Bug: ``+`` is now treated as an encoded space when parsing query strings
* Bug: A Collection object is no longer created each time a call is made to `Guzzle\Service\Command\AbstractCommand::getRequestHeaders()`
* Bug: `+` is now treated as an encoded space when parsing query strings
* QueryString and Collection performance improvements
* Allowing dot notation for class paths in filters attribute of a service descriptions
......@@ -858,7 +888,7 @@ interfaces.
* Changed setEncodeValues(bool) and setEncodeFields(bool) to useUrlEncoding(bool)
* Changed the aggregation functions of QueryString to be static methods
* Can now use fromString() with querystrings that have a leading ?
* cURL configuration values can be specified in service descriptions using ``curl.`` prefixed parameters
* cURL configuration values can be specified in service descriptions using `curl.` prefixed parameters
* Content-Length is set to 0 before emitting the request.before_send event when sending an empty request body
* Cookies are no longer URL decoded by default
* Bug: URI template variables set to null are no longer expanded
......
......@@ -503,7 +503,7 @@ allow developers to more easily extend and decorate stream behavior.
## Metadata streams
`GuzzleHttp\Stream\MetadataStreamInterface` has been added to denote streams
that contain additonal metadata accessible via `getMetadata()`.
that contain additional metadata accessible via `getMetadata()`.
`GuzzleHttp\Stream\StreamInterface::getMetadata` and
`GuzzleHttp\Stream\StreamInterface::setMetadata` have been removed.
......
......@@ -13,7 +13,7 @@
// Copy each dependency to the staging directory. Copy *.php and *.pem files.
$packager->recursiveCopy('src', 'GuzzleHttp', ['php']);
$packager->recursiveCopy('vendor/react/promise/src', '');
$packager->recursiveCopy('vendor/react/promise/src', 'React/Promise');
$packager->recursiveCopy('vendor/guzzlehttp/ringphp/src', 'GuzzleHttp/Ring');
$packager->recursiveCopy('vendor/guzzlehttp/streams/src', 'GuzzleHttp/Stream');
$packager->createAutoloader(['React/Promise/functions.php']);
......
......@@ -173,6 +173,12 @@ response has completed.
If an exception occurred while transferring the future response, then the
exception encountered will be thrown when dereferencing.
.. note::
It depends on the RingPHP handler used by a client, but you typically need
to use the same RingPHP handler in order to utilize asynchronous requests
across multiple clients.
Asynchronous Error Handling
~~~~~~~~~~~~~~~~~~~~~~~~~~~
......@@ -524,7 +530,7 @@ json
.. code-block:: php
$request = $client->createRequest('/put', ['json' => ['foo' => 'bar']]);
$request = $client->createRequest('PUT', '/put', ['json' => ['foo' => 'bar']]);
echo $request->getHeader('Content-Type');
// application/json
echo $request->getBody();
......@@ -701,7 +707,15 @@ allow_redirects
:Types:
- bool
- array
:Default: ``['max' => 5, 'strict' => false, 'referer' => true]``
:Default:
::
[
'max' => 5,
'strict' => false,
'referer' => true,
'protocols' => ['http', 'https']
]
Set to ``false`` to disable redirects.
......@@ -721,19 +735,22 @@ number of 5 redirects.
// 200
Pass an associative array containing the 'max' key to specify the maximum
number of redirects, optionally provide a 'strict' key value to specify
whether or not to use strict RFC compliant redirects (meaning redirect POST
requests with POST requests vs. doing what most browsers do which is redirect
POST requests with GET requests), and optionally provide a 'referer' key to
specify whether or not the "Referer" header should be added when redirecting.
number of redirects, provide a 'strict' key value to specify whether or not to
use strict RFC compliant redirects (meaning redirect POST requests with POST
requests vs. doing what most browsers do which is redirect POST requests with
GET requests), provide a 'referer' key to specify whether or not the "Referer"
header should be added when redirecting, and provide a 'protocols' array that
specifies which protocols are supported for redirects (defaults to
``['http', 'https']``).
.. code-block:: php
$res = $client->get('/redirect/3', [
'allow_redirects' => [
'max' => 10,
'strict' => true,
'referer' => true
'max' => 10, // allow at most 10 redirects.
'strict' => true, // use "strict" RFC compliant redirects.
'referer' => true, // add a Referer header
'protocols' => ['https'] // only allow https URLs
]
]);
echo $res->getStatusCode();
......
......@@ -11,12 +11,12 @@ Event Emitters
==============
Clients, requests, and any other class that implements the
``GuzzleHttp\Common\HasEmitterInterface`` interface have a
``GuzzleHttp\Common\EventEmitter`` object. You can add event *listeners* and
``GuzzleHttp\Event\HasEmitterInterface`` interface have a
``GuzzleHttp\Event\Emitter`` object. You can add event *listeners* and
event *subscribers* to an event *emitter*.
emitter
An object that implements ``GuzzleHttp\Common\EventEmitterInterface``. This
An object that implements ``GuzzleHttp\Event\EmitterInterface``. This
object emits named events to event listeners. You may register event
listeners on subscribers on an emitter.
......@@ -58,7 +58,7 @@ propagation
Getting an EventEmitter
-----------------------
You can get the event emitter of ``GuzzleHttp\Common\HasEmitterInterface``
You can get the event emitter of ``GuzzleHttp\Event\HasEmitterInterface``
object using the the ``getEmitter()`` method. Here's an example of getting a
client object's event emitter.
......@@ -95,7 +95,7 @@ event is triggered, and optionally provide a priority.
});
When a listener is triggered, it is passed an event that implements the
``GuzzleHttp\Common\EventInterface`` interface, the name of the event, and the
``GuzzleHttp\Event\EventInterface`` interface, the name of the event, and the
event emitter itself. The above example could more verbosely be written as
follows:
......@@ -134,7 +134,7 @@ state. This technique is used in Guzzle extensively when intercepting error
events with responses.
You can stop the propagation of an event using the ``stopPropagation()`` method
of a ``GuzzleHttp\Common\EventInterface`` object:
of a ``GuzzleHttp\Event\EventInterface`` object:
.. code-block:: php
......@@ -168,7 +168,7 @@ Event Subscribers
-----------------
Event subscribers are classes that implement the
``GuzzleHttp\Common\EventSubscriberInterface`` object. They are used to register
``GuzzleHttp\Event\SubscriberInterface`` object. They are used to register
one or more event listeners to methods of the class. Event subscribers tell
event emitters exactly which events to listen to and what method to invoke on
the class when the event is triggered by called the ``getEvents()`` method of
......@@ -213,6 +213,18 @@ priority of the listener (as shown in the ``before`` listener in the example).
}
}
To register the listeners the subscriber needs to be attached to the emitter:
.. code-block:: php
$client = new GuzzleHttp\Client();
$emitter = $client->getEmitter();
$subscriber = new SimpleSubscriber();
$emitter->attach($subscriber);
//to remove the listeners
$emitter->detach($subscriber);
.. note::
You can specify event priorities using integers or ``"first"`` and
......@@ -315,7 +327,7 @@ a ``GuzzleHttp\Event\BeforeEvent``.
.. code-block:: php
use GuzzleHttp\Client;
use GuzzleHttp\Common\EmitterInterface;
use GuzzleHttp\Event\EmitterInterface;
use GuzzleHttp\Event\BeforeEvent;
$client = new Client(['base_url' => 'http://httpbin.org']);
......@@ -480,7 +492,7 @@ end
---
The ``end`` event is a terminal event, emitted once per request, that provides
access to the repsonse that was received or the exception that was encountered.
access to the response that was received or the exception that was encountered.
The event emitted is a ``GuzzleHttp\Event\EndEvent``.
This event can be intercepted, but keep in mind that the ``complete`` event
......
......@@ -64,7 +64,7 @@ an HTTP response into a more meaningful model object.
- `Guzzle Command <https://github.com/guzzle/command>`_: Provides the building
blocks for service description abstraction.
- `Guzzle Services <https://github.com/guzzle/guzzle-services>`_: Provides an
implementation of "Guzzle Command" that utlizes Guzzle's service description
implementation of "Guzzle Command" that utilizes Guzzle's service description
format.
Does Guzzle require cURL?
......@@ -91,7 +91,7 @@ Can Guzzle send asynchronous requests?
Yes. Pass the ``future`` true request option to a request to send it
asynchronously. Guzzle will then return a ``GuzzleHttp\Message\FutureResponse``
object that can be used synchronously by accessing the response object like a
normal response, and it can be used asynchronoulsy using a promise that is
normal response, and it can be used asynchronously using a promise that is
notified when the response is resolved with a real response or rejected with an
exception.
......
......@@ -351,7 +351,7 @@ method of a request.
$request = $client->createRequest('GET', '/');