Issue #2369107 by lussoluca: Update Guzzle to 5.0.3.
parent
0577d20a45
commit
1a222d4de8
|
@ -4,7 +4,7 @@
|
|||
"Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"hash": "4378dea31ef5185651bc10bd9a40e591",
|
||||
"hash": "2bd5814ec010b13a6997359736b58695",
|
||||
"packages": [
|
||||
{
|
||||
"name": "doctrine/annotations",
|
||||
|
@ -568,16 +568,16 @@
|
|||
},
|
||||
{
|
||||
"name": "guzzlehttp/guzzle",
|
||||
"version": "5.0.0",
|
||||
"version": "5.0.3",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/guzzle/guzzle.git",
|
||||
"reference": "28b51e11237f25cdb0efaea8e45af26007831aa9"
|
||||
"reference": "6c72627de1d66832e4270e36e56acdb0d1d8f282"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/guzzle/guzzle/zipball/28b51e11237f25cdb0efaea8e45af26007831aa9",
|
||||
"reference": "28b51e11237f25cdb0efaea8e45af26007831aa9",
|
||||
"url": "https://api.github.com/repos/guzzle/guzzle/zipball/6c72627de1d66832e4270e36e56acdb0d1d8f282",
|
||||
"reference": "6c72627de1d66832e4270e36e56acdb0d1d8f282",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -592,7 +592,7 @@
|
|||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-ring": "5.0-dev"
|
||||
"dev-master": "5.0-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
|
@ -622,7 +622,7 @@
|
|||
"rest",
|
||||
"web service"
|
||||
],
|
||||
"time": "2014-10-13 03:05:51"
|
||||
"time": "2014-11-04 07:09:15"
|
||||
},
|
||||
{
|
||||
"name": "guzzlehttp/ringphp",
|
||||
|
|
|
@ -671,66 +671,6 @@
|
|||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "guzzlehttp/guzzle",
|
||||
"version": "5.0.0",
|
||||
"version_normalized": "5.0.0.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/guzzle/guzzle.git",
|
||||
"reference": "28b51e11237f25cdb0efaea8e45af26007831aa9"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/guzzle/guzzle/zipball/28b51e11237f25cdb0efaea8e45af26007831aa9",
|
||||
"reference": "28b51e11237f25cdb0efaea8e45af26007831aa9",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"guzzlehttp/ringphp": "~1.0",
|
||||
"php": ">=5.4.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"ext-curl": "*",
|
||||
"phpunit/phpunit": "~4.0",
|
||||
"psr/log": "~1.0"
|
||||
},
|
||||
"time": "2014-10-13 03:05:51",
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-ring": "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": "mikey179/vfsStream",
|
||||
"version": "v1.4.0",
|
||||
|
@ -2645,5 +2585,65 @@
|
|||
"feed",
|
||||
"zf2"
|
||||
]
|
||||
},
|
||||
{
|
||||
"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"
|
||||
]
|
||||
}
|
||||
]
|
||||
|
|
|
@ -1,8 +1,52 @@
|
|||
CHANGELOG
|
||||
=========
|
||||
# CHANGELOG
|
||||
|
||||
5.0.0 (2014-10-12)
|
||||
------------------
|
||||
## 5.0.3 - 2014-11-03
|
||||
|
||||
This change updates query strings so that they are treated as un-encoded values
|
||||
by default where the value represents an un-encoded value to send over the
|
||||
wire. A Query object then encodes the value before sending over the wire. This
|
||||
means that even value query string values (e.g., ":") are url encoded. This
|
||||
makes the Query class match PHP's http_build_query function. However, if you
|
||||
want to send requests over the wire using valid query string characters that do
|
||||
not need to be encoded, then you can provide a string to Url::setQuery() and
|
||||
pass true as the second argument to specify that the query string is a raw
|
||||
string that should not be parsed or encoded (unless a call to getQuery() is
|
||||
subsequently made, forcing the query-string to be converted into a Query
|
||||
object).
|
||||
|
||||
## 5.0.2 - 2014-10-30
|
||||
|
||||
* Added a trailing `\r\n` to multipart/form-data payloads. See
|
||||
https://github.com/guzzle/guzzle/pull/871
|
||||
* Added a `GuzzleHttp\Pool::send()` convenience method to match the docs.
|
||||
* Status codes are now returned as integers. See
|
||||
https://github.com/guzzle/guzzle/issues/881
|
||||
* No longer overwriting an existing `application/x-www-form-urlencoded` header
|
||||
when sending POST requests, allowing for customized headers. See
|
||||
https://github.com/guzzle/guzzle/issues/877
|
||||
* Improved path URL serialization.
|
||||
|
||||
* No longer double percent-encoding characters in the path or query string if
|
||||
they are already encoded.
|
||||
* Now properly encoding the supplied path to a URL object, instead of only
|
||||
encoding ' ' and '?'.
|
||||
* Note: This has been changed in 5.0.3 to now encode query string values by
|
||||
default unless the `rawString` argument is provided when setting the query
|
||||
string on a URL: Now allowing many more characters to be present in the
|
||||
query string without being percent encoded. See http://tools.ietf.org/html/rfc3986#appendix-A
|
||||
|
||||
## 5.0.1 - 2014-10-16
|
||||
|
||||
Bugfix release.
|
||||
|
||||
* Fixed an issue where connection errors still returned response object in
|
||||
error and end events event though the response is unusable. This has been
|
||||
corrected so that a response is not returned in the `getResponse` method of
|
||||
these events if the response did not complete. https://github.com/guzzle/guzzle/issues/867
|
||||
* Fixed an issue where transfer statistics were not being populated in the
|
||||
RingBridge. https://github.com/guzzle/guzzle/issues/866
|
||||
|
||||
## 5.0.0 - 2014-10-12
|
||||
|
||||
Adding support for non-blocking responses and some minor API cleanup.
|
||||
|
||||
|
@ -83,21 +127,18 @@ interfaces.
|
|||
argument. They now accept an associative array of options, including the
|
||||
"size" key and "metadata" key which can be used to provide custom metadata.
|
||||
|
||||
4.2.2 (2014-09-08)
|
||||
------------------
|
||||
## 4.2.2 - 2014-09-08
|
||||
|
||||
* Fixed a memory leak in the CurlAdapter when reusing cURL handles.
|
||||
* No longer using `request_fulluri` in stream adapter proxies.
|
||||
* Relative redirects are now based on the last response, not the first response.
|
||||
|
||||
4.2.1 (2014-08-19)
|
||||
------------------
|
||||
## 4.2.1 - 2014-08-19
|
||||
|
||||
* Ensuring that the StreamAdapter does not always add a Content-Type header
|
||||
* Adding automated github releases with a phar and zip
|
||||
|
||||
4.2.0 (2014-08-17)
|
||||
------------------
|
||||
## 4.2.0 - 2014-08-17
|
||||
|
||||
* Now merging in default options using a case-insensitive comparison.
|
||||
Closes https://github.com/guzzle/guzzle/issues/767
|
||||
|
@ -116,8 +157,7 @@ interfaces.
|
|||
* No longer utilizing the now deprecated namespaced methods from the stream
|
||||
package.
|
||||
|
||||
4.1.8 (2014-08-14)
|
||||
------------------
|
||||
## 4.1.8 - 2014-08-14
|
||||
|
||||
* Fixed an issue in the CurlFactory that caused setting the `stream=false`
|
||||
request option to throw an exception.
|
||||
|
@ -128,8 +168,7 @@ interfaces.
|
|||
when creating POST requests to force multipart bodies.
|
||||
See https://github.com/guzzle/guzzle/issues/768
|
||||
|
||||
4.1.7 (2014-08-07)
|
||||
------------------
|
||||
## 4.1.7 - 2014-08-07
|
||||
|
||||
* Fixed an error in the HistoryPlugin that caused the same request and response
|
||||
to be logged multiple times when an HTTP protocol error occurs.
|
||||
|
@ -145,14 +184,12 @@ interfaces.
|
|||
* Fixed a bug where multipart/form-data POST fields were not correctly
|
||||
aggregated (e.g., values with "&").
|
||||
|
||||
4.1.6 (2014-08-03)
|
||||
------------------
|
||||
## 4.1.6 - 2014-08-03
|
||||
|
||||
* Added helper methods to make it easier to represent messages as strings,
|
||||
including getting the start line and getting headers as a string.
|
||||
|
||||
4.1.5 (2014-08-02)
|
||||
------------------
|
||||
## 4.1.5 - 2014-08-02
|
||||
|
||||
* Automatically retrying cURL "Connection died, retrying a fresh connect"
|
||||
errors when possible.
|
||||
|
@ -160,8 +197,7 @@ interfaces.
|
|||
* Allowing multiple event subscriber listeners to be registered per event by
|
||||
passing an array of arrays of listener configuration.
|
||||
|
||||
4.1.4 (2014-07-22)
|
||||
------------------
|
||||
## 4.1.4 - 2014-07-22
|
||||
|
||||
* Fixed a bug that caused multi-part POST requests with more than one field to
|
||||
serialize incorrectly.
|
||||
|
@ -171,8 +207,7 @@ interfaces.
|
|||
* A `save_to` stream is now created lazily, which means that files are not
|
||||
created on disk unless a request succeeds.
|
||||
|
||||
4.1.3 (2014-07-15)
|
||||
------------------
|
||||
## 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
|
||||
|
@ -185,21 +220,18 @@ interfaces.
|
|||
* Fixing an issue where multi-valued headers were not being utilized correctly
|
||||
in the StreamAdapter
|
||||
|
||||
4.1.2 (2014-06-18)
|
||||
------------------
|
||||
## 4.1.2 - 2014-06-18
|
||||
|
||||
* Added support for sending payloads with GET requests
|
||||
|
||||
4.1.1 (2014-06-08)
|
||||
------------------
|
||||
## 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)
|
||||
------------------
|
||||
## 4.1.0 - 2014-05-27
|
||||
|
||||
* Added a `json` request option to easily serialize JSON payloads.
|
||||
* Added a `GuzzleHttp\json_decode()` wrapper to safely parse JSON.
|
||||
|
@ -218,8 +250,7 @@ interfaces.
|
|||
* Proxy requests using the StreamAdapter now properly use request_fulluri (#632)
|
||||
* Added the ability to set scalars as POST fields (#628)
|
||||
|
||||
4.0.1 (2014-04-04)
|
||||
------------------
|
||||
## 4.0.1 - 2014-04-04
|
||||
|
||||
* The HTTP status code of a response is now set as the exception code of
|
||||
RequestException objects.
|
||||
|
@ -228,8 +259,7 @@ interfaces.
|
|||
* HasDataTrait now initializes the internal data array as an empty array so
|
||||
that the toArray() method always returns an array.
|
||||
|
||||
4.0.0 (2014-03-29)
|
||||
------------------
|
||||
## 4.0.0 - 2014-03-29
|
||||
|
||||
* For more information on the 4.0 transition, see:
|
||||
http://mtdowling.com/blog/2014/03/15/guzzle-4-rc/
|
||||
|
@ -241,8 +271,7 @@ interfaces.
|
|||
You can now pass a callable or an array of associative arrays where each
|
||||
associative array contains the "fn", "priority", and "once" keys.
|
||||
|
||||
4.0.0.rc-2 (2014-03-25)
|
||||
-----------------------
|
||||
## 4.0.0.rc-2 - 2014-03-25
|
||||
|
||||
* Removed `getConfig()` and `setConfig()` from clients to avoid confusion
|
||||
around whether things like base_url, message_factory, etc. should be able to
|
||||
|
@ -266,13 +295,11 @@ interfaces.
|
|||
* Marked deprecation_proxy() as internal
|
||||
* Test server is now a collection of static methods on a class
|
||||
|
||||
4.0.0-rc.1 (2014-03-15)
|
||||
-----------------------
|
||||
## 4.0.0-rc.1 - 2014-03-15
|
||||
|
||||
* See https://github.com/guzzle/guzzle/blob/master/UPGRADING.md#3x-to-40
|
||||
|
||||
3.8.1 (2014-01-28)
|
||||
------------------
|
||||
## 3.8.1 - 2014-01-28
|
||||
|
||||
* Bug: Always using GET requests when redirecting from a 303 response
|
||||
* Bug: CURLOPT_SSL_VERIFYHOST is now correctly set to false when setting `$certificateAuthority` to false in
|
||||
|
@ -290,8 +317,7 @@ interfaces.
|
|||
* Now properly escaping the regular expression delimiter when matching Cookie domains.
|
||||
* Network access is now disabled when loading XML documents
|
||||
|
||||
3.8.0 (2013-12-05)
|
||||
------------------
|
||||
## 3.8.0 - 2013-12-05
|
||||
|
||||
* Added the ability to define a POST name for a file
|
||||
* JSON response parsing now properly walks additionalProperties
|
||||
|
@ -311,8 +337,7 @@ interfaces.
|
|||
* Various fixes to the AsyncPlugin
|
||||
* Cleaned up build scripts
|
||||
|
||||
3.7.4 (2013-10-02)
|
||||
------------------
|
||||
## 3.7.4 - 2013-10-02
|
||||
|
||||
* Bug fix: 0 is now an allowed value in a description parameter that has a default value (#430)
|
||||
* Bug fix: SchemaFormatter now returns an integer when formatting to a Unix timestamp
|
||||
|
@ -322,8 +347,7 @@ interfaces.
|
|||
* Updated the bundled cacert.pem (#419)
|
||||
* OauthPlugin now supports adding authentication to headers or query string (#425)
|
||||
|
||||
3.7.3 (2013-09-08)
|
||||
------------------
|
||||
## 3.7.3 - 2013-09-08
|
||||
|
||||
* Added the ability to get the exception associated with a request/command when using `MultiTransferException` and
|
||||
`CommandTransferException`.
|
||||
|
@ -339,8 +363,7 @@ interfaces.
|
|||
* Bug fix: Properly parsing headers that contain commas contained in quotes
|
||||
* Bug fix: mimetype guessing based on a filename is now case-insensitive
|
||||
|
||||
3.7.2 (2013-08-02)
|
||||
------------------
|
||||
## 3.7.2 - 2013-08-02
|
||||
|
||||
* Bug fix: Properly URL encoding paths when using the PHP-only version of the UriTemplate expander
|
||||
See https://github.com/guzzle/guzzle/issues/371
|
||||
|
@ -355,8 +378,7 @@ interfaces.
|
|||
https://github.com/guzzle/guzzle/pull/380
|
||||
* cURL multi cleanup and optimizations
|
||||
|
||||
3.7.1 (2013-07-05)
|
||||
------------------
|
||||
## 3.7.1 - 2013-07-05
|
||||
|
||||
* Bug fix: Setting default options on a client now works
|
||||
* Bug fix: Setting options on HEAD requests now works. See #352
|
||||
|
@ -371,8 +393,7 @@ interfaces.
|
|||
* Returning `false` if `Guzzle\Http\EntityBody::getContentMd5()` fails
|
||||
* Not setting a `Content-MD5` on a command if calculating the Content-MD5 fails via the CommandContentMd5Plugin
|
||||
|
||||
3.7.0 (2013-06-10)
|
||||
------------------
|
||||
## 3.7.0 - 2013-06-10
|
||||
|
||||
* See UPGRADING.md for more information on how to upgrade.
|
||||
* Requests now support the ability to specify an array of $options when creating a request to more easily modify a
|
||||
|
@ -456,8 +477,7 @@ interfaces.
|
|||
CanCacheStrategyInterface $canCache = null)`
|
||||
* Added `RevalidationInterface::shouldRevalidate(RequestInterface $request, Response $response)`
|
||||
|
||||
3.6.0 (2013-05-29)
|
||||
------------------
|
||||
## 3.6.0 - 2013-05-29
|
||||
|
||||
* ServiceDescription now implements ToArrayInterface
|
||||
* Added command.hidden_params to blacklist certain headers from being treated as additionalParameters
|
||||
|
@ -494,8 +514,7 @@ interfaces.
|
|||
* `Guzzle\Service\Command\CommandInterface` now extends from ToArrayInterface and ArrayAccess
|
||||
* Added the ability to cast Model objects to a string to view debug information.
|
||||
|
||||
3.5.0 (2013-05-13)
|
||||
------------------
|
||||
## 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
|
||||
|
@ -517,14 +536,12 @@ interfaces.
|
|||
and responses that are sent over the wire
|
||||
* Added `getEffectiveUrl()` and `getRedirectCount()` to Response objects
|
||||
|
||||
3.4.3 (2013-04-30)
|
||||
------------------
|
||||
## 3.4.3 - 2013-04-30
|
||||
|
||||
* Bug fix: Fixing bug introduced in 3.4.2 where redirect responses are duplicated on the final redirected response
|
||||
* Added a check to re-extract the temp cacert bundle from the phar before sending each request
|
||||
|
||||
3.4.2 (2013-04-29)
|
||||
------------------
|
||||
## 3.4.2 - 2013-04-29
|
||||
|
||||
* Bug fix: Stream objects now work correctly with "a" and "a+" modes
|
||||
* Bug fix: Removing `Transfer-Encoding: chunked` header when a Content-Length is present
|
||||
|
@ -539,8 +556,7 @@ interfaces.
|
|||
* Cleaned up how manual responses are queued on requests (removed "queued_response" and now using request.before_send)
|
||||
* Configuration loading now allows remote files
|
||||
|
||||
3.4.1 (2013-04-16)
|
||||
------------------
|
||||
## 3.4.1 - 2013-04-16
|
||||
|
||||
* Large refactoring to how CurlMulti handles work. There is now a proxy that sits in front of a pool of CurlMulti
|
||||
handles. This greatly simplifies the implementation, fixes a couple bugs, and provides a small performance boost.
|
||||
|
@ -553,8 +569,7 @@ interfaces.
|
|||
* Added support for oauth_verifier in OAuth signatures
|
||||
* Added support to attempt to retrieve a command first literally, then ucfirst, the with inflection
|
||||
|
||||
3.4.0 (2013-04-11)
|
||||
------------------
|
||||
## 3.4.0 - 2013-04-11
|
||||
|
||||
* Bug fix: URLs are now resolved correctly based on http://tools.ietf.org/html/rfc3986#section-5.2. #289
|
||||
* Bug fix: Absolute URLs with a path in a service description will now properly override the base URL. #289
|
||||
|
@ -584,8 +599,7 @@ interfaces.
|
|||
POST fields or files (the latter is only used when emulating a form POST in the browser).
|
||||
* Lots of cleanup to CurlHandle::factory and RequestFactory::createRequest
|
||||
|
||||
3.3.1 (2013-03-10)
|
||||
------------------
|
||||
## 3.3.1 - 2013-03-10
|
||||
|
||||
* Added the ability to create PHP streaming responses from HTTP requests
|
||||
* Bug fix: Running any filters when parsing response headers with service descriptions
|
||||
|
@ -596,8 +610,7 @@ interfaces.
|
|||
* RequestFactory::create() now uses the key of a POST file when setting the POST file name
|
||||
* Added xmlAllowEmpty to serialize an XML body even if no XML specific parameters are set
|
||||
|
||||
3.3.0 (2013-03-03)
|
||||
------------------
|
||||
## 3.3.0 - 2013-03-03
|
||||
|
||||
* A large number of performance optimizations have been made
|
||||
* Bug fix: Added 'wb' as a valid write mode for streams
|
||||
|
@ -621,8 +634,7 @@ interfaces.
|
|||
* Added support for stale-if-error so that the CachePlugin can now serve stale content from the cache on error
|
||||
* Debug headers can now added to cached response in the CachePlugin
|
||||
|
||||
3.2.0 (2013-02-14)
|
||||
------------------
|
||||
## 3.2.0 - 2013-02-14
|
||||
|
||||
* CurlMulti is no longer reused globally. A new multi object is created per-client. This helps to isolate clients.
|
||||
* URLs with no path no longer contain a "/" by default
|
||||
|
@ -641,8 +653,7 @@ interfaces.
|
|||
* Bug fix: The default exponential backoff BackoffPlugin was not giving when the request threshold was exceeded
|
||||
* Bug fix: Guzzle now takes the first found value when grabbing Cache-Control directives
|
||||
|
||||
3.1.2 (2013-01-27)
|
||||
------------------
|
||||
## 3.1.2 - 2013-01-27
|
||||
|
||||
* Refactored how operation responses are parsed. Visitors now include a before() method responsible for parsing the
|
||||
response body. For example, the XmlVisitor now parses the XML response into an array in the before() method.
|
||||
|
@ -651,15 +662,13 @@ interfaces.
|
|||
* Fixed a bug where redirect responses were not chained correctly using getPreviousResponse()
|
||||
* Setting default headers on a client after setting the user-agent will not erase the user-agent setting
|
||||
|
||||
3.1.1 (2013-01-20)
|
||||
------------------
|
||||
## 3.1.1 - 2013-01-20
|
||||
|
||||
* Adding wildcard support to Guzzle\Common\Collection::getPath()
|
||||
* Adding alias support to ServiceBuilder configs
|
||||
* Adding Guzzle\Service\Resource\CompositeResourceIteratorFactory and cleaning up factory interface
|
||||
|
||||
3.1.0 (2013-01-12)
|
||||
------------------
|
||||
## 3.1.0 - 2013-01-12
|
||||
|
||||
* BC: CurlException now extends from RequestException rather than BadResponseException
|
||||
* BC: Renamed Guzzle\Plugin\Cache\CanCacheStrategyInterface::canCache() to canCacheRequest() and added CanCacheResponse()
|
||||
|
@ -676,23 +685,20 @@ interfaces.
|
|||
* Added `extends` attributes to service description parameters
|
||||
* Added getModels to ServiceDescriptionInterface
|
||||
|
||||
3.0.7 (2012-12-19)
|
||||
------------------
|
||||
## 3.0.7 - 2012-12-19
|
||||
|
||||
* Fixing phar detection when forcing a cacert to system if null or true
|
||||
* Allowing filename to be passed to `Guzzle\Http\Message\Request::setResponseBody()`
|
||||
* Cleaning up `Guzzle\Common\Collection::inject` method
|
||||
* Adding a response_body location to service descriptions
|
||||
|
||||
3.0.6 (2012-12-09)
|
||||
------------------
|
||||
## 3.0.6 - 2012-12-09
|
||||
|
||||
* CurlMulti performance improvements
|
||||
* Adding setErrorResponses() to Operation
|
||||
* composer.json tweaks
|
||||
|
||||
3.0.5 (2012-11-18)
|
||||
------------------
|
||||
## 3.0.5 - 2012-11-18
|
||||
|
||||
* Bug: Fixing an infinite recursion bug caused from revalidating with the CachePlugin
|
||||
* Bug: Response body can now be a string containing "0"
|
||||
|
@ -702,8 +708,7 @@ interfaces.
|
|||
* DefaultRequestSerializer now supports array URI parameter values for URI template expansion
|
||||
* Added better mimetype guessing to requests and post files
|
||||
|
||||
3.0.4 (2012-11-11)
|
||||
------------------
|
||||
## 3.0.4 - 2012-11-11
|
||||
|
||||
* Bug: Fixed a bug when adding multiple cookies to a request to use the correct glue value
|
||||
* Bug: Cookies can now be added that have a name, domain, or value set to "0"
|
||||
|
@ -714,8 +719,7 @@ interfaces.
|
|||
* Added setStream to StreamInterface to actually make it possible to implement custom rewind behavior for entity bodies
|
||||
* Added the ability to create any sort of hash for a stream rather than just an MD5 hash
|
||||
|
||||
3.0.3 (2012-11-04)
|
||||
------------------
|
||||
## 3.0.3 - 2012-11-04
|
||||
|
||||
* Implementing redirects in PHP rather than cURL
|
||||
* Added PECL URI template extension and using as default parser if available
|
||||
|
@ -724,23 +728,20 @@ interfaces.
|
|||
* Adding ToArrayInterface throughout library
|
||||
* Fixing OauthPlugin to create unique nonce values per request
|
||||
|
||||
3.0.2 (2012-10-25)
|
||||
------------------
|
||||
## 3.0.2 - 2012-10-25
|
||||
|
||||
* Magic methods are enabled by default on clients
|
||||
* Magic methods return the result of a command
|
||||
* Service clients no longer require a base_url option in the factory
|
||||
* Bug: Fixed an issue with URI templates where null template variables were being expanded
|
||||
|
||||
3.0.1 (2012-10-22)
|
||||
------------------
|
||||
## 3.0.1 - 2012-10-22
|
||||
|
||||
* Models can now be used like regular collection objects by calling filter, map, etc.
|
||||
* Models no longer require a Parameter structure or initial data in the constructor
|
||||
* Added a custom AppendIterator to get around a PHP bug with the `\AppendIterator`
|
||||
|
||||
3.0.0 (2012-10-15)
|
||||
------------------
|
||||
## 3.0.0 - 2012-10-15
|
||||
|
||||
* Rewrote service description format to be based on Swagger
|
||||
* Now based on JSON schema
|
||||
|
@ -772,13 +773,11 @@ interfaces.
|
|||
* Cleaning up Collection class and removing default values from the get method
|
||||
* Fixed ZF2 cache adapters
|
||||
|
||||
2.8.8 (2012-10-15)
|
||||
------------------
|
||||
## 2.8.8 - 2012-10-15
|
||||
|
||||
* Bug: Fixed a cookie issue that caused dot prefixed domains to not match where popular browsers did
|
||||
|
||||
2.8.7 (2012-09-30)
|
||||
------------------
|
||||
## 2.8.7 - 2012-09-30
|
||||
|
||||
* Bug: Fixed config file aliases for JSON includes
|
||||
* Bug: Fixed cookie bug on a request object by using CookieParser to parse cookies on requests
|
||||
|
@ -792,8 +791,7 @@ interfaces.
|
|||
* Added the ability to remove POST fields from OAuth signatures
|
||||
* OAuth plugin now supports 2-legged OAuth
|
||||
|
||||
2.8.6 (2012-09-05)
|
||||
------------------
|
||||
## 2.8.6 - 2012-09-05
|
||||
|
||||
* Added the ability to modify and build service descriptions
|
||||
* Added the use of visitors to apply parameters to locations in service descriptions using the dynamic command
|
||||
|
@ -807,8 +805,7 @@ interfaces.
|
|||
* The JsonLoader now supports aliasing filenames with different filenames. This allows you to alias something like
|
||||
'_default' with a default JSON configuration file.
|
||||
|
||||
2.8.5 (2012-08-29)
|
||||
------------------
|
||||
## 2.8.5 - 2012-08-29
|
||||
|
||||
* Bug: Suppressed empty arrays from URI templates
|
||||
* Bug: Added the missing $options argument from ServiceDescription::factory to enable caching
|
||||
|
@ -816,8 +813,7 @@ interfaces.
|
|||
* AbstractCommand commands are now invokable
|
||||
* Added a way to get the data used when signing an Oauth request before a request is sent
|
||||
|
||||
2.8.4 (2012-08-15)
|
||||
------------------
|
||||
## 2.8.4 - 2012-08-15
|
||||
|
||||
* Bug: Custom delay time calculations are no longer ignored in the ExponentialBackoffPlugin
|
||||
* Added the ability to transfer entity bodies as a string rather than streamed. This gets around curl error 65. Set `body_as_string` in a request's curl options to enable.
|
||||
|
@ -831,8 +827,7 @@ interfaces.
|
|||
* Added the ability of the MockPlugin to consume mocked request bodies
|
||||
* LogPlugin now exposes request and response objects in the extras array
|
||||
|
||||
2.8.3 (2012-07-30)
|
||||
------------------
|
||||
## 2.8.3 - 2012-07-30
|
||||
|
||||
* Bug: Fixed a case where empty POST requests were sent as GET requests
|
||||
* Bug: Fixed a bug in ExponentialBackoffPlugin that caused fatal errors when retrying an EntityEnclosingRequest that does not have a body
|
||||
|
@ -842,8 +837,7 @@ interfaces.
|
|||
* 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)
|
||||
------------------
|
||||
## 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()``
|
||||
|
@ -851,14 +845,12 @@ interfaces.
|
|||
* QueryString and Collection performance improvements
|
||||
* Allowing dot notation for class paths in filters attribute of a service descriptions
|
||||
|
||||
2.8.1 (2012-07-16)
|
||||
------------------
|
||||
## 2.8.1 - 2012-07-16
|
||||
|
||||
* Loosening Event Dispatcher dependency
|
||||
* POST redirects can now be customized using CURLOPT_POSTREDIR
|
||||
|
||||
2.8.0 (2012-07-15)
|
||||
------------------
|
||||
## 2.8.0 - 2012-07-15
|
||||
|
||||
* BC: Guzzle\Http\Query
|
||||
* Query strings with empty variables will always show an equal sign unless the variable is set to QueryString::BLANK (e.g. ?acl= vs ?acl)
|
||||
|
@ -871,8 +863,7 @@ interfaces.
|
|||
* Cookies are no longer URL decoded by default
|
||||
* Bug: URI template variables set to null are no longer expanded
|
||||
|
||||
2.7.2 (2012-07-02)
|
||||
------------------
|
||||
## 2.7.2 - 2012-07-02
|
||||
|
||||
* BC: Moving things to get ready for subtree splits. Moving Inflection into Common. Moving Guzzle\Http\Parser to Guzzle\Parser.
|
||||
* BC: Removing Guzzle\Common\Batch\Batch::count() and replacing it with isEmpty()
|
||||
|
@ -882,14 +873,12 @@ interfaces.
|
|||
* Allowing deeply nested arrays for composite variables in URI templates
|
||||
* Batch divisors can now return iterators or arrays
|
||||
|
||||
2.7.1 (2012-06-26)
|
||||
------------------
|
||||
## 2.7.1 - 2012-06-26
|
||||
|
||||
* Minor patch to update version number in UA string
|
||||
* Updating build process
|
||||
|
||||
2.7.0 (2012-06-25)
|
||||
------------------
|
||||
## 2.7.0 - 2012-06-25
|
||||
|
||||
* BC: Inflection classes moved to Guzzle\Inflection. No longer static methods. Can now inject custom inflectors into classes.
|
||||
* BC: Removed magic setX methods from commands
|
||||
|
@ -906,8 +895,7 @@ interfaces.
|
|||
* Fixed some tests so that they pass more reliably
|
||||
* Added Guzzle\Common\Log\ArrayLogAdapter
|
||||
|
||||
2.6.6 (2012-06-10)
|
||||
------------------
|
||||
## 2.6.6 - 2012-06-10
|
||||
|
||||
* BC: Removing Guzzle\Http\Plugin\BatchQueuePlugin
|
||||
* BC: Removing Guzzle\Service\Command\CommandSet
|
||||
|
@ -917,8 +905,7 @@ interfaces.
|
|||
* Adding result_type, result_doc, deprecated, and doc_url to service descriptions
|
||||
* Bug: Changed the default cookie header casing back to 'Cookie'
|
||||
|
||||
2.6.5 (2012-06-03)
|
||||
------------------
|
||||
## 2.6.5 - 2012-06-03
|
||||
|
||||
* BC: Renaming Guzzle\Http\Message\RequestInterface::getResourceUri() to getResource()
|
||||
* BC: Removing unused AUTH_BASIC and AUTH_DIGEST constants from
|
||||
|
@ -930,8 +917,7 @@ interfaces.
|
|||
* Adding getCookies() to request interface.
|
||||
* Making it easier to add event subscribers to HasDispatcherInterface classes. Can now directly call addSubscriber()
|
||||
|
||||
2.6.4 (2012-05-30)
|
||||
------------------
|
||||
## 2.6.4 - 2012-05-30
|
||||
|
||||
* BC: Cleaning up how POST files are stored in EntityEnclosingRequest objects. Adding PostFile class.
|
||||
* BC: Moving ApiCommand specific functionality from the Inspector and on to the ApiCommand
|
||||
|
@ -948,8 +934,7 @@ interfaces.
|
|||
* Allowing the result of a command object to be changed
|
||||
* Parsing location and type sub values when instantiating a service description rather than over and over at runtime
|
||||
|
||||
2.6.3 (2012-05-23)
|
||||
------------------
|
||||
## 2.6.3 - 2012-05-23
|
||||
|
||||
* [BC] Guzzle\Common\FromConfigInterface no longer requires any config options.
|
||||
* [BC] Refactoring how POST files are stored on an EntityEnclosingRequest. They are now separate from POST fields.
|
||||
|
@ -963,13 +948,11 @@ interfaces.
|
|||
* Split the Guzzle\Service\Inspector::validateConfig method into two methods. One to initialize when a command is created, and one to validate.
|
||||
* CS updates
|
||||
|
||||
2.6.2 (2012-05-19)
|
||||
------------------
|
||||
## 2.6.2 - 2012-05-19
|
||||
|
||||
* [Http] Better handling of nested scope requests in CurlMulti. Requests are now always prepares in the send() method rather than the addRequest() method.
|
||||
|
||||
2.6.1 (2012-05-19)
|
||||
------------------
|
||||
## 2.6.1 - 2012-05-19
|
||||
|
||||
* [BC] Removing 'path' support in service descriptions. Use 'uri'.
|
||||
* [BC] Guzzle\Service\Inspector::parseDocBlock is now protected. Adding getApiParamsForClass() with cache.
|
||||
|
@ -980,8 +963,7 @@ interfaces.
|
|||
* Adding checks to EntityEnclosingRequest so that empty POST files and fields are ignored.
|
||||
* Making the method signature of Guzzle\Service\Builder\ServiceBuilder::factory more flexible.
|
||||
|
||||
2.6.0 (2012-05-15)
|
||||
------------------
|
||||
## 2.6.0 - 2012-05-15
|
||||
|
||||
* [BC] Moving Guzzle\Service\Builder to Guzzle\Service\Builder\ServiceBuilder
|
||||
* [BC] Executing a Command returns the result of the command rather than the command
|
||||
|
@ -1009,8 +991,7 @@ interfaces.
|
|||
* Adding the ability to include other service builder config files from within XML and JSON files
|
||||
* Moving the parseQuery method out of Url and on to QueryString::fromString() as a static factory method.
|
||||
|
||||
2.5.0 (2012-05-08)
|
||||
------------------
|
||||
## 2.5.0 - 2012-05-08
|
||||
|
||||
* Major performance improvements
|
||||
* [BC] Simplifying Guzzle\Common\Collection. Please check to see if you are using features that are now deprecated.
|
||||
|
|
|
@ -29,7 +29,7 @@ view-docs:
|
|||
tag:
|
||||
$(if $(TAG),,$(error TAG is not defined. Pass via "make tag TAG=4.2.1"))
|
||||
@echo Tagging $(TAG)
|
||||
chag update -m '$(TAG) ()'
|
||||
chag update $(TAG)
|
||||
sed -i '' -e "s/VERSION = '.*'/VERSION = '$(TAG)'/" src/ClientInterface.php
|
||||
php -l src/ClientInterface.php
|
||||
git add -A
|
||||
|
@ -45,6 +45,6 @@ package: burgomaster
|
|||
|
||||
burgomaster:
|
||||
mkdir -p build/artifacts
|
||||
curl -s https://raw.githubusercontent.com/mtdowling/Burgomaster/0.0.1/src/Burgomaster.php > build/artifacts/Burgomaster.php
|
||||
curl -s https://raw.githubusercontent.com/mtdowling/Burgomaster/0.0.2/src/Burgomaster.php > build/artifacts/Burgomaster.php
|
||||
|
||||
.PHONY: docs burgomaster
|
||||
|
|
|
@ -52,14 +52,10 @@ The recommended way to install Guzzle is through
|
|||
curl -sS https://getcomposer.org/installer | php
|
||||
```
|
||||
|
||||
Next, update your project's composer.json file to include Guzzle:
|
||||
Next, run the Composer command to install the latest stable version of Guzzle:
|
||||
|
||||
```javascript
|
||||
{
|
||||
"require": {
|
||||
"guzzlehttp/guzzle": "~5.0"
|
||||
}
|
||||
}
|
||||
```bash
|
||||
composer require guzzlehttp/guzzle
|
||||
```
|
||||
|
||||
After installing, you need to require Composer's autoloader:
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
},
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-ring": "5.0-dev"
|
||||
"dev-master": "5.0-dev"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -202,12 +202,12 @@ priority of the listener (as shown in the ``before`` listener in the example).
|
|||
];
|
||||
}
|
||||
|
||||
public function onBefore(BeforeEvent $event, $name, EmitterInterface $emitter)
|
||||
public function onBefore(BeforeEvent $event, $name)
|
||||
{
|
||||
echo 'Before!';
|
||||
}
|
||||
|
||||
public function onComplete(CompleteEvent $event, $name, EmitterInterface $emitter)
|
||||
public function onComplete(CompleteEvent $event, $name)
|
||||
{
|
||||
echo 'Complete!';
|
||||
}
|
||||
|
|
|
@ -97,7 +97,7 @@ exception.
|
|||
|
||||
.. code-block:: php
|
||||
|
||||
$request = $client->createRequest('GET', ['future' => true']);
|
||||
$request = $client->createRequest('GET', ['future' => true]);
|
||||
$client->send($request)->then(function ($response) {
|
||||
echo 'Got a response! ' . $response;
|
||||
});
|
||||
|
@ -107,7 +107,7 @@ of a response.
|
|||
|
||||
.. code-block:: php
|
||||
|
||||
$request = $client->createRequest('GET', ['future' => true']);
|
||||
$request = $client->createRequest('GET', ['future' => true]);
|
||||
$futureResponse = $client->send($request);
|
||||
$futureResponse->wait();
|
||||
|
||||
|
|
|
@ -38,6 +38,6 @@ up to the RingPHP project using a very simple bridge class
|
|||
Creating a handler
|
||||
------------------
|
||||
|
||||
See the `RingPHP <http://guzzle-ring.readthedocs.org>`_ project
|
||||
See the `RingPHP <http://ringphp.readthedocs.org>`_ project
|
||||
documentation for more information on creating custom handlers that can be
|
||||
used with Guzzle clients.
|
||||
|
|
|
@ -11,7 +11,7 @@ use GuzzleHttp\Message\ResponseInterface;
|
|||
*/
|
||||
interface ClientInterface extends HasEmitterInterface
|
||||
{
|
||||
const VERSION = '5.0.0';
|
||||
const VERSION = '5.0.3';
|
||||
|
||||
/**
|
||||
* Create and return a new {@see RequestInterface} object.
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
namespace GuzzleHttp\Event;
|
||||
|
||||
use GuzzleHttp\Message\ResponseInterface;
|
||||
use GuzzleHttp\Ring\Future\FutureInterface;
|
||||
|
||||
/**
|
||||
* Event that contains transfer statistics, and can be intercepted.
|
||||
|
@ -27,13 +28,23 @@ abstract class AbstractTransferEvent extends AbstractRequestEvent
|
|||
}
|
||||
|
||||
/**
|
||||
* Get the response
|
||||
* Returns true/false if a response is available.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function hasResponse()
|
||||
{
|
||||
return !($this->transaction->response instanceof FutureInterface);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the response.
|
||||
*
|
||||
* @return ResponseInterface|null
|
||||
*/
|
||||
public function getResponse()
|
||||
{
|
||||
return $this->transaction->response;
|
||||
return $this->hasResponse() ? $this->transaction->response : null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -70,7 +70,7 @@ class RequestException extends TransferException
|
|||
return new self('Error completing request', $request, null, $previous);
|
||||
}
|
||||
|
||||
$level = $response->getStatusCode()[0];
|
||||
$level = floor($response->getStatusCode() / 100);
|
||||
if ($level == '4') {
|
||||
$label = 'Client error response';
|
||||
$className = __NAMESPACE__ . '\\ClientException';
|
||||
|
|
|
@ -83,7 +83,7 @@ class Response extends AbstractMessage implements ResponseInterface
|
|||
private $effectiveUrl;
|
||||
|
||||
/**
|
||||
* @param string $statusCode The response status code (e.g. 200)
|
||||
* @param int|string $statusCode The response status code (e.g. 200)
|
||||
* @param array $headers The response headers
|
||||
* @param StreamInterface $body The body of the response
|
||||
* @param array $options Response message options
|
||||
|
@ -96,7 +96,7 @@ class Response extends AbstractMessage implements ResponseInterface
|
|||
StreamInterface $body = null,
|
||||
array $options = []
|
||||
) {
|
||||
$this->statusCode = (string) $statusCode;
|
||||
$this->statusCode = (int) $statusCode;
|
||||
$this->handleOptions($options);
|
||||
|
||||
// Assume a reason phrase if one was not applied as an option
|
||||
|
@ -122,7 +122,7 @@ class Response extends AbstractMessage implements ResponseInterface
|
|||
|
||||
public function setStatusCode($code)
|
||||
{
|
||||
return $this->statusCode = $code;
|
||||
return $this->statusCode = (int) $code;
|
||||
}
|
||||
|
||||
public function getReasonPhrase()
|
||||
|
|
|
@ -12,14 +12,14 @@ interface ResponseInterface extends MessageInterface
|
|||
* The Status-Code is a 3-digit integer result code of the server's attempt
|
||||
* to understand and satisfy the request.
|
||||
*
|
||||
* @return integer Status code.
|
||||
* @return int Status code.
|
||||
*/
|
||||
public function getStatusCode();
|
||||
|
||||
/**
|
||||
* Sets the status code of this response.
|
||||
*
|
||||
* @param integer $code The 3-digit integer result code to set.
|
||||
* @param int $code The 3-digit integer result code to set.
|
||||
*/
|
||||
public function setStatusCode($code);
|
||||
|
||||
|
|
|
@ -127,6 +127,22 @@ class Pool implements FutureInterface
|
|||
return new BatchResults($hash);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a Pool and immediately sends the requests.
|
||||
*
|
||||
* @param ClientInterface $client Client used to send the requests
|
||||
* @param array|\Iterator $requests Requests to send in parallel
|
||||
* @param array $options Passes through the options available in
|
||||
* {@see GuzzleHttp\Pool::__construct}
|
||||
*/
|
||||
public static function send(
|
||||
ClientInterface $client,
|
||||
$requests,
|
||||
array $options = []
|
||||
) {
|
||||
(new self($client, $requests, $options))->wait();
|
||||
}
|
||||
|
||||
public function wait()
|
||||
{
|
||||
if ($this->isRealized) {
|
||||
|
|
|
@ -101,8 +101,8 @@ class MultipartBody implements StreamInterface
|
|||
$stream->addStream(Stream::factory("\r\n"));
|
||||
}
|
||||
|
||||
// Add the trailing boundary
|
||||
$stream->addStream(Stream::factory("--{$this->boundary}--"));
|
||||
// Add the trailing boundary with CRLF
|
||||
$stream->addStream(Stream::factory("--{$this->boundary}--\r\n"));
|
||||
|
||||
return $stream;
|
||||
}
|
||||
|
|
|
@ -38,8 +38,11 @@ class PostBody implements PostBodyInterface
|
|||
'Content-Type',
|
||||
'multipart/form-data; boundary=' . $this->getBody()->getBoundary()
|
||||
);
|
||||
} elseif ($this->fields) {
|
||||
$request->setHeader('Content-Type', 'application/x-www-form-urlencoded');
|
||||
} elseif ($this->fields && !$request->hasHeader('Content-Type')) {
|
||||
$request->setHeader(
|
||||
'Content-Type',
|
||||
'application/x-www-form-urlencoded'
|
||||
);
|
||||
}
|
||||
|
||||
if ($size = $this->getSize()) {
|
||||
|
|
|
@ -9,9 +9,8 @@ class Query extends Collection
|
|||
const RFC3986 = 'RFC3986';
|
||||
const RFC1738 = 'RFC1738';
|
||||
|
||||
/** @var bool URL encode fields and values */
|
||||
private $encoding = self::RFC3986;
|
||||
|
||||
/** @var callable Encoding function */
|
||||
private $encoding = 'rawurlencode';
|
||||
/** @var callable */
|
||||
private $aggregator;
|
||||
|
||||
|
@ -75,27 +74,16 @@ class Query extends Collection
|
|||
|
||||
$result = '';
|
||||
$aggregator = $this->aggregator;
|
||||
$encoder = $this->encoding;
|
||||
|
||||
foreach ($aggregator($this->data) as $key => $values) {
|
||||
foreach ($values as $value) {
|
||||
if ($result) {
|
||||
$result .= '&';
|
||||
}
|
||||
if ($this->encoding == self::RFC1738) {
|
||||
$result .= urlencode($key);
|
||||
if ($value !== null) {
|
||||
$result .= '=' . urlencode($value);
|
||||
}
|
||||
} elseif ($this->encoding == self::RFC3986) {
|
||||
$result .= rawurlencode($key);
|
||||
if ($value !== null) {
|
||||
$result .= '=' . rawurlencode($value);
|
||||
}
|
||||
} else {
|
||||
$result .= $key;
|
||||
if ($value !== null) {
|
||||
$result .= '=' . $value;
|
||||
}
|
||||
$result .= $encoder($key);
|
||||
if ($value !== null) {
|
||||
$result .= '=' . $encoder($value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -129,10 +117,18 @@ class Query extends Collection
|
|||
*/
|
||||
public function setEncodingType($type)
|
||||
{
|
||||
if ($type === false || $type === self::RFC1738 || $type === self::RFC3986) {
|
||||
$this->encoding = $type;
|
||||
} else {
|
||||
throw new \InvalidArgumentException('Invalid URL encoding type');
|
||||
switch ($type) {
|
||||
case self::RFC3986:
|
||||
$this->encoding = 'rawurlencode';
|
||||
break;
|
||||
case self::RFC1738:
|
||||
$this->encoding = 'urlencode';
|
||||
break;
|
||||
case false:
|
||||
$this->encoding = function ($v) { return $v; };
|
||||
break;
|
||||
default:
|
||||
throw new \InvalidArgumentException('Invalid URL encoding type');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -87,8 +87,8 @@ class RingBridge
|
|||
callable $fsm
|
||||
) {
|
||||
$trans->state = 'complete';
|
||||
$trans->transferInfo = isset($response['transfer_info'])
|
||||
? $response['transfer_info'] : [];
|
||||
$trans->transferInfo = isset($response['transfer_stats'])
|
||||
? $response['transfer_stats'] : [];
|
||||
|
||||
if (!empty($response['status'])) {
|
||||
$options = [];
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
<?php
|
||||
namespace GuzzleHttp;
|
||||
|
||||
use GuzzleHttp\Ring\Core;
|
||||
|
||||
/**
|
||||
* Parses and generates URLs based on URL parts
|
||||
*/
|
||||
|
@ -14,8 +16,9 @@ class Url
|
|||
private $path = '';
|
||||
private $fragment;
|
||||
private static $defaultPorts = ['http' => 80, 'https' => 443, 'ftp' => 21];
|
||||
|
||||
/** @var Query Query part of the URL */
|
||||
private static $pathPattern = '/[^a-zA-Z0-9\-\._~!\$&\'\(\)\*\+,;=%:@\/]+|%(?![A-Fa-f0-9]{2})/';
|
||||
private static $queryPattern = '/[^a-zA-Z0-9\-\._~!\$\'\(\)\*\+,;%:@\/\?=&]+|%(?![A-Fa-f0-9]{2})/';
|
||||
/** @var Query|string Query part of the URL */
|
||||
private $query;
|
||||
|
||||
/**
|
||||
|
@ -28,9 +31,9 @@ class Url
|
|||
*/
|
||||
public static function fromString($url)
|
||||
{
|
||||
static $defaults = array('scheme' => null, 'host' => null,
|
||||
static $defaults = ['scheme' => null, 'host' => null,
|
||||
'path' => null, 'port' => null, 'query' => null,
|
||||
'user' => null, 'pass' => null, 'fragment' => null);
|
||||
'user' => null, 'pass' => null, 'fragment' => null];
|
||||
|
||||
if (false === ($parts = parse_url($url))) {
|
||||
throw new \InvalidArgumentException('Unable to parse malformed '
|
||||
|
@ -116,14 +119,14 @@ class Url
|
|||
/**
|
||||
* Create a new URL from URL parts
|
||||
*
|
||||
* @param string $scheme Scheme of the URL
|
||||
* @param string $host Host of the URL
|
||||
* @param string $username Username of the URL
|
||||
* @param string $password Password of the URL
|
||||
* @param int $port Port of the URL
|
||||
* @param string $path Path of the URL
|
||||
* @param string $scheme Scheme of the URL
|
||||
* @param string $host Host of the URL
|
||||
* @param string $username Username of the URL
|
||||
* @param string $password Password of the URL
|
||||
* @param int $port Port of the URL
|
||||
* @param string $path Path of the URL
|
||||
* @param Query|array|string $query Query string of the URL
|
||||
* @param string $fragment Fragment of the URL
|
||||
* @param string $fragment Fragment of the URL
|
||||
*/
|
||||
public function __construct(
|
||||
$scheme,
|
||||
|
@ -141,11 +144,11 @@ class Url
|
|||
$this->username = $username;
|
||||
$this->password = $password;
|
||||
$this->fragment = $fragment;
|
||||
if (!$query) {
|
||||
$this->query = new Query();
|
||||
} else {
|
||||
|
||||
if ($query) {
|
||||
$this->setQuery($query);
|
||||
}
|
||||
|
||||
$this->setPath($path);
|
||||
}
|
||||
|
||||
|
@ -154,7 +157,9 @@ class Url
|
|||
*/
|
||||
public function __clone()
|
||||
{
|
||||
$this->query = clone $this->query;
|
||||
if ($this->query instanceof Query) {
|
||||
$this->query = clone $this->query;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -222,8 +227,9 @@ class Url
|
|||
public function setScheme($scheme)
|
||||
{
|
||||
// Remove the default port if one is specified
|
||||
if ($this->port && isset(self::$defaultPorts[$this->scheme]) &&
|
||||
self::$defaultPorts[$this->scheme] == $this->port
|
||||
if ($this->port
|
||||
&& isset(self::$defaultPorts[$this->scheme])
|
||||
&& self::$defaultPorts[$this->scheme] == $this->port
|
||||
) {
|
||||
$this->port = null;
|
||||
}
|
||||
|
@ -271,15 +277,15 @@ class Url
|
|||
}
|
||||
|
||||
/**
|
||||
* Set the path part of the URL
|
||||
* Set the path part of the URL.
|
||||
*
|
||||
* The provided URL is URL encoded as necessary.
|
||||
*
|
||||
* @param string $path Path string to set
|
||||
*/
|
||||
public function setPath($path)
|
||||
{
|
||||
static $search = [' ', '?'];
|
||||
static $replace = ['%20', '%3F'];
|
||||
$this->path = str_replace($search, $replace, $path);
|
||||
$this->path = self::encodePath($path);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -411,29 +417,52 @@ class Url
|
|||
*/
|
||||
public function getQuery()
|
||||
{
|
||||
// Convert the query string to a query object if not already done.
|
||||
if (!$this->query instanceof Query) {
|
||||
$this->query = $this->query === null
|
||||
? new Query()
|
||||
: Query::fromString($this->query);
|
||||
}
|
||||
|
||||
return $this->query;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the query part of the URL
|
||||
* Set the query part of the URL.
|
||||
*
|
||||
* You may provide a query string as a string and pass $rawString as true
|
||||
* to provide a query string that is not parsed until a call to getQuery()
|
||||
* is made. Setting a raw query string will still encode invalid characters
|
||||
* in a query string.
|
||||
*
|
||||
* @param Query|string|array $query Query string value to set. Can
|
||||
* be a string that will be parsed into a Query object, an array
|
||||
* of key value pairs, or a Query object.
|
||||
* @param bool $rawString Set to true when providing a raw query string.
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function setQuery($query)
|
||||
public function setQuery($query, $rawString = false)
|
||||
{
|
||||
if ($query instanceof Query) {
|
||||
$this->query = $query;
|
||||
} elseif (is_string($query)) {
|
||||
$this->query = Query::fromString($query);
|
||||
if (!$rawString) {
|
||||
$this->query = Query::fromString($query);
|
||||
} else {
|
||||
// Ensure the query does not have illegal characters.
|
||||
$this->query = preg_replace_callback(
|
||||
self::$queryPattern,
|
||||
[__CLASS__, 'encodeMatch'],
|
||||
$query
|
||||
);
|
||||
}
|
||||
|
||||
} elseif (is_array($query)) {
|
||||
$this->query = new Query($query);
|
||||
} else {
|
||||
throw new \InvalidArgumentException('Query must be a Query, '
|
||||
. 'array, or string. ' . gettype($query) . ' provided.');
|
||||
. 'array, or string. Got ' . Core::describeType($query));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -491,16 +520,7 @@ class Url
|
|||
|
||||
// Passing a URL with a scheme overrides everything
|
||||
if ($parts['scheme']) {
|
||||
return new static(
|
||||
$parts['scheme'],
|
||||
$parts['host'],
|
||||
$parts['user'],
|
||||
$parts['pass'],
|
||||
$parts['port'],
|
||||
$parts['path'],
|
||||
clone $parts['query'],
|
||||
$parts['fragment']
|
||||
);
|
||||
return clone $url;
|
||||
}
|
||||
|
||||
// Setting a host overrides the entire rest of the URL
|
||||
|
@ -512,7 +532,9 @@ class Url
|
|||
$parts['pass'],
|
||||
$parts['port'],
|
||||
$parts['path'],
|
||||
clone $parts['query'],
|
||||
$parts['query'] instanceof Query
|
||||
? clone $parts['query']
|
||||
: $parts['query'],
|
||||
$parts['fragment']
|
||||
);
|
||||
}
|
||||
|
@ -520,7 +542,7 @@ class Url
|
|||
if (!$parts['path'] && $parts['path'] !== '0') {
|
||||
// The relative URL has no path, so check if it is just a query
|
||||
$path = $this->path ?: '';
|
||||
$query = count($parts['query']) ? $parts['query'] : $this->query;
|
||||
$query = $parts['query'] ?: $this->query;
|
||||
} else {
|
||||
$query = $parts['query'];
|
||||
if ($parts['path'][0] == '/' || !$this->path) {
|
||||
|
@ -541,7 +563,7 @@ class Url
|
|||
$this->password,
|
||||
$this->port,
|
||||
$path,
|
||||
clone $query,
|
||||
$query instanceof Query ? clone $query : $query,
|
||||
$parts['fragment']
|
||||
);
|
||||
|
||||
|
@ -551,4 +573,23 @@ class Url
|
|||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Encodes the path part of a URL without double-encoding percent-encoded
|
||||
* key value pairs.
|
||||
*
|
||||
* @param string $path Path to encode
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function encodePath($path)
|
||||
{
|
||||
static $cb = [__CLASS__, 'encodeMatch'];
|
||||
return preg_replace_callback(self::$pathPattern, $cb, $path);
|
||||
}
|
||||
|
||||
private static function encodeMatch(array $match)
|
||||
{
|
||||
return rawurlencode($match[0]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,6 +30,7 @@ class AbstractTransferEventTest extends \PHPUnit_Framework_TestCase
|
|||
$e = $this->getMockBuilder('GuzzleHttp\Event\AbstractTransferEvent')
|
||||
->setConstructorArgs([$t])
|
||||
->getMockForAbstractClass();
|
||||
$this->assertTrue($e->hasResponse());
|
||||
$this->assertSame($t->response, $e->getResponse());
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,73 @@
|
|||
<?php
|
||||
namespace GuzzleHttp\Tests;
|
||||
|
||||
use GuzzleHttp\Client;
|
||||
use GuzzleHttp\Event\AbstractTransferEvent;
|
||||
use GuzzleHttp\Event\EndEvent;
|
||||
use GuzzleHttp\Message\Response;
|
||||
use GuzzleHttp\Pool;
|
||||
|
||||
class IntegrationTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @issue https://github.com/guzzle/guzzle/issues/867
|
||||
*/
|
||||
public function testDoesNotFailInEventSystemForNetworkError()
|
||||
{
|
||||
$c = new Client();
|
||||
$r = $c->createRequest(
|
||||
'GET',
|
||||
Server::$url,
|
||||
[
|
||||
'timeout' => 1,
|
||||
'connect_timeout' => 1,
|
||||
'proxy' => 'http://127.0.0.1:123/foo'
|
||||
]
|
||||
);
|
||||
|
||||
$events = [];
|
||||
$fn = function(AbstractTransferEvent $event) use (&$events) {
|
||||
$events[] = [
|
||||
get_class($event),
|
||||
$event->hasResponse(),
|
||||
$event->getResponse()
|
||||
];
|
||||
};
|
||||
|
||||
$pool = new Pool($c, [$r], [
|
||||
'error' => $fn,
|
||||
'end' => $fn
|
||||
]);
|
||||
|
||||
$pool->wait();
|
||||
|
||||
$this->assertCount(2, $events);
|
||||
$this->assertEquals('GuzzleHttp\Event\ErrorEvent', $events[0][0]);
|
||||
$this->assertFalse($events[0][1]);
|
||||
$this->assertNull($events[0][2]);
|
||||
|
||||
$this->assertEquals('GuzzleHttp\Event\EndEvent', $events[1][0]);
|
||||
$this->assertFalse($events[1][1]);
|
||||
$this->assertNull($events[1][2]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @issue https://github.com/guzzle/guzzle/issues/866
|
||||
*/
|
||||
public function testProperyGetsTransferStats()
|
||||
{
|
||||
$transfer = [];
|
||||
Server::enqueue([new Response(200)]);
|
||||
$c = new Client();
|
||||
$response = $c->get(Server::$url . '/foo', [
|
||||
'events' => [
|
||||
'end' => function (EndEvent $e) use (&$transfer) {
|
||||
$transfer = $e->getTransferInfo();
|
||||
}
|
||||
]
|
||||
]);
|
||||
$this->assertEquals(Server::$url . '/foo', $response->getEffectiveUrl());
|
||||
$this->assertNotEmpty($transfer);
|
||||
$this->assertArrayHasKey('url', $transfer);
|
||||
}
|
||||
}
|
|
@ -555,7 +555,7 @@ class MessageFactoryTest extends \PHPUnit_Framework_TestCase
|
|||
$client->getEmitter()->attach($history);
|
||||
$client->post('http://foo.com', [
|
||||
'headers' => ['Content-Type' => 'multipart/form-data'],
|
||||
'body' => ['foo' => 'bar']
|
||||
'body' => ['foo' => 'bar']
|
||||
]);
|
||||
$this->assertContains(
|
||||
'multipart/form-data; boundary=',
|
||||
|
|
|
@ -216,4 +216,16 @@ class PoolTest extends \PHPUnit_Framework_TestCase
|
|||
$this->assertCount(1, $result);
|
||||
$this->assertInstanceOf('GuzzleHttp\Exception\ClientException', $result[0]);
|
||||
}
|
||||
|
||||
public function testHasSendMethod()
|
||||
{
|
||||
$client = new Client();
|
||||
$responses = [new Response(404)];
|
||||
$history = new History();
|
||||
$client->getEmitter()->attach($history);
|
||||
$client->getEmitter()->attach(new Mock($responses));
|
||||
$requests = [$client->createRequest('GET', 'http://foo.com/baz')];
|
||||
Pool::send($client, $requests);
|
||||
$this->assertCount(1, $history);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -239,4 +239,18 @@ class PostBodyTest extends \PHPUnit_Framework_TestCase
|
|||
$b = new PostBody();
|
||||
$b->attach('foo');
|
||||
}
|
||||
|
||||
public function testDoesNotOverwriteExistingHeaderForUrlencoded()
|
||||
{
|
||||
$m = new Request('POST', 'http://foo.com', [
|
||||
'content-type' => 'application/x-www-form-urlencoded; charset=utf-8'
|
||||
]);
|
||||
$b = new PostBody();
|
||||
$b->setField('foo', 'bar');
|
||||
$b->applyRequestHeaders($m);
|
||||
$this->assertEquals(
|
||||
'application/x-www-form-urlencoded; charset=utf-8',
|
||||
$m->getHeader('Content-Type')
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -155,4 +155,17 @@ class QueryTest extends \PHPUnit_Framework_TestCase
|
|||
$this->assertEquals('bar baz', $q['foo']);
|
||||
$this->assertEquals('foo=bar%20baz', (string) $q);
|
||||
}
|
||||
|
||||
public function testQueryStringsAllowSlashButDoesNotDecodeWhenDisable()
|
||||
{
|
||||
$q = Query::fromString('foo=bar%2Fbaz&bam=boo%20boo', Query::RFC3986);
|
||||
$q->setEncodingType(false);
|
||||
$this->assertEquals('foo=bar/baz&bam=boo boo', (string) $q);
|
||||
}
|
||||
|
||||
public function testQueryStringsAllowDecodingEncodingCompletelyDisabled()
|
||||
{
|
||||
$q = Query::fromString('foo=bar%2Fbaz&bam=boo boo!', false);
|
||||
$this->assertEquals('foo=bar%2Fbaz&bam=boo boo!', (string) $q);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -245,7 +245,7 @@ class UrlTest extends \PHPUnit_Framework_TestCase
|
|||
$url->setScheme('https');
|
||||
$this->assertEquals('https', $url->getScheme());
|
||||
$url->setQuery('a=123');
|
||||
$this->assertEquals('a=123', $url->getQuery());
|
||||
$this->assertEquals('a=123', (string) $url->getQuery());
|
||||
$this->assertEquals(
|
||||
'https://b:a@example.com:8080/foo/bar?a=123#abc',
|
||||
(string) $url
|
||||
|
@ -256,6 +256,12 @@ class UrlTest extends \PHPUnit_Framework_TestCase
|
|||
'https://b:a@example.com:8080/foo/bar?b=boo#abc',
|
||||
(string) $url
|
||||
);
|
||||
|
||||
$url->setQuery('a%20=bar!', true);
|
||||
$this->assertEquals(
|
||||
'https://b:a@example.com:8080/foo/bar?a%20=bar!#abc',
|
||||
(string) $url
|
||||
);
|
||||
}
|
||||
|
||||
public function testSetQueryAcceptsArray()
|
||||
|
@ -274,6 +280,17 @@ class UrlTest extends \PHPUnit_Framework_TestCase
|
|||
$url->setQuery(false);
|
||||
}
|
||||
|
||||
public function testDefersParsingAndEncodingQueryUntilNecessary()
|
||||
{
|
||||
$url = Url::fromString('http://www.test.com');
|
||||
// Note that invalid characters are encoded.
|
||||
$url->setQuery('foo#bar/', true);
|
||||
$this->assertEquals('http://www.test.com?foo%23bar/', (string) $url);
|
||||
$this->assertInternalType('string', $this->readAttribute($url, 'query'));
|
||||
$this->assertEquals('foo%23bar%2F', (string) $url->getQuery());
|
||||
$this->assertInstanceOf('GuzzleHttp\Query', $this->readAttribute($url, 'query'));
|
||||
}
|
||||
|
||||
public function urlProvider()
|
||||
{
|
||||
return array(
|
||||
|
@ -330,4 +347,10 @@ class UrlTest extends \PHPUnit_Framework_TestCase
|
|||
$url->addPath('?');
|
||||
$this->assertEquals('http://foo.com/baz%20bar/%3F?a=b', (string) $url);
|
||||
}
|
||||
|
||||
public function testCorrectlyEncodesPathWithoutDoubleEncoding()
|
||||
{
|
||||
$url = Url::fromString('http://foo.com/baz%20 bar:boo/baz!');
|
||||
$this->assertEquals('/baz%20%20bar:boo/baz!', $url->getPath());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue