From 81d5c2a6464771c9a180d0214706a2f65f0b1d18 Mon Sep 17 00:00:00 2001 From: josselin Date: Mon, 25 Jan 2016 22:08:02 +0100 Subject: Added php-opencloud/openstack as SubModule --- server/vendor/guzzlehttp/psr7/CHANGELOG.md | 7 +++++ server/vendor/guzzlehttp/psr7/Makefile | 16 ++++++++++ server/vendor/guzzlehttp/psr7/README.md | 5 +++- .../vendor/guzzlehttp/psr7/src/MultipartStream.php | 4 +-- server/vendor/guzzlehttp/psr7/src/Response.php | 1 + server/vendor/guzzlehttp/psr7/src/Uri.php | 17 +++++++---- server/vendor/guzzlehttp/psr7/src/functions.php | 8 +++++ .../vendor/guzzlehttp/psr7/tests/FunctionsTest.php | 10 +++++++ server/vendor/guzzlehttp/psr7/tests/UriTest.php | 34 ++++++++++++++++++++++ 9 files changed, 94 insertions(+), 8 deletions(-) (limited to 'server/vendor/guzzlehttp') diff --git a/server/vendor/guzzlehttp/psr7/CHANGELOG.md b/server/vendor/guzzlehttp/psr7/CHANGELOG.md index 6cdfb39..d875aa3 100644 --- a/server/vendor/guzzlehttp/psr7/CHANGELOG.md +++ b/server/vendor/guzzlehttp/psr7/CHANGELOG.md @@ -1,5 +1,12 @@ # CHANGELOG +## 1.2.2 - 2016-01-22 + +* Added support for URIs without any authority. +* Added support for HTTP 451 'Unavailable For Legal Reasons.' +* Added support for using '0' as a filename. +* Added support for including non-standard ports in Host headers. + ## 1.2.1 - 2015-11-02 * Now supporting negative offsets when seeking to SEEK_END. diff --git a/server/vendor/guzzlehttp/psr7/Makefile b/server/vendor/guzzlehttp/psr7/Makefile index 9c21096..8b00b43 100644 --- a/server/vendor/guzzlehttp/psr7/Makefile +++ b/server/vendor/guzzlehttp/psr7/Makefile @@ -9,5 +9,21 @@ coverage: view-coverage: open artifacts/coverage/index.html +check-tag: + $(if $(TAG),,$(error TAG is not defined. Pass via "make tag TAG=4.2.1")) + +tag: check-tag + @echo Tagging $(TAG) + chag update $(TAG) + git commit -a -m '$(TAG) release' + chag tag + @echo "Release has been created. Push using 'make release'" + @echo "Changes made in the release commit" + git diff HEAD~1 HEAD + +release: check-tag + git push origin master + git push origin $(TAG) + clean: rm -rf artifacts/* diff --git a/server/vendor/guzzlehttp/psr7/README.md b/server/vendor/guzzlehttp/psr7/README.md index 0b30d5a..0a4c341 100644 --- a/server/vendor/guzzlehttp/psr7/README.md +++ b/server/vendor/guzzlehttp/psr7/README.md @@ -6,6 +6,9 @@ functionality like query string parsing. Currently missing ServerRequestInterface and UploadedFileInterface; a pull request for these features is welcome. +[![Build Status](https://travis-ci.org/guzzle/psr7.svg?branch=master)](https://travis-ci.org/guzzle/psr7) + + # Stream implementation This package comes with a number of stream implementations and stream @@ -25,7 +28,7 @@ $a = Psr7\stream_for('abc, '); $b = Psr7\stream_for('123.'); $composed = new Psr7\AppendStream([$a, $b]); -$composed->addStream(Psr7\stream_for(' Above all listen to me'). +$composed->addStream(Psr7\stream_for(' Above all listen to me')); echo $composed(); // abc, 123. Above all listen to me. ``` diff --git a/server/vendor/guzzlehttp/psr7/src/MultipartStream.php b/server/vendor/guzzlehttp/psr7/src/MultipartStream.php index fd006ec..2988fcb 100644 --- a/server/vendor/guzzlehttp/psr7/src/MultipartStream.php +++ b/server/vendor/guzzlehttp/psr7/src/MultipartStream.php @@ -113,7 +113,7 @@ class MultipartStream implements StreamInterface // Set a default content-disposition header if one was no provided $disposition = $this->getHeader($headers, 'content-disposition'); if (!$disposition) { - $headers['Content-Disposition'] = $filename + $headers['Content-Disposition'] = ($filename === '0' || $filename) ? sprintf('form-data; name="%s"; filename="%s"', $name, basename($filename)) @@ -130,7 +130,7 @@ class MultipartStream implements StreamInterface // Set a default Content-Type if one was not supplied $type = $this->getHeader($headers, 'content-type'); - if (!$type && $filename) { + if (!$type && ($filename === '0' || $filename)) { if ($type = mimetype_from_filename($filename)) { $headers['Content-Type'] = $type; } diff --git a/server/vendor/guzzlehttp/psr7/src/Response.php b/server/vendor/guzzlehttp/psr7/src/Response.php index c94bf8f..58c4c6a 100644 --- a/server/vendor/guzzlehttp/psr7/src/Response.php +++ b/server/vendor/guzzlehttp/psr7/src/Response.php @@ -59,6 +59,7 @@ class Response implements ResponseInterface 428 => 'Precondition Required', 429 => 'Too Many Requests', 431 => 'Request Header Fields Too Large', + 451 => 'Unavailable For Legal Reasons', 500 => 'Internal Server Error', 501 => 'Not Implemented', 502 => 'Bad Gateway', diff --git a/server/vendor/guzzlehttp/psr7/src/Uri.php b/server/vendor/guzzlehttp/psr7/src/Uri.php index d428f2e..23fa2a4 100644 --- a/server/vendor/guzzlehttp/psr7/src/Uri.php +++ b/server/vendor/guzzlehttp/psr7/src/Uri.php @@ -477,21 +477,28 @@ class Uri implements UriInterface $uri = ''; if (!empty($scheme)) { - $uri .= $scheme . '://'; + $uri .= $scheme . ':'; } + $hierPart = ''; + if (!empty($authority)) { - $uri .= $authority; + if (!empty($scheme)) { + $hierPart .= '//'; + } + $hierPart .= $authority; } if ($path != null) { // Add a leading slash if necessary. - if ($uri && substr($path, 0, 1) !== '/') { - $uri .= '/'; + if ($hierPart && substr($path, 0, 1) !== '/') { + $hierPart .= '/'; } - $uri .= $path; + $hierPart .= $path; } + $uri .= $hierPart; + if ($query != null) { $uri .= '?' . $query; } diff --git a/server/vendor/guzzlehttp/psr7/src/functions.php b/server/vendor/guzzlehttp/psr7/src/functions.php index fd3e7f5..921a5a8 100644 --- a/server/vendor/guzzlehttp/psr7/src/functions.php +++ b/server/vendor/guzzlehttp/psr7/src/functions.php @@ -209,6 +209,14 @@ function modify_request(RequestInterface $request, array $changes) // Remove the host header if one is on the URI if ($host = $changes['uri']->getHost()) { $changes['set_headers']['Host'] = $host; + + if ($port = $changes['uri']->getPort()) { + $standardPorts = ['http' => 80, 'https' => 443]; + $scheme = $changes['uri']->getScheme(); + if (isset($standardPorts[$scheme]) && $port != $standardPorts[$scheme]) { + $changes['set_headers']['Host'] .= ':'.$port; + } + } } $uri = $changes['uri']; } diff --git a/server/vendor/guzzlehttp/psr7/tests/FunctionsTest.php b/server/vendor/guzzlehttp/psr7/tests/FunctionsTest.php index de5b5cb..65cb954 100644 --- a/server/vendor/guzzlehttp/psr7/tests/FunctionsTest.php +++ b/server/vendor/guzzlehttp/psr7/tests/FunctionsTest.php @@ -546,6 +546,16 @@ class FunctionsTest extends \PHPUnit_Framework_TestCase $this->assertEquals('www.foo.com', (string) $r2->getHeaderLine('host')); } + public function testCanModifyRequestWithUriAndPort() + { + $r1 = new Psr7\Request('GET', 'http://foo.com:8000'); + $r2 = Psr7\modify_request($r1, [ + 'uri' => new Psr7\Uri('http://www.foo.com:8000') + ]); + $this->assertEquals('http://www.foo.com:8000', (string) $r2->getUri()); + $this->assertEquals('www.foo.com:8000', (string) $r2->getHeaderLine('host')); + } + public function testCanModifyRequestWithCaseInsensitiveHeader() { $r1 = new Psr7\Request('GET', 'http://foo.com', ['User-Agent' => 'foo']); diff --git a/server/vendor/guzzlehttp/psr7/tests/UriTest.php b/server/vendor/guzzlehttp/psr7/tests/UriTest.php index 2776920..a63293c 100644 --- a/server/vendor/guzzlehttp/psr7/tests/UriTest.php +++ b/server/vendor/guzzlehttp/psr7/tests/UriTest.php @@ -244,4 +244,38 @@ class UriTest extends \PHPUnit_Framework_TestCase $this->assertEquals('foo', $uri->getPath()); $this->assertEquals('bar.com/foo', (string) $uri); } + + /** + * @dataProvider pathTestNoAuthority + */ + public function testNoAuthority($input) + { + $uri = new Uri($input); + + $this->assertEquals($input, (string) $uri); + } + + public function pathTestNoAuthority() + { + return [ + // path-rootless + ['urn:example:animal:ferret:nose'], + // path-absolute + ['urn:/example:animal:ferret:nose'], + ['urn:/'], + // path-empty + ['urn:'], + ['urn'], + ]; + } + + /** + * @expectedException \InvalidArgumentException + * @expectedExceptionMessage Unable to parse URI + */ + public function testNoAuthorityWithInvalidPath() + { + $input = 'urn://example:animal:ferret:nose'; + $uri = new Uri($input); + } } -- cgit v1.2.3