Commit 45f2030a authored by webchick's avatar webchick

Revert "Issue #2369107 by lussoluca: Update Guzzle to 5.0.3."

Temporary revert; CMF 1.3 is also ready and is a bigger PITA to re-roll.

This reverts commit d806a9bb.
parent 090d5570
...@@ -568,16 +568,16 @@ ...@@ -568,16 +568,16 @@
}, },
{ {
"name": "guzzlehttp/guzzle", "name": "guzzlehttp/guzzle",
"version": "5.0.3", "version": "5.0.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/guzzle/guzzle.git", "url": "https://github.com/guzzle/guzzle.git",
"reference": "6c72627de1d66832e4270e36e56acdb0d1d8f282" "reference": "28b51e11237f25cdb0efaea8e45af26007831aa9"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/guzzle/guzzle/zipball/6c72627de1d66832e4270e36e56acdb0d1d8f282", "url": "https://api.github.com/repos/guzzle/guzzle/zipball/28b51e11237f25cdb0efaea8e45af26007831aa9",
"reference": "6c72627de1d66832e4270e36e56acdb0d1d8f282", "reference": "28b51e11237f25cdb0efaea8e45af26007831aa9",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
...@@ -592,7 +592,7 @@ ...@@ -592,7 +592,7 @@
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "5.0-dev" "dev-ring": "5.0-dev"
} }
}, },
"autoload": { "autoload": {
...@@ -622,7 +622,7 @@ ...@@ -622,7 +622,7 @@
"rest", "rest",
"web service" "web service"
], ],
"time": "2014-11-04 07:09:15" "time": "2014-10-13 03:05:51"
}, },
{ {
"name": "guzzlehttp/ringphp", "name": "guzzlehttp/ringphp",
......
...@@ -2528,6 +2528,66 @@ ...@@ -2528,6 +2528,66 @@
} }
] ]
}, },
{
"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": "twig/twig", "name": "twig/twig",
"version": "v1.16.2", "version": "v1.16.2",
...@@ -2586,65 +2646,5 @@ ...@@ -2586,65 +2646,5 @@
"keywords": [ "keywords": [
"templating" "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"
]
} }
] ]
This diff is collapsed.
...@@ -29,7 +29,7 @@ view-docs: ...@@ -29,7 +29,7 @@ view-docs:
tag: tag:
$(if $(TAG),,$(error TAG is not defined. Pass via "make tag TAG=4.2.1")) $(if $(TAG),,$(error TAG is not defined. Pass via "make tag TAG=4.2.1"))
@echo Tagging $(TAG) @echo Tagging $(TAG)
chag update $(TAG) chag update -m '$(TAG) ()'
sed -i '' -e "s/VERSION = '.*'/VERSION = '$(TAG)'/" src/ClientInterface.php sed -i '' -e "s/VERSION = '.*'/VERSION = '$(TAG)'/" src/ClientInterface.php
php -l src/ClientInterface.php php -l src/ClientInterface.php
git add -A git add -A
...@@ -45,6 +45,6 @@ package: burgomaster ...@@ -45,6 +45,6 @@ package: burgomaster
burgomaster: burgomaster:
mkdir -p build/artifacts mkdir -p build/artifacts
curl -s https://raw.githubusercontent.com/mtdowling/Burgomaster/0.0.2/src/Burgomaster.php > build/artifacts/Burgomaster.php curl -s https://raw.githubusercontent.com/mtdowling/Burgomaster/0.0.1/src/Burgomaster.php > build/artifacts/Burgomaster.php
.PHONY: docs burgomaster .PHONY: docs burgomaster
...@@ -52,10 +52,14 @@ The recommended way to install Guzzle is through ...@@ -52,10 +52,14 @@ The recommended way to install Guzzle is through
curl -sS https://getcomposer.org/installer | php curl -sS https://getcomposer.org/installer | php
``` ```
Next, run the Composer command to install the latest stable version of Guzzle: Next, update your project's composer.json file to include Guzzle:
```bash ```javascript
composer require guzzlehttp/guzzle {
"require": {
"guzzlehttp/guzzle": "~5.0"
}
}
``` ```
After installing, you need to require Composer's autoloader: After installing, you need to require Composer's autoloader:
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
}, },
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "5.0-dev" "dev-ring": "5.0-dev"
} }
} }
} }
...@@ -202,12 +202,12 @@ priority of the listener (as shown in the ``before`` listener in the example). ...@@ -202,12 +202,12 @@ priority of the listener (as shown in the ``before`` listener in the example).
]; ];
} }
public function onBefore(BeforeEvent $event, $name) public function onBefore(BeforeEvent $event, $name, EmitterInterface $emitter)
{ {
echo 'Before!'; echo 'Before!';
} }
public function onComplete(CompleteEvent $event, $name) public function onComplete(CompleteEvent $event, $name, EmitterInterface $emitter)
{ {
echo 'Complete!'; echo 'Complete!';
} }
......
...@@ -97,7 +97,7 @@ exception. ...@@ -97,7 +97,7 @@ exception.
.. code-block:: php .. code-block:: php
$request = $client->createRequest('GET', ['future' => true]); $request = $client->createRequest('GET', ['future' => true']);
$client->send($request)->then(function ($response) { $client->send($request)->then(function ($response) {
echo 'Got a response! ' . $response; echo 'Got a response! ' . $response;
}); });
...@@ -107,7 +107,7 @@ of a response. ...@@ -107,7 +107,7 @@ of a response.
.. code-block:: php .. code-block:: php
$request = $client->createRequest('GET', ['future' => true]); $request = $client->createRequest('GET', ['future' => true']);
$futureResponse = $client->send($request); $futureResponse = $client->send($request);
$futureResponse->wait(); $futureResponse->wait();
......
...@@ -38,6 +38,6 @@ up to the RingPHP project using a very simple bridge class ...@@ -38,6 +38,6 @@ up to the RingPHP project using a very simple bridge class
Creating a handler Creating a handler
------------------ ------------------
See the `RingPHP <http://ringphp.readthedocs.org>`_ project See the `RingPHP <http://guzzle-ring.readthedocs.org>`_ project
documentation for more information on creating custom handlers that can be documentation for more information on creating custom handlers that can be
used with Guzzle clients. used with Guzzle clients.
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
*/ */
interface ClientInterface extends HasEmitterInterface interface ClientInterface extends HasEmitterInterface
{ {
const VERSION = '5.0.3'; const VERSION = '5.0.0';
/** /**
* Create and return a new {@see RequestInterface} object. * Create and return a new {@see RequestInterface} object.
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
namespace GuzzleHttp\Event; namespace GuzzleHttp\Event;
use GuzzleHttp\Message\ResponseInterface; use GuzzleHttp\Message\ResponseInterface;
use GuzzleHttp\Ring\Future\FutureInterface;
/** /**
* Event that contains transfer statistics, and can be intercepted. * Event that contains transfer statistics, and can be intercepted.
...@@ -28,23 +27,13 @@ public function getTransferInfo($name = null) ...@@ -28,23 +27,13 @@ public function getTransferInfo($name = null)
} }
/** /**
* Returns true/false if a response is available. * Get the response
*
* @return bool
*/
public function hasResponse()
{
return !($this->transaction->response instanceof FutureInterface);
}
/**
* Get the response.
* *
* @return ResponseInterface|null * @return ResponseInterface|null
*/ */
public function getResponse() public function getResponse()
{ {
return $this->hasResponse() ? $this->transaction->response : null; return $this->transaction->response;
} }
/** /**
......
...@@ -70,7 +70,7 @@ public static function create( ...@@ -70,7 +70,7 @@ public static function create(
return new self('Error completing request', $request, null, $previous); return new self('Error completing request', $request, null, $previous);
} }
$level = floor($response->getStatusCode() / 100); $level = $response->getStatusCode()[0];
if ($level == '4') { if ($level == '4') {
$label = 'Client error response'; $label = 'Client error response';
$className = __NAMESPACE__ . '\\ClientException'; $className = __NAMESPACE__ . '\\ClientException';
......
...@@ -83,7 +83,7 @@ class Response extends AbstractMessage implements ResponseInterface ...@@ -83,7 +83,7 @@ class Response extends AbstractMessage implements ResponseInterface
private $effectiveUrl; private $effectiveUrl;
/** /**
* @param int|string $statusCode The response status code (e.g. 200) * @param string $statusCode The response status code (e.g. 200)
* @param array $headers The response headers * @param array $headers The response headers
* @param StreamInterface $body The body of the response * @param StreamInterface $body The body of the response
* @param array $options Response message options * @param array $options Response message options
...@@ -96,7 +96,7 @@ public function __construct( ...@@ -96,7 +96,7 @@ public function __construct(
StreamInterface $body = null, StreamInterface $body = null,
array $options = [] array $options = []
) { ) {
$this->statusCode = (int) $statusCode; $this->statusCode = (string) $statusCode;
$this->handleOptions($options); $this->handleOptions($options);
// Assume a reason phrase if one was not applied as an option // Assume a reason phrase if one was not applied as an option
...@@ -122,7 +122,7 @@ public function getStatusCode() ...@@ -122,7 +122,7 @@ public function getStatusCode()
public function setStatusCode($code) public function setStatusCode($code)
{ {
return $this->statusCode = (int) $code; return $this->statusCode = $code;
} }
public function getReasonPhrase() public function getReasonPhrase()
......
...@@ -12,14 +12,14 @@ interface ResponseInterface extends MessageInterface ...@@ -12,14 +12,14 @@ interface ResponseInterface extends MessageInterface
* The Status-Code is a 3-digit integer result code of the server's attempt * The Status-Code is a 3-digit integer result code of the server's attempt
* to understand and satisfy the request. * to understand and satisfy the request.
* *
* @return int Status code. * @return integer Status code.
*/ */
public function getStatusCode(); public function getStatusCode();
/** /**
* Sets the status code of this response. * Sets the status code of this response.
* *
* @param int $code The 3-digit integer result code to set. * @param integer $code The 3-digit integer result code to set.
*/ */
public function setStatusCode($code); public function setStatusCode($code);
......
...@@ -127,22 +127,6 @@ public static function batch( ...@@ -127,22 +127,6 @@ public static function batch(
return new BatchResults($hash); 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() public function wait()
{ {
if ($this->isRealized) { if ($this->isRealized) {
......
...@@ -101,8 +101,8 @@ protected function createStream(array $fields, array $files) ...@@ -101,8 +101,8 @@ protected function createStream(array $fields, array $files)
$stream->addStream(Stream::factory("\r\n")); $stream->addStream(Stream::factory("\r\n"));
} }
// Add the trailing boundary with CRLF // Add the trailing boundary
$stream->addStream(Stream::factory("--{$this->boundary}--\r\n")); $stream->addStream(Stream::factory("--{$this->boundary}--"));
return $stream; return $stream;
} }
......
...@@ -38,11 +38,8 @@ public function applyRequestHeaders(RequestInterface $request) ...@@ -38,11 +38,8 @@ public function applyRequestHeaders(RequestInterface $request)
'Content-Type', 'Content-Type',
'multipart/form-data; boundary=' . $this->getBody()->getBoundary() 'multipart/form-data; boundary=' . $this->getBody()->getBoundary()
); );
} elseif ($this->fields && !$request->hasHeader('Content-Type')) { } elseif ($this->fields) {
$request->setHeader( $request->setHeader('Content-Type', 'application/x-www-form-urlencoded');
'Content-Type',
'application/x-www-form-urlencoded'
);
} }
if ($size = $this->getSize()) { if ($size = $this->getSize()) {
......
...@@ -9,8 +9,9 @@ class Query extends Collection ...@@ -9,8 +9,9 @@ class Query extends Collection
const RFC3986 = 'RFC3986'; const RFC3986 = 'RFC3986';
const RFC1738 = 'RFC1738'; const RFC1738 = 'RFC1738';
/** @var callable Encoding function */ /** @var bool URL encode fields and values */
private $encoding = 'rawurlencode'; private $encoding = self::RFC3986;
/** @var callable */ /** @var callable */
private $aggregator; private $aggregator;
...@@ -74,16 +75,27 @@ public function __toString() ...@@ -74,16 +75,27 @@ public function __toString()
$result = ''; $result = '';
$aggregator = $this->aggregator; $aggregator = $this->aggregator;
$encoder = $this->encoding;
foreach ($aggregator($this->data) as $key => $values) { foreach ($aggregator($this->data) as $key => $values) {
foreach ($values as $value) { foreach ($values as $value) {
if ($result) { if ($result) {
$result .= '&'; $result .= '&';
} }
$result .= $encoder($key); if ($this->encoding == self::RFC1738) {
if ($value !== null) { $result .= urlencode($key);
$result .= '=' . $encoder($value); 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;
}
} }
} }
} }
...@@ -117,18 +129,10 @@ public function setAggregator(callable $aggregator) ...@@ -117,18 +129,10 @@ public function setAggregator(callable $aggregator)
*/ */
public function setEncodingType($type) public function setEncodingType($type)
{ {
switch ($type) { if ($type === false || $type === self::RFC1738 || $type === self::RFC3986) {
case self::RFC3986: $this->encoding = $type;
$this->encoding = 'rawurlencode'; } else {
break; throw new \InvalidArgumentException('Invalid URL encoding type');
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 @@ public static function completeRingResponse( ...@@ -87,8 +87,8 @@ public static function completeRingResponse(
callable $fsm callable $fsm
) { ) {
$trans->state = 'complete'; $trans->state = 'complete';
$trans->transferInfo = isset($response['transfer_stats']) $trans->transferInfo = isset($response['transfer_info'])
? $response['transfer_stats'] : []; ? $response['transfer_info'] : [];
if (!empty($response['status'])) { if (!empty($response['status'])) {
$options = []; $options = [];
......