Răsfoiți Sursa

Updated guzzle

CauseFX 6 ani în urmă
părinte
comite
7e12189672
57 a modificat fișierele cu 1416 adăugiri și 380 ștergeri
  1. 68 20
      api/composer.lock
  2. 1 0
      api/vendor/composer/autoload_files.php
  3. 1 0
      api/vendor/composer/autoload_static.php
  4. 72 22
      api/vendor/composer/installed.json
  5. 23 0
      api/vendor/guzzlehttp/guzzle/.php_cs
  6. 35 0
      api/vendor/guzzlehttp/guzzle/CHANGELOG.md
  7. 18 0
      api/vendor/guzzlehttp/guzzle/Dockerfile
  8. 12 13
      api/vendor/guzzlehttp/guzzle/README.md
  9. 29 14
      api/vendor/guzzlehttp/guzzle/composer.json
  10. 95 6
      api/vendor/guzzlehttp/guzzle/src/Client.php
  11. 5 2
      api/vendor/guzzlehttp/guzzle/src/ClientInterface.php
  12. 5 3
      api/vendor/guzzlehttp/guzzle/src/Cookie/CookieJar.php
  13. 3 3
      api/vendor/guzzlehttp/guzzle/src/Cookie/CookieJarInterface.php
  14. 2 1
      api/vendor/guzzlehttp/guzzle/src/Cookie/FileCookieJar.php
  15. 1 0
      api/vendor/guzzlehttp/guzzle/src/Cookie/SessionCookieJar.php
  16. 2 2
      api/vendor/guzzlehttp/guzzle/src/Cookie/SetCookie.php
  17. 3 1
      api/vendor/guzzlehttp/guzzle/src/Exception/ClientException.php
  18. 20 10
      api/vendor/guzzlehttp/guzzle/src/Exception/GuzzleException.php
  19. 7 0
      api/vendor/guzzlehttp/guzzle/src/Exception/InvalidArgumentException.php
  20. 5 30
      api/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php
  21. 3 1
      api/vendor/guzzlehttp/guzzle/src/Exception/ServerException.php
  22. 3 1
      api/vendor/guzzlehttp/guzzle/src/Exception/TooManyRedirectsException.php
  23. 3 1
      api/vendor/guzzlehttp/guzzle/src/Exception/TransferException.php
  24. 32 12
      api/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php
  25. 27 7
      api/vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php
  26. 8 2
      api/vendor/guzzlehttp/guzzle/src/Handler/MockHandler.php
  27. 18 6
      api/vendor/guzzlehttp/guzzle/src/Handler/StreamHandler.php
  28. 9 5
      api/vendor/guzzlehttp/guzzle/src/HandlerStack.php
  29. 5 0
      api/vendor/guzzlehttp/guzzle/src/MessageFormatter.php
  30. 3 4
      api/vendor/guzzlehttp/guzzle/src/Middleware.php
  31. 13 2
      api/vendor/guzzlehttp/guzzle/src/Pool.php
  32. 5 0
      api/vendor/guzzlehttp/guzzle/src/PrepareBodyMiddleware.php
  33. 23 5
      api/vendor/guzzlehttp/guzzle/src/RedirectMiddleware.php
  34. 9 1
      api/vendor/guzzlehttp/guzzle/src/RequestOptions.php
  35. 19 3
      api/vendor/guzzlehttp/guzzle/src/RetryMiddleware.php
  36. 6 6
      api/vendor/guzzlehttp/guzzle/src/TransferStats.php
  37. 67 6
      api/vendor/guzzlehttp/guzzle/src/functions.php
  38. 194 58
      api/vendor/guzzlehttp/psr7/CHANGELOG.md
  39. 7 1
      api/vendor/guzzlehttp/psr7/README.md
  40. 14 4
      api/vendor/guzzlehttp/psr7/composer.json
  41. 12 4
      api/vendor/guzzlehttp/psr7/src/AppendStream.php
  42. 9 0
      api/vendor/guzzlehttp/psr7/src/FnStream.php
  43. 1 1
      api/vendor/guzzlehttp/psr7/src/InflateStream.php
  44. 1 1
      api/vendor/guzzlehttp/psr7/src/LimitStream.php
  45. 45 15
      api/vendor/guzzlehttp/psr7/src/MessageTrait.php
  46. 11 2
      api/vendor/guzzlehttp/psr7/src/Request.php
  47. 24 2
      api/vendor/guzzlehttp/psr7/src/Response.php
  48. 18 0
      api/vendor/guzzlehttp/psr7/src/Rfc7230.php
  49. 26 8
      api/vendor/guzzlehttp/psr7/src/ServerRequest.php
  50. 39 29
      api/vendor/guzzlehttp/psr7/src/Stream.php
  51. 43 3
      api/vendor/guzzlehttp/psr7/src/StreamWrapper.php
  52. 91 33
      api/vendor/guzzlehttp/psr7/src/Uri.php
  53. 101 30
      api/vendor/guzzlehttp/psr7/src/functions.php
  54. 21 0
      api/vendor/ralouphie/getallheaders/LICENSE
  55. 27 0
      api/vendor/ralouphie/getallheaders/README.md
  56. 26 0
      api/vendor/ralouphie/getallheaders/composer.json
  57. 46 0
      api/vendor/ralouphie/getallheaders/src/getallheaders.php

+ 68 - 20
api/composer.lock

@@ -196,44 +196,46 @@
         },
         {
             "name": "guzzlehttp/guzzle",
-            "version": "6.3.3",
+            "version": "6.5.2",
             "source": {
                 "type": "git",
                 "url": "https://github.com/guzzle/guzzle.git",
-                "reference": "407b0cb880ace85c9b63c5f9551db498cb2d50ba"
+                "reference": "43ece0e75098b7ecd8d13918293029e555a50f82"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/guzzle/guzzle/zipball/407b0cb880ace85c9b63c5f9551db498cb2d50ba",
-                "reference": "407b0cb880ace85c9b63c5f9551db498cb2d50ba",
+                "url": "https://api.github.com/repos/guzzle/guzzle/zipball/43ece0e75098b7ecd8d13918293029e555a50f82",
+                "reference": "43ece0e75098b7ecd8d13918293029e555a50f82",
                 "shasum": ""
             },
             "require": {
+                "ext-json": "*",
                 "guzzlehttp/promises": "^1.0",
-                "guzzlehttp/psr7": "^1.4",
+                "guzzlehttp/psr7": "^1.6.1",
                 "php": ">=5.5"
             },
             "require-dev": {
                 "ext-curl": "*",
                 "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.4 || ^7.0",
-                "psr/log": "^1.0"
+                "psr/log": "^1.1"
             },
             "suggest": {
+                "ext-intl": "Required for Internationalized Domain Name (IDN) support",
                 "psr/log": "Required for using the Log middleware"
             },
             "type": "library",
             "extra": {
                 "branch-alias": {
-                    "dev-master": "6.3-dev"
+                    "dev-master": "6.5-dev"
                 }
             },
             "autoload": {
-                "files": [
-                    "src/functions_include.php"
-                ],
                 "psr-4": {
                     "GuzzleHttp\\": "src/"
-                }
+                },
+                "files": [
+                    "src/functions_include.php"
+                ]
             },
             "notification-url": "https://packagist.org/downloads/",
             "license": [
@@ -257,7 +259,7 @@
                 "rest",
                 "web service"
             ],
-            "time": "2018-04-22T15:46:56+00:00"
+            "time": "2019-12-23T11:57:10+00:00"
         },
         {
             "name": "guzzlehttp/promises",
@@ -312,32 +314,37 @@
         },
         {
             "name": "guzzlehttp/psr7",
-            "version": "1.4.2",
+            "version": "1.6.1",
             "source": {
                 "type": "git",
                 "url": "https://github.com/guzzle/psr7.git",
-                "reference": "f5b8a8512e2b58b0071a7280e39f14f72e05d87c"
+                "reference": "239400de7a173fe9901b9ac7c06497751f00727a"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/guzzle/psr7/zipball/f5b8a8512e2b58b0071a7280e39f14f72e05d87c",
-                "reference": "f5b8a8512e2b58b0071a7280e39f14f72e05d87c",
+                "url": "https://api.github.com/repos/guzzle/psr7/zipball/239400de7a173fe9901b9ac7c06497751f00727a",
+                "reference": "239400de7a173fe9901b9ac7c06497751f00727a",
                 "shasum": ""
             },
             "require": {
                 "php": ">=5.4.0",
-                "psr/http-message": "~1.0"
+                "psr/http-message": "~1.0",
+                "ralouphie/getallheaders": "^2.0.5 || ^3.0.0"
             },
             "provide": {
                 "psr/http-message-implementation": "1.0"
             },
             "require-dev": {
-                "phpunit/phpunit": "~4.0"
+                "ext-zlib": "*",
+                "phpunit/phpunit": "~4.8.36 || ^5.7.27 || ^6.5.8"
+            },
+            "suggest": {
+                "zendframework/zend-httphandlerrunner": "Emit PSR-7 responses"
             },
             "type": "library",
             "extra": {
                 "branch-alias": {
-                    "dev-master": "1.4-dev"
+                    "dev-master": "1.6-dev"
                 }
             },
             "autoload": {
@@ -367,13 +374,14 @@
             "keywords": [
                 "http",
                 "message",
+                "psr-7",
                 "request",
                 "response",
                 "stream",
                 "uri",
                 "url"
             ],
-            "time": "2017-03-20T17:10:46+00:00"
+            "time": "2019-07-01T23:21:34+00:00"
         },
         {
             "name": "illuminate/contracts",
@@ -1142,6 +1150,46 @@
             ],
             "time": "2019-12-03T13:29:13+00:00"
         },
+        {
+            "name": "ralouphie/getallheaders",
+            "version": "3.0.3",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/ralouphie/getallheaders.git",
+                "reference": "120b605dfeb996808c31b6477290a714d356e822"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/120b605dfeb996808c31b6477290a714d356e822",
+                "reference": "120b605dfeb996808c31b6477290a714d356e822",
+                "shasum": ""
+            },
+            "require": {
+                "php": ">=5.6"
+            },
+            "require-dev": {
+                "php-coveralls/php-coveralls": "^2.1",
+                "phpunit/phpunit": "^5 || ^6.5"
+            },
+            "type": "library",
+            "autoload": {
+                "files": [
+                    "src/getallheaders.php"
+                ]
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Ralph Khattar",
+                    "email": "ralph.khattar@gmail.com"
+                }
+            ],
+            "description": "A polyfill for getallheaders.",
+            "time": "2019-03-08T08:55:37+00:00"
+        },
         {
             "name": "rmccue/requests",
             "version": "v1.7.0",

+ 1 - 0
api/vendor/composer/autoload_files.php

@@ -6,6 +6,7 @@ $vendorDir = dirname(dirname(__FILE__));
 $baseDir = dirname($vendorDir);
 
 return array(
+    '7b11c4dc42b3b3023073cb14e519683c' => $vendorDir . '/ralouphie/getallheaders/src/getallheaders.php',
     'c964ee0ededf28c96ebd9db5099ef910' => $vendorDir . '/guzzlehttp/promises/src/functions_include.php',
     'a0edc8309cc5e1d60e3047b5df6b7052' => $vendorDir . '/guzzlehttp/psr7/src/functions_include.php',
     '37a3dc5111fe8f707ab4c132ef1dbc62' => $vendorDir . '/guzzlehttp/guzzle/src/functions_include.php',

+ 1 - 0
api/vendor/composer/autoload_static.php

@@ -7,6 +7,7 @@ namespace Composer\Autoload;
 class ComposerStaticInitcbdc783d76f8e7563dcce7d8af053ecb
 {
     public static $files = array (
+        '7b11c4dc42b3b3023073cb14e519683c' => __DIR__ . '/..' . '/ralouphie/getallheaders/src/getallheaders.php',
         'c964ee0ededf28c96ebd9db5099ef910' => __DIR__ . '/..' . '/guzzlehttp/promises/src/functions_include.php',
         'a0edc8309cc5e1d60e3047b5df6b7052' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/functions_include.php',
         '37a3dc5111fe8f707ab4c132ef1dbc62' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/functions_include.php',

+ 72 - 22
api/vendor/composer/installed.json

@@ -195,47 +195,49 @@
     },
     {
         "name": "guzzlehttp/guzzle",
-        "version": "6.3.3",
-        "version_normalized": "6.3.3.0",
+        "version": "6.5.2",
+        "version_normalized": "6.5.2.0",
         "source": {
             "type": "git",
             "url": "https://github.com/guzzle/guzzle.git",
-            "reference": "407b0cb880ace85c9b63c5f9551db498cb2d50ba"
+            "reference": "43ece0e75098b7ecd8d13918293029e555a50f82"
         },
         "dist": {
             "type": "zip",
-            "url": "https://api.github.com/repos/guzzle/guzzle/zipball/407b0cb880ace85c9b63c5f9551db498cb2d50ba",
-            "reference": "407b0cb880ace85c9b63c5f9551db498cb2d50ba",
+            "url": "https://api.github.com/repos/guzzle/guzzle/zipball/43ece0e75098b7ecd8d13918293029e555a50f82",
+            "reference": "43ece0e75098b7ecd8d13918293029e555a50f82",
             "shasum": ""
         },
         "require": {
+            "ext-json": "*",
             "guzzlehttp/promises": "^1.0",
-            "guzzlehttp/psr7": "^1.4",
+            "guzzlehttp/psr7": "^1.6.1",
             "php": ">=5.5"
         },
         "require-dev": {
             "ext-curl": "*",
             "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.4 || ^7.0",
-            "psr/log": "^1.0"
+            "psr/log": "^1.1"
         },
         "suggest": {
+            "ext-intl": "Required for Internationalized Domain Name (IDN) support",
             "psr/log": "Required for using the Log middleware"
         },
-        "time": "2018-04-22T15:46:56+00:00",
+        "time": "2019-12-23T11:57:10+00:00",
         "type": "library",
         "extra": {
             "branch-alias": {
-                "dev-master": "6.3-dev"
+                "dev-master": "6.5-dev"
             }
         },
         "installation-source": "dist",
         "autoload": {
-            "files": [
-                "src/functions_include.php"
-            ],
             "psr-4": {
                 "GuzzleHttp\\": "src/"
-            }
+            },
+            "files": [
+                "src/functions_include.php"
+            ]
         },
         "notification-url": "https://packagist.org/downloads/",
         "license": [
@@ -315,34 +317,39 @@
     },
     {
         "name": "guzzlehttp/psr7",
-        "version": "1.4.2",
-        "version_normalized": "1.4.2.0",
+        "version": "1.6.1",
+        "version_normalized": "1.6.1.0",
         "source": {
             "type": "git",
             "url": "https://github.com/guzzle/psr7.git",
-            "reference": "f5b8a8512e2b58b0071a7280e39f14f72e05d87c"
+            "reference": "239400de7a173fe9901b9ac7c06497751f00727a"
         },
         "dist": {
             "type": "zip",
-            "url": "https://api.github.com/repos/guzzle/psr7/zipball/f5b8a8512e2b58b0071a7280e39f14f72e05d87c",
-            "reference": "f5b8a8512e2b58b0071a7280e39f14f72e05d87c",
+            "url": "https://api.github.com/repos/guzzle/psr7/zipball/239400de7a173fe9901b9ac7c06497751f00727a",
+            "reference": "239400de7a173fe9901b9ac7c06497751f00727a",
             "shasum": ""
         },
         "require": {
             "php": ">=5.4.0",
-            "psr/http-message": "~1.0"
+            "psr/http-message": "~1.0",
+            "ralouphie/getallheaders": "^2.0.5 || ^3.0.0"
         },
         "provide": {
             "psr/http-message-implementation": "1.0"
         },
         "require-dev": {
-            "phpunit/phpunit": "~4.0"
+            "ext-zlib": "*",
+            "phpunit/phpunit": "~4.8.36 || ^5.7.27 || ^6.5.8"
+        },
+        "suggest": {
+            "zendframework/zend-httphandlerrunner": "Emit PSR-7 responses"
         },
-        "time": "2017-03-20T17:10:46+00:00",
+        "time": "2019-07-01T23:21:34+00:00",
         "type": "library",
         "extra": {
             "branch-alias": {
-                "dev-master": "1.4-dev"
+                "dev-master": "1.6-dev"
             }
         },
         "installation-source": "dist",
@@ -373,6 +380,7 @@
         "keywords": [
             "http",
             "message",
+            "psr-7",
             "request",
             "response",
             "stream",
@@ -1177,6 +1185,48 @@
             "trigger"
         ]
     },
+    {
+        "name": "ralouphie/getallheaders",
+        "version": "3.0.3",
+        "version_normalized": "3.0.3.0",
+        "source": {
+            "type": "git",
+            "url": "https://github.com/ralouphie/getallheaders.git",
+            "reference": "120b605dfeb996808c31b6477290a714d356e822"
+        },
+        "dist": {
+            "type": "zip",
+            "url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/120b605dfeb996808c31b6477290a714d356e822",
+            "reference": "120b605dfeb996808c31b6477290a714d356e822",
+            "shasum": ""
+        },
+        "require": {
+            "php": ">=5.6"
+        },
+        "require-dev": {
+            "php-coveralls/php-coveralls": "^2.1",
+            "phpunit/phpunit": "^5 || ^6.5"
+        },
+        "time": "2019-03-08T08:55:37+00:00",
+        "type": "library",
+        "installation-source": "dist",
+        "autoload": {
+            "files": [
+                "src/getallheaders.php"
+            ]
+        },
+        "notification-url": "https://packagist.org/downloads/",
+        "license": [
+            "MIT"
+        ],
+        "authors": [
+            {
+                "name": "Ralph Khattar",
+                "email": "ralph.khattar@gmail.com"
+            }
+        ],
+        "description": "A polyfill for getallheaders."
+    },
     {
         "name": "rmccue/requests",
         "version": "v1.7.0",

+ 23 - 0
api/vendor/guzzlehttp/guzzle/.php_cs

@@ -0,0 +1,23 @@
+<?php
+
+$config = PhpCsFixer\Config::create()
+    ->setRiskyAllowed(true)
+    ->setRules([
+        '@PSR2' => true,
+        'array_syntax' => ['syntax' => 'short'],
+        'declare_strict_types' => false,
+        'concat_space' => ['spacing'=>'one'],
+        'php_unit_test_case_static_method_calls' => ['call_type' => 'self'],
+        'ordered_imports' => true,
+        // 'phpdoc_align' => ['align'=>'vertical'],
+        // 'native_function_invocation' => true,
+    ])
+    ->setFinder(
+        PhpCsFixer\Finder::create()
+            ->in(__DIR__.'/src')
+            ->in(__DIR__.'/tests')
+            ->name('*.php')
+    )
+;
+
+return $config;

+ 35 - 0
api/vendor/guzzlehttp/guzzle/CHANGELOG.md

@@ -1,5 +1,40 @@
 # Change Log
 
+## 6.5.2 - 2019-12-23
+
+* idn_to_ascii() fix for old PHP versions [#2489](https://github.com/guzzle/guzzle/pull/2489)
+
+## 6.5.1 - 2019-12-21
+
+* Better defaults for PHP installations with old ICU lib [#2454](https://github.com/guzzle/guzzle/pull/2454)
+* IDN support for redirects [#2424](https://github.com/guzzle/guzzle/pull/2424)
+
+## 6.5.0 - 2019-12-07
+
+* Improvement: Added support for reset internal queue in MockHandler. [#2143](https://github.com/guzzle/guzzle/pull/2143)
+* Improvement: Added support to pass arbitrary options to `curl_multi_init`. [#2287](https://github.com/guzzle/guzzle/pull/2287)
+* Fix: Gracefully handle passing `null` to the `header` option. [#2132](https://github.com/guzzle/guzzle/pull/2132)
+* Fix: `RetryMiddleware` did not do exponential delay between retires due unit mismatch. [#2132](https://github.com/guzzle/guzzle/pull/2132)
+* Fix: Prevent undefined offset when using array for ssl_key options. [#2348](https://github.com/guzzle/guzzle/pull/2348)
+* Deprecated `ClientInterface::VERSION`
+
+## 6.4.1 - 2019-10-23
+
+* No `guzzle.phar` was created in 6.4.0 due expired API token. This release will fix that 
+* Added `parent::__construct()` to `FileCookieJar` and `SessionCookieJar`
+
+## 6.4.0 - 2019-10-23
+
+* Improvement: Improved error messages when using curl < 7.21.2 [#2108](https://github.com/guzzle/guzzle/pull/2108)
+* Fix: Test if response is readable before returning a summary in `RequestException::getResponseBodySummary()` [#2081](https://github.com/guzzle/guzzle/pull/2081)
+* Fix: Add support for GUZZLE_CURL_SELECT_TIMEOUT environment variable [#2161](https://github.com/guzzle/guzzle/pull/2161)
+* Improvement: Added `GuzzleHttp\Exception\InvalidArgumentException` [#2163](https://github.com/guzzle/guzzle/pull/2163)
+* Improvement: Added `GuzzleHttp\_current_time()` to use `hrtime()` if that function exists. [#2242](https://github.com/guzzle/guzzle/pull/2242)
+* Improvement: Added curl's `appconnect_time` in `TransferStats` [#2284](https://github.com/guzzle/guzzle/pull/2284)
+* Improvement: Make GuzzleException extend Throwable wherever it's available [#2273](https://github.com/guzzle/guzzle/pull/2273)
+* Fix: Prevent concurrent writes to file when saving `CookieJar` [#2335](https://github.com/guzzle/guzzle/pull/2335)
+* Improvement: Update `MockHandler` so we can test transfer time [#2362](https://github.com/guzzle/guzzle/pull/2362)
+
 ## 6.3.3 - 2018-04-22
 
 * Fix: Default headers when decode_content is specified

+ 18 - 0
api/vendor/guzzlehttp/guzzle/Dockerfile

@@ -0,0 +1,18 @@
+FROM composer:latest as setup
+
+RUN mkdir /guzzle
+
+WORKDIR /guzzle
+
+RUN set -xe \
+    && composer init --name=guzzlehttp/test --description="Simple project for testing Guzzle scripts" --author="Márk Sági-Kazár <mark.sagikazar@gmail.com>" --no-interaction \
+    && composer require guzzlehttp/guzzle
+
+
+FROM php:7.3
+
+RUN mkdir /guzzle
+
+WORKDIR /guzzle
+
+COPY --from=setup /guzzle /guzzle

+ 12 - 13
api/vendor/guzzlehttp/guzzle/README.md

@@ -21,19 +21,18 @@ trivial to integrate with web services.
 
 ```php
 $client = new \GuzzleHttp\Client();
-$res = $client->request('GET', 'https://api.github.com/repos/guzzle/guzzle');
-echo $res->getStatusCode();
-// 200
-echo $res->getHeaderLine('content-type');
-// 'application/json; charset=utf8'
-echo $res->getBody();
-// '{"id": 1420053, "name": "guzzle", ...}'
-
-// Send an asynchronous request.
+$response = $client->request('GET', 'https://api.github.com/repos/guzzle/guzzle');
+
+echo $response->getStatusCode(); # 200
+echo $response->getHeaderLine('content-type'); # 'application/json; charset=utf8'
+echo $response->getBody(); # '{"id": 1420053, "name": "guzzle", ...}'
+
+# Send an asynchronous request.
 $request = new \GuzzleHttp\Psr7\Request('GET', 'http://httpbin.org');
 $promise = $client->sendAsync($request)->then(function ($response) {
     echo 'I completed! ' . $response->getBody();
 });
+
 $promise->wait();
 ```
 
@@ -57,7 +56,7 @@ curl -sS https://getcomposer.org/installer | php
 Next, run the Composer command to install the latest stable version of Guzzle:
 
 ```bash
-php composer.phar require guzzlehttp/guzzle
+composer require guzzlehttp/guzzle
 ```
 
 After installing, you need to require Composer's autoloader:
@@ -69,7 +68,7 @@ require 'vendor/autoload.php';
 You can then later update Guzzle using composer:
 
  ```bash
-composer.phar update
+composer update
  ```
 
 
@@ -79,13 +78,13 @@ composer.phar update
 |---------|------------|---------------------|--------------|---------------------|---------------------|-------|-------------|
 | 3.x     | EOL        | `guzzle/guzzle`     | `Guzzle`     | [v3][guzzle-3-repo] | [v3][guzzle-3-docs] | No    | >= 5.3.3    |
 | 4.x     | EOL        | `guzzlehttp/guzzle` | `GuzzleHttp` | [v4][guzzle-4-repo] | N/A                 | No    | >= 5.4      |
-| 5.x     | Maintained | `guzzlehttp/guzzle` | `GuzzleHttp` | [v5][guzzle-5-repo] | [v5][guzzle-5-docs] | No    | >= 5.4      |
+| 5.x     | EOL        | `guzzlehttp/guzzle` | `GuzzleHttp` | [v5][guzzle-5-repo] | [v5][guzzle-5-docs] | No    | >= 5.4      |
 | 6.x     | Latest     | `guzzlehttp/guzzle` | `GuzzleHttp` | [v6][guzzle-6-repo] | [v6][guzzle-6-docs] | Yes   | >= 5.5      |
 
 [guzzle-3-repo]: https://github.com/guzzle/guzzle3
 [guzzle-4-repo]: https://github.com/guzzle/guzzle/tree/4.x
 [guzzle-5-repo]: https://github.com/guzzle/guzzle/tree/5.3
 [guzzle-6-repo]: https://github.com/guzzle/guzzle
-[guzzle-3-docs]: http://guzzle3.readthedocs.org/en/latest/
+[guzzle-3-docs]: http://guzzle3.readthedocs.org
 [guzzle-5-docs]: http://guzzle.readthedocs.org/en/5.3/
 [guzzle-6-docs]: http://guzzle.readthedocs.org/en/latest/

+ 29 - 14
api/vendor/guzzlehttp/guzzle/composer.json

@@ -2,7 +2,15 @@
     "name": "guzzlehttp/guzzle",
     "type": "library",
     "description": "Guzzle is a PHP HTTP client library",
-    "keywords": ["framework", "http", "rest", "web service", "curl", "client", "HTTP client"],
+    "keywords": [
+        "framework",
+        "http",
+        "rest",
+        "web service",
+        "curl",
+        "client",
+        "HTTP client"
+    ],
     "homepage": "http://guzzlephp.org/",
     "license": "MIT",
     "authors": [
@@ -14,31 +22,38 @@
     ],
     "require": {
         "php": ">=5.5",
-        "guzzlehttp/psr7": "^1.4",
-        "guzzlehttp/promises": "^1.0"
+        "ext-json": "*",
+        "guzzlehttp/promises": "^1.0",
+        "guzzlehttp/psr7": "^1.6.1"
     },
     "require-dev": {
         "ext-curl": "*",
         "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.4 || ^7.0",
-        "psr/log": "^1.0"
+        "psr/log": "^1.1"
+    },
+    "suggest": {
+        "psr/log": "Required for using the Log middleware",
+        "ext-intl": "Required for Internationalized Domain Name (IDN) support"
+    },
+    "config": {
+        "sort-packages": true
+    },
+    "extra": {
+        "branch-alias": {
+            "dev-master": "6.5-dev"
+        }
     },
     "autoload": {
-        "files": ["src/functions_include.php"],
         "psr-4": {
             "GuzzleHttp\\": "src/"
-        }
+        },
+        "files": [
+            "src/functions_include.php"
+        ]
     },
     "autoload-dev": {
         "psr-4": {
             "GuzzleHttp\\Tests\\": "tests/"
         }
-    },
-    "suggest": {
-        "psr/log": "Required for using the Log middleware"
-    },
-    "extra": {
-        "branch-alias": {
-            "dev-master": "6.3-dev"
-        }
     }
 }

+ 95 - 6
api/vendor/guzzlehttp/guzzle/src/Client.php

@@ -2,11 +2,12 @@
 namespace GuzzleHttp;
 
 use GuzzleHttp\Cookie\CookieJar;
+use GuzzleHttp\Exception\InvalidArgumentException;
 use GuzzleHttp\Promise;
 use GuzzleHttp\Psr7;
-use Psr\Http\Message\UriInterface;
 use Psr\Http\Message\RequestInterface;
 use Psr\Http\Message\ResponseInterface;
+use Psr\Http\Message\UriInterface;
 
 /**
  * @method ResponseInterface get(string|UriInterface $uri, array $options = [])
@@ -75,6 +76,12 @@ class Client implements ClientInterface
         $this->configureDefaults($config);
     }
 
+    /**
+     * @param string $method
+     * @param array  $args
+     *
+     * @return Promise\PromiseInterface
+     */
     public function __call($method, $args)
     {
         if (count($args) < 1) {
@@ -89,6 +96,14 @@ class Client implements ClientInterface
             : $this->request($method, $uri, $opts);
     }
 
+    /**
+     * Asynchronously send an HTTP request.
+     *
+     * @param array $options Request options to apply to the given
+     *                       request and to the transfer. See \GuzzleHttp\RequestOptions.
+     *
+     * @return Promise\PromiseInterface
+     */
     public function sendAsync(RequestInterface $request, array $options = [])
     {
         // Merge the base URI into the request URI if needed.
@@ -100,12 +115,35 @@ class Client implements ClientInterface
         );
     }
 
+    /**
+     * Send an HTTP request.
+     *
+     * @param array $options Request options to apply to the given
+     *                       request and to the transfer. See \GuzzleHttp\RequestOptions.
+     *
+     * @return ResponseInterface
+     * @throws GuzzleException
+     */
     public function send(RequestInterface $request, array $options = [])
     {
         $options[RequestOptions::SYNCHRONOUS] = true;
         return $this->sendAsync($request, $options)->wait();
     }
 
+    /**
+     * Create and send an asynchronous HTTP request.
+     *
+     * Use an absolute path to override the base path of the client, or a
+     * relative path to append to the base path of the client. The URL can
+     * contain the query string as well. Use an array to provide a URL
+     * template and additional variables to use in the URL template expansion.
+     *
+     * @param string              $method  HTTP method
+     * @param string|UriInterface $uri     URI object or string.
+     * @param array               $options Request options to apply. See \GuzzleHttp\RequestOptions.
+     *
+     * @return Promise\PromiseInterface
+     */
     public function requestAsync($method, $uri = '', array $options = [])
     {
         $options = $this->prepareDefaults($options);
@@ -125,12 +163,37 @@ class Client implements ClientInterface
         return $this->transfer($request, $options);
     }
 
+    /**
+     * Create and send an HTTP request.
+     *
+     * Use an absolute path to override the base path of the client, or a
+     * relative path to append to the base path of the client. The URL can
+     * contain the query string as well.
+     *
+     * @param string              $method  HTTP method.
+     * @param string|UriInterface $uri     URI object or string.
+     * @param array               $options Request options to apply. See \GuzzleHttp\RequestOptions.
+     *
+     * @return ResponseInterface
+     * @throws GuzzleException
+     */
     public function request($method, $uri = '', array $options = [])
     {
         $options[RequestOptions::SYNCHRONOUS] = true;
         return $this->requestAsync($method, $uri, $options)->wait();
     }
 
+    /**
+     * Get a client configuration option.
+     *
+     * These options include default request options of the client, a "handler"
+     * (if utilized by the concrete client), and a "base_uri" if utilized by
+     * the concrete client.
+     *
+     * @param string|null $option The config option to retrieve.
+     *
+     * @return mixed
+     */
     public function getConfig($option = null)
     {
         return $option === null
@@ -138,6 +201,11 @@ class Client implements ClientInterface
             : (isset($this->config[$option]) ? $this->config[$option] : null);
     }
 
+    /**
+     * @param  string|null $uri
+     *
+     * @return UriInterface
+     */
     private function buildUri($uri, array $config)
     {
         // for BC we accept null which would otherwise fail in uri_for
@@ -147,6 +215,11 @@ class Client implements ClientInterface
             $uri = Psr7\UriResolver::resolve(Psr7\uri_for($config['base_uri']), $uri);
         }
 
+        if (isset($config['idn_conversion']) && ($config['idn_conversion'] !== false)) {
+            $idnOptions = ($config['idn_conversion'] === true) ? IDNA_DEFAULT : $config['idn_conversion'];
+            $uri = _idn_uri_convert($uri, $idnOptions);
+        }
+
         return $uri->getScheme() === '' && $uri->getHost() !== '' ? $uri->withScheme('http') : $uri;
     }
 
@@ -154,6 +227,7 @@ class Client implements ClientInterface
      * Configures the default options for a client.
      *
      * @param array $config
+     * @return void
      */
     private function configureDefaults(array $config)
     {
@@ -165,12 +239,22 @@ class Client implements ClientInterface
             'cookies'         => false
         ];
 
+        // idn_to_ascii() is a part of ext-intl and might be not available
+        $defaults['idn_conversion'] = function_exists('idn_to_ascii')
+            // Old ICU versions don't have this constant, so we are basically stuck (see https://github.com/guzzle/guzzle/pull/2424
+            // and https://github.com/guzzle/guzzle/issues/2448 for details)
+            && (
+                defined('INTL_IDNA_VARIANT_UTS46')
+                ||
+                PHP_VERSION_ID < 70200
+            );
+
         // Use the standard Linux HTTP_PROXY and HTTPS_PROXY if set.
 
         // We can only trust the HTTP_PROXY environment variable in a CLI
         // process due to the fact that PHP has no reliable mechanism to
         // get environment variables that start with "HTTP_".
-        if (php_sapi_name() == 'cli' && getenv('HTTP_PROXY')) {
+        if (php_sapi_name() === 'cli' && getenv('HTTP_PROXY')) {
             $defaults['proxy']['http'] = getenv('HTTP_PROXY');
         }
 
@@ -210,7 +294,7 @@ class Client implements ClientInterface
      *
      * @return array
      */
-    private function prepareDefaults($options)
+    private function prepareDefaults(array $options)
     {
         $defaults = $this->config;
 
@@ -225,7 +309,7 @@ class Client implements ClientInterface
         if (array_key_exists('headers', $options)) {
             // Allows default headers to be unset.
             if ($options['headers'] === null) {
-                $defaults['_conditional'] = null;
+                $defaults['_conditional'] = [];
                 unset($options['headers']);
             } elseif (!is_array($options['headers'])) {
                 throw new \InvalidArgumentException('headers must be an array');
@@ -251,8 +335,7 @@ class Client implements ClientInterface
      * The URI of the request is not modified and the request options are used
      * as-is without merging in default options.
      *
-     * @param RequestInterface $request
-     * @param array            $options
+     * @param array $options See \GuzzleHttp\RequestOptions.
      *
      * @return Promise\PromiseInterface
      */
@@ -271,6 +354,7 @@ class Client implements ClientInterface
         }
 
         $request = $this->applyOptions($request, $options);
+        /** @var HandlerStack $handler */
         $handler = $options['handler'];
 
         try {
@@ -411,6 +495,11 @@ class Client implements ClientInterface
         return $request;
     }
 
+    /**
+     * Throw Exception with pre-set message.
+     * @return void
+     * @throws InvalidArgumentException Invalid body.
+     */
     private function invalidBody()
     {
         throw new \InvalidArgumentException('Passing in the "body" request '

+ 5 - 2
api/vendor/guzzlehttp/guzzle/src/ClientInterface.php

@@ -1,8 +1,8 @@
 <?php
 namespace GuzzleHttp;
 
-use GuzzleHttp\Promise\PromiseInterface;
 use GuzzleHttp\Exception\GuzzleException;
+use GuzzleHttp\Promise\PromiseInterface;
 use Psr\Http\Message\RequestInterface;
 use Psr\Http\Message\ResponseInterface;
 use Psr\Http\Message\UriInterface;
@@ -12,7 +12,10 @@ use Psr\Http\Message\UriInterface;
  */
 interface ClientInterface
 {
-    const VERSION = '6.3.3';
+    /**
+     * @deprecated Will be removed in Guzzle 7.0.0
+     */
+    const VERSION = '6.5.1';
 
     /**
      * Send an HTTP request.

+ 5 - 3
api/vendor/guzzlehttp/guzzle/src/Cookie/CookieJar.php

@@ -94,8 +94,8 @@ class CookieJar implements CookieJarInterface
      */
     public function getCookieByName($name)
     {
-        // don't allow a null name
-        if ($name === null) {
+        // don't allow a non string name
+        if ($name === null || !is_scalar($name)) {
             return null;
         }
         foreach ($this->cookies as $cookie) {
@@ -103,6 +103,8 @@ class CookieJar implements CookieJarInterface
                 return $cookie;
             }
         }
+
+        return null;
     }
 
     public function toArray()
@@ -120,7 +122,7 @@ class CookieJar implements CookieJarInterface
         } elseif (!$path) {
             $this->cookies = array_filter(
                 $this->cookies,
-                function (SetCookie $cookie) use ($path, $domain) {
+                function (SetCookie $cookie) use ($domain) {
                     return !$cookie->matchesDomain($domain);
                 }
             );

+ 3 - 3
api/vendor/guzzlehttp/guzzle/src/Cookie/CookieJarInterface.php

@@ -58,9 +58,9 @@ interface CookieJarInterface extends \Countable, \IteratorAggregate
      * arguments, then the cookie with the specified name, path and domain is
      * removed.
      *
-     * @param string $domain Clears cookies matching a domain
-     * @param string $path   Clears cookies matching a domain and path
-     * @param string $name   Clears cookies matching a domain, path, and name
+     * @param string|null $domain Clears cookies matching a domain
+     * @param string|null $path   Clears cookies matching a domain and path
+     * @param string|null $name   Clears cookies matching a domain, path, and name
      *
      * @return CookieJarInterface
      */

+ 2 - 1
api/vendor/guzzlehttp/guzzle/src/Cookie/FileCookieJar.php

@@ -23,6 +23,7 @@ class FileCookieJar extends CookieJar
      */
     public function __construct($cookieFile, $storeSessionCookies = false)
     {
+        parent::__construct();
         $this->filename = $cookieFile;
         $this->storeSessionCookies = $storeSessionCookies;
 
@@ -56,7 +57,7 @@ class FileCookieJar extends CookieJar
         }
 
         $jsonStr = \GuzzleHttp\json_encode($json);
-        if (false === file_put_contents($filename, $jsonStr)) {
+        if (false === file_put_contents($filename, $jsonStr, LOCK_EX)) {
             throw new \RuntimeException("Unable to save file {$filename}");
         }
     }

+ 1 - 0
api/vendor/guzzlehttp/guzzle/src/Cookie/SessionCookieJar.php

@@ -22,6 +22,7 @@ class SessionCookieJar extends CookieJar
      */
     public function __construct($sessionKey, $storeSessionCookies = false)
     {
+        parent::__construct();
         $this->sessionKey = $sessionKey;
         $this->storeSessionCookies = $storeSessionCookies;
         $this->load();

+ 2 - 2
api/vendor/guzzlehttp/guzzle/src/Cookie/SetCookie.php

@@ -227,7 +227,7 @@ class SetCookie
     /**
      * Get whether or not this is a secure cookie
      *
-     * @return null|bool
+     * @return bool|null
      */
     public function getSecure()
     {
@@ -247,7 +247,7 @@ class SetCookie
     /**
      * Get whether or not this is a session cookie
      *
-     * @return null|bool
+     * @return bool|null
      */
     public function getDiscard()
     {

+ 3 - 1
api/vendor/guzzlehttp/guzzle/src/Exception/ClientException.php

@@ -4,4 +4,6 @@ namespace GuzzleHttp\Exception;
 /**
  * Exception when a client error is encountered (4xx codes)
  */
-class ClientException extends BadResponseException {}
+class ClientException extends BadResponseException
+{
+}

+ 20 - 10
api/vendor/guzzlehttp/guzzle/src/Exception/GuzzleException.php

@@ -1,13 +1,23 @@
 <?php
 namespace GuzzleHttp\Exception;
 
-/**
- * @method string getMessage()
- * @method \Throwable|null getPrevious()
- * @method mixed getCode()
- * @method string getFile()
- * @method int getLine()
- * @method array getTrace()
- * @method string getTraceAsString()
- */
-interface GuzzleException {}
+use Throwable;
+
+if (interface_exists(Throwable::class)) {
+    interface GuzzleException extends Throwable
+    {
+    }
+} else {
+    /**
+     * @method string getMessage()
+     * @method \Throwable|null getPrevious()
+     * @method mixed getCode()
+     * @method string getFile()
+     * @method int getLine()
+     * @method array getTrace()
+     * @method string getTraceAsString()
+     */
+    interface GuzzleException
+    {
+    }
+}

+ 7 - 0
api/vendor/guzzlehttp/guzzle/src/Exception/InvalidArgumentException.php

@@ -0,0 +1,7 @@
+<?php
+
+namespace GuzzleHttp\Exception;
+
+final class InvalidArgumentException extends \InvalidArgumentException implements GuzzleException
+{
+}

+ 5 - 30
api/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php

@@ -1,9 +1,9 @@
 <?php
 namespace GuzzleHttp\Exception;
 
+use GuzzleHttp\Promise\PromiseInterface;
 use Psr\Http\Message\RequestInterface;
 use Psr\Http\Message\ResponseInterface;
-use GuzzleHttp\Promise\PromiseInterface;
 use Psr\Http\Message\UriInterface;
 
 /**
@@ -14,7 +14,7 @@ class RequestException extends TransferException
     /** @var RequestInterface */
     private $request;
 
-    /** @var ResponseInterface */
+    /** @var ResponseInterface|null */
     private $response;
 
     /** @var array */
@@ -124,42 +124,17 @@ class RequestException extends TransferException
      */
     public static function getResponseBodySummary(ResponseInterface $response)
     {
-        $body = $response->getBody();
-
-        if (!$body->isSeekable()) {
-            return null;
-        }
-
-        $size = $body->getSize();
-
-        if ($size === 0) {
-            return null;
-        }
-
-        $summary = $body->read(120);
-        $body->rewind();
-
-        if ($size > 120) {
-            $summary .= ' (truncated...)';
-        }
-
-        // Matches any printable character, including unicode characters:
-        // letters, marks, numbers, punctuation, spacing, and separators.
-        if (preg_match('/[^\pL\pM\pN\pP\pS\pZ\n\r\t]/', $summary)) {
-            return null;
-        }
-
-        return $summary;
+        return \GuzzleHttp\Psr7\get_message_body_summary($response);
     }
 
     /**
-     * Obfuscates URI if there is an username and a password present
+     * Obfuscates URI if there is a username and a password present
      *
      * @param UriInterface $uri
      *
      * @return UriInterface
      */
-    private static function obfuscateUri($uri)
+    private static function obfuscateUri(UriInterface $uri)
     {
         $userInfo = $uri->getUserInfo();
 

+ 3 - 1
api/vendor/guzzlehttp/guzzle/src/Exception/ServerException.php

@@ -4,4 +4,6 @@ namespace GuzzleHttp\Exception;
 /**
  * Exception when a server error is encountered (5xx codes)
  */
-class ServerException extends BadResponseException {}
+class ServerException extends BadResponseException
+{
+}

+ 3 - 1
api/vendor/guzzlehttp/guzzle/src/Exception/TooManyRedirectsException.php

@@ -1,4 +1,6 @@
 <?php
 namespace GuzzleHttp\Exception;
 
-class TooManyRedirectsException extends RequestException {}
+class TooManyRedirectsException extends RequestException
+{
+}

+ 3 - 1
api/vendor/guzzlehttp/guzzle/src/Exception/TransferException.php

@@ -1,4 +1,6 @@
 <?php
 namespace GuzzleHttp\Exception;
 
-class TransferException extends \RuntimeException implements GuzzleException {}
+class TransferException extends \RuntimeException implements GuzzleException
+{
+}

+ 32 - 12
api/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php

@@ -1,8 +1,8 @@
 <?php
 namespace GuzzleHttp\Handler;
 
-use GuzzleHttp\Exception\RequestException;
 use GuzzleHttp\Exception\ConnectException;
+use GuzzleHttp\Exception\RequestException;
 use GuzzleHttp\Promise\FulfilledPromise;
 use GuzzleHttp\Psr7;
 use GuzzleHttp\Psr7\LazyOpenStream;
@@ -14,6 +14,9 @@ use Psr\Http\Message\RequestInterface;
  */
 class CurlFactory implements CurlFactoryInterface
 {
+    const CURL_VERSION_STR = 'curl_version';
+    const LOW_CURL_VERSION_NUMBER = '7.21.2';
+
     /** @var array */
     private $handles = [];
 
@@ -117,6 +120,7 @@ class CurlFactory implements CurlFactoryInterface
     private static function invokeStats(EasyHandle $easy)
     {
         $curlStats = curl_getinfo($easy->handle);
+        $curlStats['appconnect_time'] = curl_getinfo($easy->handle, CURLINFO_APPCONNECT_TIME);
         $stats = new TransferStats(
             $easy->request,
             $easy->response,
@@ -136,7 +140,9 @@ class CurlFactory implements CurlFactoryInterface
         $ctx = [
             'errno' => $easy->errno,
             'error' => curl_error($easy->handle),
+            'appconnect_time' => curl_getinfo($easy->handle, CURLINFO_APPCONNECT_TIME),
         ] + curl_getinfo($easy->handle);
+        $ctx[self::CURL_VERSION_STR] = curl_version()['version'];
         $factory->release($easy);
 
         // Retry when nothing is present or when curl failed to rewind.
@@ -172,13 +178,22 @@ class CurlFactory implements CurlFactoryInterface
                 )
             );
         }
-
-        $message = sprintf(
-            'cURL error %s: %s (%s)',
-            $ctx['errno'],
-            $ctx['error'],
-            'see http://curl.haxx.se/libcurl/c/libcurl-errors.html'
-        );
+        if (version_compare($ctx[self::CURL_VERSION_STR], self::LOW_CURL_VERSION_NUMBER)) {
+            $message = sprintf(
+                'cURL error %s: %s (%s)',
+                $ctx['errno'],
+                $ctx['error'],
+                'see https://curl.haxx.se/libcurl/c/libcurl-errors.html'
+            );
+        } else {
+            $message = sprintf(
+                'cURL error %s: %s (%s) for %s',
+                $ctx['errno'],
+                $ctx['error'],
+                'see https://curl.haxx.se/libcurl/c/libcurl-errors.html',
+                $easy->request->getUri()
+            );
+        }
 
         // Create a connection exception if it was a specific error code.
         $error = isset($connectionErrors[$easy->errno])
@@ -439,11 +454,16 @@ class CurlFactory implements CurlFactoryInterface
         }
 
         if (isset($options['ssl_key'])) {
-            $sslKey = $options['ssl_key'];
-            if (is_array($sslKey)) {
-                $conf[CURLOPT_SSLKEYPASSWD] = $sslKey[1];
-                $sslKey = $sslKey[0];
+            if (is_array($options['ssl_key'])) {
+                if (count($options['ssl_key']) === 2) {
+                    list($sslKey, $conf[CURLOPT_SSLKEYPASSWD]) = $options['ssl_key'];
+                } else {
+                    list($sslKey) = $options['ssl_key'];
+                }
             }
+
+            $sslKey = isset($sslKey) ? $sslKey: $options['ssl_key'];
+
             if (!file_exists($sslKey)) {
                 throw new \InvalidArgumentException(
                     "SSL private key not found: {$sslKey}"

+ 27 - 7
api/vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php

@@ -1,9 +1,9 @@
 <?php
 namespace GuzzleHttp\Handler;
 
+use GuzzleHttp\Exception\InvalidArgumentException;
 use GuzzleHttp\Promise as P;
 use GuzzleHttp\Promise\Promise;
-use GuzzleHttp\Psr7;
 use Psr\Http\Message\RequestInterface;
 
 /**
@@ -23,6 +23,7 @@ class CurlMultiHandler
     private $active;
     private $handles = [];
     private $delays = [];
+    private $options = [];
 
     /**
      * This handler accepts the following options:
@@ -30,6 +31,8 @@ class CurlMultiHandler
      * - handle_factory: An optional factory  used to create curl handles
      * - select_timeout: Optional timeout (in seconds) to block before timing
      *   out while selecting curl handles. Defaults to 1 second.
+     * - options: An associative array of CURLMOPT_* options and
+     *   corresponding values for curl_multi_setopt()
      *
      * @param array $options
      */
@@ -37,14 +40,31 @@ class CurlMultiHandler
     {
         $this->factory = isset($options['handle_factory'])
             ? $options['handle_factory'] : new CurlFactory(50);
-        $this->selectTimeout = isset($options['select_timeout'])
-            ? $options['select_timeout'] : 1;
+
+        if (isset($options['select_timeout'])) {
+            $this->selectTimeout = $options['select_timeout'];
+        } elseif ($selectTimeout = getenv('GUZZLE_CURL_SELECT_TIMEOUT')) {
+            $this->selectTimeout = $selectTimeout;
+        } else {
+            $this->selectTimeout = 1;
+        }
+
+        $this->options = isset($options['options']) ? $options['options'] : [];
     }
 
     public function __get($name)
     {
         if ($name === '_mh') {
-            return $this->_mh = curl_multi_init();
+            $this->_mh = curl_multi_init();
+
+            foreach ($this->options as $option => $value) {
+                // A warning is raised in case of a wrong option.
+                curl_multi_setopt($this->_mh, $option, $value);
+            }
+
+            // Further calls to _mh will return the value directly, without entering the
+            // __get() method at all.
+            return $this->_mh;
         }
 
         throw new \BadMethodCallException();
@@ -82,7 +102,7 @@ class CurlMultiHandler
     {
         // Add any delayed handles if needed.
         if ($this->delays) {
-            $currentTime = microtime(true);
+            $currentTime = \GuzzleHttp\_current_time();
             foreach ($this->delays as $id => $delay) {
                 if ($currentTime >= $delay) {
                     unset($this->delays[$id]);
@@ -134,7 +154,7 @@ class CurlMultiHandler
         if (empty($easy->options['delay'])) {
             curl_multi_add_handle($this->_mh, $easy->handle);
         } else {
-            $this->delays[$id] = microtime(true) + ($easy->options['delay'] / 1000);
+            $this->delays[$id] = \GuzzleHttp\_current_time() + ($easy->options['delay'] / 1000);
         }
     }
 
@@ -186,7 +206,7 @@ class CurlMultiHandler
 
     private function timeToNext()
     {
-        $currentTime = microtime(true);
+        $currentTime = \GuzzleHttp\_current_time();
         $nextTime = PHP_INT_MAX;
         foreach ($this->delays as $time) {
             if ($time < $nextTime) {

+ 8 - 2
api/vendor/guzzlehttp/guzzle/src/Handler/MockHandler.php

@@ -66,7 +66,7 @@ class MockHandler implements \Countable
             throw new \OutOfBoundsException('Mock queue is empty');
         }
 
-        if (isset($options['delay'])) {
+        if (isset($options['delay']) && is_numeric($options['delay'])) {
             usleep($options['delay'] * 1000);
         }
 
@@ -175,6 +175,11 @@ class MockHandler implements \Countable
         return count($this->queue);
     }
 
+    public function reset()
+    {
+        $this->queue = [];
+    }
+
     private function invokeStats(
         RequestInterface $request,
         array $options,
@@ -182,7 +187,8 @@ class MockHandler implements \Countable
         $reason = null
     ) {
         if (isset($options['on_stats'])) {
-            $stats = new TransferStats($request, $response, 0, $reason);
+            $transferTime = isset($options['transfer_time']) ? $options['transfer_time'] : 0;
+            $stats = new TransferStats($request, $response, $transferTime, $reason);
             call_user_func($options['on_stats'], $stats);
         }
     }

+ 18 - 6
api/vendor/guzzlehttp/guzzle/src/Handler/StreamHandler.php

@@ -1,8 +1,8 @@
 <?php
 namespace GuzzleHttp\Handler;
 
-use GuzzleHttp\Exception\RequestException;
 use GuzzleHttp\Exception\ConnectException;
+use GuzzleHttp\Exception\RequestException;
 use GuzzleHttp\Promise\FulfilledPromise;
 use GuzzleHttp\Promise\PromiseInterface;
 use GuzzleHttp\Psr7;
@@ -33,7 +33,7 @@ class StreamHandler
             usleep($options['delay'] * 1000);
         }
 
-        $startTime = isset($options['on_stats']) ? microtime(true) : null;
+        $startTime = isset($options['on_stats']) ? \GuzzleHttp\_current_time() : null;
 
         try {
             // Does not support the expect header.
@@ -42,7 +42,7 @@ class StreamHandler
             // Append a content-length header if body size is zero to match
             // cURL's behavior.
             if (0 === $request->getBody()->getSize()) {
-                $request = $request->withHeader('Content-Length', 0);
+                $request = $request->withHeader('Content-Length', '0');
             }
 
             return $this->createResponse(
@@ -82,7 +82,7 @@ class StreamHandler
             $stats = new TransferStats(
                 $request,
                 $response,
-                microtime(true) - $startTime,
+                \GuzzleHttp\_current_time() - $startTime,
                 $error,
                 []
             );
@@ -343,13 +343,25 @@ class StreamHandler
             if ('v4' === $options['force_ip_resolve']) {
                 $records = dns_get_record($uri->getHost(), DNS_A);
                 if (!isset($records[0]['ip'])) {
-                    throw new ConnectException(sprintf("Could not resolve IPv4 address for host '%s'", $uri->getHost()), $request);
+                    throw new ConnectException(
+                        sprintf(
+                            "Could not resolve IPv4 address for host '%s'",
+                            $uri->getHost()
+                        ),
+                        $request
+                    );
                 }
                 $uri = $uri->withHost($records[0]['ip']);
             } elseif ('v6' === $options['force_ip_resolve']) {
                 $records = dns_get_record($uri->getHost(), DNS_AAAA);
                 if (!isset($records[0]['ipv6'])) {
-                    throw new ConnectException(sprintf("Could not resolve IPv6 address for host '%s'", $uri->getHost()), $request);
+                    throw new ConnectException(
+                        sprintf(
+                            "Could not resolve IPv6 address for host '%s'",
+                            $uri->getHost()
+                        ),
+                        $request
+                    );
                 }
                 $uri = $uri->withHost('[' . $records[0]['ipv6'] . ']');
             }

+ 9 - 5
api/vendor/guzzlehttp/guzzle/src/HandlerStack.php

@@ -1,7 +1,9 @@
 <?php
 namespace GuzzleHttp;
 
+use GuzzleHttp\Promise\PromiseInterface;
 use Psr\Http\Message\RequestInterface;
+use Psr\Http\Message\ResponseInterface;
 
 /**
  * Creates a composed Guzzle handler function by stacking middlewares on top of
@@ -9,7 +11,7 @@ use Psr\Http\Message\RequestInterface;
  */
 class HandlerStack
 {
-    /** @var callable */
+    /** @var callable|null */
     private $handler;
 
     /** @var array */
@@ -59,6 +61,8 @@ class HandlerStack
      *
      * @param RequestInterface $request
      * @param array            $options
+     *
+     * @return ResponseInterface|PromiseInterface
      */
     public function __invoke(RequestInterface $request, array $options)
     {
@@ -206,7 +210,7 @@ class HandlerStack
     }
 
     /**
-     * @param $name
+     * @param string $name
      * @return int
      */
     private function findByName($name)
@@ -223,10 +227,10 @@ class HandlerStack
     /**
      * Splices a function into the middleware list at a specific position.
      *
-     * @param          $findName
-     * @param          $withName
+     * @param string   $findName
+     * @param string   $withName
      * @param callable $middleware
-     * @param          $before
+     * @param bool     $before
      */
     private function splice($findName, $withName, callable $middleware, $before)
     {

+ 5 - 0
api/vendor/guzzlehttp/guzzle/src/MessageFormatter.php

@@ -168,6 +168,11 @@ class MessageFormatter
         );
     }
 
+    /**
+     * Get headers from message as string
+     *
+     * @return string
+     */
     private function headers(MessageInterface $message)
     {
         $result = '';

+ 3 - 4
api/vendor/guzzlehttp/guzzle/src/Middleware.php

@@ -7,7 +7,6 @@ use GuzzleHttp\Promise\RejectedPromise;
 use GuzzleHttp\Psr7;
 use Psr\Http\Message\ResponseInterface;
 use Psr\Log\LoggerInterface;
-use Psr\Log\LogLevel;
 
 /**
  * Functions used to create and wrap handlers with handler middleware.
@@ -39,7 +38,7 @@ final class Middleware
                             $cookieJar->extractCookies($request, $response);
                             return $response;
                         }
-                );
+                    );
             };
         };
     }
@@ -58,7 +57,7 @@ final class Middleware
                     return $handler($request, $options);
                 }
                 return $handler($request, $options)->then(
-                    function (ResponseInterface $response) use ($request, $handler) {
+                    function (ResponseInterface $response) use ($request) {
                         $code = $response->getStatusCode();
                         if ($code < 400) {
                             return $response;
@@ -183,7 +182,7 @@ final class Middleware
      *
      * @return callable Returns a function that accepts the next handler.
      */
-    public static function log(LoggerInterface $logger, MessageFormatter $formatter, $logLevel = LogLevel::INFO)
+    public static function log(LoggerInterface $logger, MessageFormatter $formatter, $logLevel = 'info' /* \Psr\Log\LogLevel::INFO */)
     {
         return function (callable $handler) use ($logger, $formatter, $logLevel) {
             return function ($request, array $options) use ($handler, $logger, $formatter, $logLevel) {

+ 13 - 2
api/vendor/guzzlehttp/guzzle/src/Pool.php

@@ -1,12 +1,13 @@
 <?php
 namespace GuzzleHttp;
 
+use GuzzleHttp\Promise\EachPromise;
+use GuzzleHttp\Promise\PromiseInterface;
 use GuzzleHttp\Promise\PromisorInterface;
 use Psr\Http\Message\RequestInterface;
-use GuzzleHttp\Promise\EachPromise;
 
 /**
- * Sends and iterator of requests concurrently using a capped pool size.
+ * Sends an iterator of requests concurrently using a capped pool size.
  *
  * The pool will read from an iterator until it is cancelled or until the
  * iterator is consumed. When a request is yielded, the request is sent after
@@ -69,6 +70,11 @@ class Pool implements PromisorInterface
         $this->each = new EachPromise($requests(), $config);
     }
 
+    /**
+     * Get promise
+     *
+     * @return PromiseInterface
+     */
     public function promise()
     {
         return $this->each->promise();
@@ -106,6 +112,11 @@ class Pool implements PromisorInterface
         return $res;
     }
 
+    /**
+     * Execute callback(s)
+     *
+     * @return void
+     */
     private static function cmpCallback(array &$options, $name, array &$results)
     {
         if (!isset($options[$name])) {

+ 5 - 0
api/vendor/guzzlehttp/guzzle/src/PrepareBodyMiddleware.php

@@ -66,6 +66,11 @@ class PrepareBodyMiddleware
         return $fn(Psr7\modify_request($request, $modify), $options);
     }
 
+    /**
+     * Add expect header
+     *
+     * @return void
+     */
     private function addExpectHeader(
         RequestInterface $request,
         array $options,

+ 23 - 5
api/vendor/guzzlehttp/guzzle/src/RedirectMiddleware.php

@@ -13,7 +13,7 @@ use Psr\Http\Message\UriInterface;
  * Request redirect middleware.
  *
  * Apply this middleware like other middleware using
- * {@see GuzzleHttp\Middleware::redirect()}.
+ * {@see \GuzzleHttp\Middleware::redirect()}.
  */
 class RedirectMiddleware
 {
@@ -76,7 +76,7 @@ class RedirectMiddleware
     /**
      * @param RequestInterface  $request
      * @param array             $options
-     * @param ResponseInterface|PromiseInterface $response
+     * @param ResponseInterface $response
      *
      * @return ResponseInterface|PromiseInterface
      */
@@ -118,6 +118,11 @@ class RedirectMiddleware
         return $promise;
     }
 
+    /**
+     * Enable tracking on promise.
+     *
+     * @return PromiseInterface
+     */
     private function withTracking(PromiseInterface $promise, $uri, $statusCode)
     {
         return $promise->then(
@@ -135,6 +140,13 @@ class RedirectMiddleware
         );
     }
 
+    /**
+     * Check for too many redirects
+     *
+     * @return void
+     *
+     * @throws TooManyRedirectsException Too many redirects.
+     */
     private function guardMax(RequestInterface $request, array &$options)
     {
         $current = isset($options['__redirect_count'])
@@ -172,13 +184,19 @@ class RedirectMiddleware
         // would do.
         $statusCode = $response->getStatusCode();
         if ($statusCode == 303 ||
-            ($statusCode <= 302 && $request->getBody() && !$options['allow_redirects']['strict'])
+            ($statusCode <= 302 && !$options['allow_redirects']['strict'])
         ) {
             $modify['method'] = 'GET';
             $modify['body'] = '';
         }
 
-        $modify['uri'] = $this->redirectUri($request, $response, $protocols);
+        $uri = $this->redirectUri($request, $response, $protocols);
+        if (isset($options['idn_conversion']) && ($options['idn_conversion'] !== false)) {
+            $idnOptions = ($options['idn_conversion'] === true) ? IDNA_DEFAULT : $options['idn_conversion'];
+            $uri = _idn_uri_convert($uri, $idnOptions);
+        }
+
+        $modify['uri'] = $uri;
         Psr7\rewind_body($request);
 
         // Add the Referer header if it is told to do so and only
@@ -186,7 +204,7 @@ class RedirectMiddleware
         if ($options['allow_redirects']['referer']
             && $modify['uri']->getScheme() === $request->getUri()->getScheme()
         ) {
-            $uri = $request->getUri()->withUserInfo('', '');
+            $uri = $request->getUri()->withUserInfo('');
             $modify['set_headers']['Referer'] = (string) $uri;
         } else {
             $modify['remove_headers'][] = 'Referer';

+ 9 - 1
api/vendor/guzzlehttp/guzzle/src/RequestOptions.php

@@ -22,7 +22,7 @@ final class RequestOptions
      * - strict: (bool, default=false) Set to true to use strict redirects
      *   meaning redirect POST requests with POST requests vs. doing what most
      *   browsers do which is redirect POST requests with GET requests
-     * - referer: (bool, default=true) Set to false to disable the Referer
+     * - referer: (bool, default=false) Set to true to enable the Referer
      *   header.
      * - protocols: (array, default=['http', 'https']) Allowed redirect
      *   protocols.
@@ -132,6 +132,14 @@ final class RequestOptions
      */
     const HTTP_ERRORS = 'http_errors';
 
+    /**
+     * idn: (bool|int, default=true) A combination of IDNA_* constants for
+     * idn_to_ascii() PHP's function (see "options" parameter). Set to false to
+     * disable IDN support completely, or to true to use the default
+     * configuration (IDNA_DEFAULT constant).
+     */
+    const IDN_CONVERSION = 'idn_conversion';
+
     /**
      * json: (mixed) Adds JSON data to a request. The provided value is JSON
      * encoded and a Content-Type header of application/json will be added to

+ 19 - 3
api/vendor/guzzlehttp/guzzle/src/RetryMiddleware.php

@@ -19,6 +19,9 @@ class RetryMiddleware
     /** @var callable */
     private $decider;
 
+    /** @var callable */
+    private $delay;
+
     /**
      * @param callable $decider     Function that accepts the number of retries,
      *                              a request, [response], and [exception] and
@@ -42,13 +45,13 @@ class RetryMiddleware
     /**
      * Default exponential backoff delay function.
      *
-     * @param $retries
+     * @param int $retries
      *
-     * @return int
+     * @return int milliseconds.
      */
     public static function exponentialDelay($retries)
     {
-        return (int) pow(2, $retries - 1);
+        return (int) pow(2, $retries - 1) * 1000;
     }
 
     /**
@@ -71,6 +74,11 @@ class RetryMiddleware
             );
     }
 
+    /**
+     * Execute fulfilled closure
+     *
+     * @return mixed
+     */
     private function onFulfilled(RequestInterface $req, array $options)
     {
         return function ($value) use ($req, $options) {
@@ -87,6 +95,11 @@ class RetryMiddleware
         };
     }
 
+    /**
+     * Execute rejected closure
+     *
+     * @return callable
+     */
     private function onRejected(RequestInterface $req, array $options)
     {
         return function ($reason) use ($req, $options) {
@@ -103,6 +116,9 @@ class RetryMiddleware
         };
     }
 
+    /**
+     * @return self
+     */
     private function doRetry(RequestInterface $request, array $options, ResponseInterface $response = null)
     {
         $options['delay'] = call_user_func($this->delay, ++$options['retries'], $response);

+ 6 - 6
api/vendor/guzzlehttp/guzzle/src/TransferStats.php

@@ -18,11 +18,11 @@ final class TransferStats
     private $handlerErrorData;
 
     /**
-     * @param RequestInterface  $request          Request that was sent.
-     * @param ResponseInterface $response         Response received (if any)
-     * @param null              $transferTime     Total handler transfer time.
-     * @param mixed             $handlerErrorData Handler error data.
-     * @param array             $handlerStats     Handler specific stats.
+     * @param RequestInterface       $request          Request that was sent.
+     * @param ResponseInterface|null $response         Response received (if any)
+     * @param float|null             $transferTime     Total handler transfer time.
+     * @param mixed                  $handlerErrorData Handler error data.
+     * @param array                  $handlerStats     Handler specific stats.
      */
     public function __construct(
         RequestInterface $request,
@@ -93,7 +93,7 @@ final class TransferStats
     /**
      * Get the estimated time the request was being transferred by the handler.
      *
-     * @return float Time in seconds.
+     * @return float|null Time in seconds.
      */
     public function getTransferTime()
     {

+ 67 - 6
api/vendor/guzzlehttp/guzzle/src/functions.php

@@ -1,10 +1,12 @@
 <?php
 namespace GuzzleHttp;
 
+use GuzzleHttp\Exception\InvalidArgumentException;
 use GuzzleHttp\Handler\CurlHandler;
 use GuzzleHttp\Handler\CurlMultiHandler;
 use GuzzleHttp\Handler\Proxy;
 use GuzzleHttp\Handler\StreamHandler;
+use Psr\Http\Message\UriInterface;
 
 /**
  * Expands a URI template
@@ -56,7 +58,7 @@ function describe_type($input)
 /**
  * Parses an array of header lines into an associative array of headers.
  *
- * @param array $lines Header lines array of strings in the following
+ * @param iterable $lines Header lines array of strings in the following
  *                     format: "Name: Value"
  * @return array
  */
@@ -196,7 +198,8 @@ function default_ca_bundle()
         }
     }
 
-    throw new \RuntimeException(<<< EOT
+    throw new \RuntimeException(
+        <<< EOT
 No system CA bundle could be found in any of the the common system locations.
 PHP versions earlier than 5.6 are not properly configured to use the system's
 CA bundle by default. In order to verify peer certificates, you will need to
@@ -294,14 +297,14 @@ function is_host_in_noproxy($host, array $noProxyArray)
  * @param int    $options Bitmask of JSON decode options.
  *
  * @return mixed
- * @throws \InvalidArgumentException if the JSON cannot be decoded.
+ * @throws Exception\InvalidArgumentException if the JSON cannot be decoded.
  * @link http://www.php.net/manual/en/function.json-decode.php
  */
 function json_decode($json, $assoc = false, $depth = 512, $options = 0)
 {
     $data = \json_decode($json, $assoc, $depth, $options);
     if (JSON_ERROR_NONE !== json_last_error()) {
-        throw new \InvalidArgumentException(
+        throw new Exception\InvalidArgumentException(
             'json_decode error: ' . json_last_error_msg()
         );
     }
@@ -317,17 +320,75 @@ function json_decode($json, $assoc = false, $depth = 512, $options = 0)
  * @param int    $depth   Set the maximum depth. Must be greater than zero.
  *
  * @return string
- * @throws \InvalidArgumentException if the JSON cannot be encoded.
+ * @throws Exception\InvalidArgumentException if the JSON cannot be encoded.
  * @link http://www.php.net/manual/en/function.json-encode.php
  */
 function json_encode($value, $options = 0, $depth = 512)
 {
     $json = \json_encode($value, $options, $depth);
     if (JSON_ERROR_NONE !== json_last_error()) {
-        throw new \InvalidArgumentException(
+        throw new Exception\InvalidArgumentException(
             'json_encode error: ' . json_last_error_msg()
         );
     }
 
     return $json;
 }
+
+/**
+ * Wrapper for the hrtime() or microtime() functions
+ * (depending on the PHP version, one of the two is used)
+ *
+ * @return float|mixed UNIX timestamp
+ * @internal
+ */
+function _current_time()
+{
+    return function_exists('hrtime') ? hrtime(true) / 1e9 : microtime(true);
+}
+
+
+/**
+ * @param int $options
+ *
+ * @return UriInterface
+ *
+ * @internal
+ */
+function _idn_uri_convert(UriInterface $uri, $options = 0)
+{
+    if ($uri->getHost()) {
+        $idnaVariant = defined('INTL_IDNA_VARIANT_UTS46') ? INTL_IDNA_VARIANT_UTS46 : 0;
+        $asciiHost = $idnaVariant === 0
+            ? idn_to_ascii($uri->getHost(), $options)
+            : idn_to_ascii($uri->getHost(), $options, $idnaVariant, $info);
+        if ($asciiHost === false) {
+            $errorBitSet = isset($info['errors']) ? $info['errors'] : 0;
+
+            $errorConstants = array_filter(array_keys(get_defined_constants()), function ($name) {
+                return substr($name, 0, 11) === 'IDNA_ERROR_';
+            });
+
+            $errors = [];
+            foreach ($errorConstants as $errorConstant) {
+                if ($errorBitSet & constant($errorConstant)) {
+                    $errors[] = $errorConstant;
+                }
+            }
+
+            $errorMessage = 'IDN conversion failed';
+            if ($errors) {
+                $errorMessage .= ' (errors: ' . implode(', ', $errors) . ')';
+            }
+
+            throw new InvalidArgumentException($errorMessage);
+        } else {
+            if ($uri->getHost() !== $asciiHost) {
+                // Replace URI only if the ASCII version is different
+                $uri = $uri->withHost($asciiHost);
+            }
+        }
+    }
+
+    return $uri;
+}

+ 194 - 58
api/vendor/guzzlehttp/psr7/CHANGELOG.md

@@ -1,32 +1,102 @@
-# CHANGELOG
+# Change Log
 
-## 1.4.2 - 2017-03-20
 
-* Reverted BC break to `Uri::resolve` and `Uri::removeDotSegments` by removing 
+All notable changes to this project will be documented in this file.
+
+The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
+and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
+
+
+## [Unreleased]
+
+
+## [1.6.0]
+
+### Added
+
+- Allowed version `^3.0` of `ralouphie/getallheaders` dependency (#244)
+- Added MIME type for WEBP image format (#246)
+- Added more validation of values according to PSR-7 and RFC standards, e.g. status code range (#250, #272)
+
+### Changed
+
+- Tests don't pass with HHVM 4.0, so HHVM support got dropped. Other libraries like composer have done the same. (#262)
+- Accept port number 0 to be valid (#270)
+
+### Fixed
+
+- Fixed subsequent reads from `php://input` in ServerRequest (#247)
+- Fixed readable/writable detection for certain stream modes (#248)
+- Fixed encoding of special characters in the `userInfo` component of an URI (#253)
+
+
+## [1.5.2] - 2018-12-04
+
+### Fixed
+
+- Check body size when getting the message summary
+
+
+## [1.5.1] - 2018-12-04
+
+### Fixed
+
+- Get the summary of a body only if it is readable
+
+
+## [1.5.0] - 2018-12-03
+
+### Added
+
+- Response first-line to response string exception (fixes #145)
+- A test for #129 behavior
+- `get_message_body_summary` function in order to get the message summary
+- `3gp` and `mkv` mime types
+
+### Changed
+
+- Clarify exception message when stream is detached
+
+### Deprecated
+
+- Deprecated parsing folded header lines as per RFC 7230
+
+### Fixed
+
+- Fix `AppendStream::detach` to not close streams
+- `InflateStream` preserves `isSeekable` attribute of the underlying stream
+- `ServerRequest::getUriFromGlobals` to support URLs in query parameters
+
+
+Several other fixes and improvements.
+
+
+## [1.4.2] - 2017-03-20
+
+### Fixed
+
+- Reverted BC break to `Uri::resolve` and `Uri::removeDotSegments` by removing
   calls to `trigger_error` when deprecated methods are invoked.
 
-## 1.4.1 - 2017-02-27
 
-* Reverted BC break by reintroducing behavior to automagically fix a URI with a
+## [1.4.1] - 2017-02-27
+
+### Added
+
+- Rriggering of silenced deprecation warnings.
+
+### Fixed
+
+- Reverted BC break by reintroducing behavior to automagically fix a URI with a
   relative path and an authority by adding a leading slash to the path. It's only
   deprecated now.
-* Added triggering of silenced deprecation warnings.
 
-## 1.4.0 - 2017-02-21
 
-* Fix `Stream::read` when length parameter <= 0.
-* `copy_to_stream` reads bytes in chunks instead of `maxLen` into memory.
-* Fix `ServerRequest::getUriFromGlobals` when `Host` header contains port.
-* Ensure `ServerRequest::getUriFromGlobals` returns a URI in absolute form.
-* Allow `parse_response` to parse a response without delimiting space and reason.
-* Ensure each URI modification results in a valid URI according to PSR-7 discussions.
-  Invalid modifications will throw an exception instead of returning a wrong URI or
-  doing some magic.
-  - `(new Uri)->withPath('foo')->withHost('example.com')` will throw an exception
-    because the path of a URI with an authority must start with a slash "/" or be empty
-  - `(new Uri())->withScheme('http')` will return `'http://localhost'`
-* Fix compatibility of URIs with `file` scheme and empty host.
-* Added common URI utility methods based on RFC 3986 (see documentation in the readme):
+## [1.4.0] - 2017-02-21
+
+### Added
+
+- Added common URI utility methods based on RFC 3986 (see documentation in the readme):
   - `Uri::isDefaultPort`
   - `Uri::isAbsolute`
   - `Uri::isNetworkPathReference`
@@ -37,69 +107,117 @@
   - `UriNormalizer::normalize`
   - `UriNormalizer::isEquivalent`
   - `UriResolver::relativize`
-* Deprecated `Uri::resolve` in favor of `UriResolver::resolve`
-* Deprecated `Uri::removeDotSegments` in favor of `UriResolver::removeDotSegments`
 
-## 1.3.1 - 2016-06-25
+### Changed
+
+- Ensure `ServerRequest::getUriFromGlobals` returns a URI in absolute form.
+- Allow `parse_response` to parse a response without delimiting space and reason.
+- Ensure each URI modification results in a valid URI according to PSR-7 discussions.
+  Invalid modifications will throw an exception instead of returning a wrong URI or
+  doing some magic.
+  - `(new Uri)->withPath('foo')->withHost('example.com')` will throw an exception
+    because the path of a URI with an authority must start with a slash "/" or be empty
+  - `(new Uri())->withScheme('http')` will return `'http://localhost'`
+
+### Deprecated
+
+- `Uri::resolve` in favor of `UriResolver::resolve`
+- `Uri::removeDotSegments` in favor of `UriResolver::removeDotSegments`
+
+### Fixed
+
+- `Stream::read` when length parameter <= 0.
+- `copy_to_stream` reads bytes in chunks instead of `maxLen` into memory.
+- `ServerRequest::getUriFromGlobals` when `Host` header contains port.
+- Compatibility of URIs with `file` scheme and empty host.
+
+
+## [1.3.1] - 2016-06-25
+
+### Fixed
 
-* Fix `Uri::__toString` for network path references, e.g. `//example.org`.
-* Fix missing lowercase normalization for host.
-* Fix handling of URI components in case they are `'0'` in a lot of places,
+- `Uri::__toString` for network path references, e.g. `//example.org`.
+- Missing lowercase normalization for host.
+- Handling of URI components in case they are `'0'` in a lot of places,
   e.g. as a user info password.
-* Fix `Uri::withAddedHeader` to correctly merge headers with different case.
-* Fix trimming of header values in `Uri::withAddedHeader`. Header values may
+- `Uri::withAddedHeader` to correctly merge headers with different case.
+- Trimming of header values in `Uri::withAddedHeader`. Header values may
   be surrounded by whitespace which should be ignored according to RFC 7230
   Section 3.2.4. This does not apply to header names.
-* Fix `Uri::withAddedHeader` with an array of header values.
-* Fix `Uri::resolve` when base path has no slash and handling of fragment.
-* Fix handling of encoding in `Uri::with(out)QueryValue` so one can pass the
+- `Uri::withAddedHeader` with an array of header values.
+- `Uri::resolve` when base path has no slash and handling of fragment.
+- Handling of encoding in `Uri::with(out)QueryValue` so one can pass the
   key/value both in encoded as well as decoded form to those methods. This is
   consistent with withPath, withQuery etc.
-* Fix `ServerRequest::withoutAttribute` when attribute value is null.
+- `ServerRequest::withoutAttribute` when attribute value is null.
 
-## 1.3.0 - 2016-04-13
 
-* Added remaining interfaces needed for full PSR7 compatibility
+## [1.3.0] - 2016-04-13
+
+### Added
+
+- Remaining interfaces needed for full PSR7 compatibility
   (ServerRequestInterface, UploadedFileInterface, etc.).
-* Added support for stream_for from scalars.
-* Can now extend Uri.
-* Fixed a bug in validating request methods by making it more permissive.
+- Support for stream_for from scalars.
+
+### Changed
+
+- Can now extend Uri.
+
+### Fixed
+- A bug in validating request methods by making it more permissive.
 
-## 1.2.3 - 2016-02-18
 
-* Fixed support in `GuzzleHttp\Psr7\CachingStream` for seeking forward on remote
+## [1.2.3] - 2016-02-18
+
+### Fixed
+
+- Support in `GuzzleHttp\Psr7\CachingStream` for seeking forward on remote
   streams, which can sometimes return fewer bytes than requested with `fread`.
-* Fixed handling of gzipped responses with FNAME headers.
+- Handling of gzipped responses with FNAME headers.
+
+
+## [1.2.2] - 2016-01-22
+
+### Added
 
-## 1.2.2 - 2016-01-22
+- Support for URIs without any authority.
+- Support for HTTP 451 'Unavailable For Legal Reasons.'
+- Support for using '0' as a filename.
+- Support for including non-standard ports in Host headers.
 
-* 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
+## [1.2.1] - 2015-11-02
 
-* Now supporting negative offsets when seeking to SEEK_END.
+### Changes
 
-## 1.2.0 - 2015-08-15
+- Now supporting negative offsets when seeking to SEEK_END.
 
-* Body as `"0"` is now properly added to a response.
-* Now allowing forward seeking in CachingStream.
-* Now properly parsing HTTP requests that contain proxy targets in
+
+## [1.2.0] - 2015-08-15
+
+### Changed
+
+- Body as `"0"` is now properly added to a response.
+- Now allowing forward seeking in CachingStream.
+- Now properly parsing HTTP requests that contain proxy targets in
   `parse_request`.
-* functions.php is now conditionally required.
-* user-info is no longer dropped when resolving URIs.
+- functions.php is now conditionally required.
+- user-info is no longer dropped when resolving URIs.
+
+
+## [1.1.0] - 2015-06-24
 
-## 1.1.0 - 2015-06-24
+### Changed
 
-* URIs can now be relative.
-* `multipart/form-data` headers are now overridden case-insensitively.
-* URI paths no longer encode the following characters because they are allowed
+- URIs can now be relative.
+- `multipart/form-data` headers are now overridden case-insensitively.
+- URI paths no longer encode the following characters because they are allowed
   in URIs: "(", ")", "*", "!", "'"
-* A port is no longer added to a URI when the scheme is missing and no port is
+- A port is no longer added to a URI when the scheme is missing and no port is
   present.
 
+
 ## 1.0.0 - 2015-05-19
 
 Initial release.
@@ -108,3 +226,21 @@ Currently unsupported:
 
 - `Psr\Http\Message\ServerRequestInterface`
 - `Psr\Http\Message\UploadedFileInterface`
+
+
+
+[Unreleased]: https://github.com/guzzle/psr7/compare/1.6.0...HEAD
+[1.6.0]: https://github.com/guzzle/psr7/compare/1.5.2...1.6.0
+[1.5.2]: https://github.com/guzzle/psr7/compare/1.5.1...1.5.2
+[1.5.1]: https://github.com/guzzle/psr7/compare/1.5.0...1.5.1
+[1.5.0]: https://github.com/guzzle/psr7/compare/1.4.2...1.5.0
+[1.4.2]: https://github.com/guzzle/psr7/compare/1.4.1...1.4.2
+[1.4.1]: https://github.com/guzzle/psr7/compare/1.4.0...1.4.1
+[1.4.0]: https://github.com/guzzle/psr7/compare/1.3.1...1.4.0
+[1.3.1]: https://github.com/guzzle/psr7/compare/1.3.0...1.3.1
+[1.3.0]: https://github.com/guzzle/psr7/compare/1.2.3...1.3.0
+[1.2.3]: https://github.com/guzzle/psr7/compare/1.2.2...1.2.3
+[1.2.2]: https://github.com/guzzle/psr7/compare/1.2.1...1.2.2
+[1.2.1]: https://github.com/guzzle/psr7/compare/1.2.0...1.2.1
+[1.2.0]: https://github.com/guzzle/psr7/compare/1.1.0...1.2.0
+[1.1.0]: https://github.com/guzzle/psr7/compare/1.0.0...1.1.0

+ 7 - 1
api/vendor/guzzlehttp/psr7/README.md

@@ -372,7 +372,7 @@ This method accepts the following `$resource` types:
 $stream = GuzzleHttp\Psr7\stream_for('foo');
 $stream = GuzzleHttp\Psr7\stream_for(fopen('/path/to/file', 'r'));
 
-$generator function ($bytes) {
+$generator = function ($bytes) {
     for ($i = 0; $i < $bytes; $i++) {
         yield ' ';
     }
@@ -606,6 +606,12 @@ Creates a new URI with a specific query string value. Any existing query string
 provided key are removed and replaced with the given key value pair. A value of null will set the query string
 key without a value, e.g. "key" instead of "key=value".
 
+### `GuzzleHttp\Psr7\Uri::withQueryValues`
+
+`public static function withQueryValues(UriInterface $uri, array $keyValueArray): UriInterface`
+
+Creates a new URI with multiple query string values. It has the same behavior as `withQueryValue()` but for an
+associative array of key => value.
 
 ### `GuzzleHttp\Psr7\Uri::withoutQueryValue`
 

+ 14 - 4
api/vendor/guzzlehttp/psr7/composer.json

@@ -2,7 +2,7 @@
     "name": "guzzlehttp/psr7",
     "type": "library",
     "description": "PSR-7 message implementation that also provides common utility methods",
-    "keywords": ["request", "response", "message", "stream", "http", "uri", "url"],
+    "keywords": ["request", "response", "message", "stream", "http", "uri", "url", "psr-7"],
     "license": "MIT",
     "authors": [
         {
@@ -17,23 +17,33 @@
     ],
     "require": {
         "php": ">=5.4.0",
-        "psr/http-message": "~1.0"
+        "psr/http-message": "~1.0",
+        "ralouphie/getallheaders": "^2.0.5 || ^3.0.0"
     },
     "require-dev": {
-        "phpunit/phpunit": "~4.0"
+        "phpunit/phpunit": "~4.8.36 || ^5.7.27 || ^6.5.8",
+        "ext-zlib": "*"
     },
     "provide": {
         "psr/http-message-implementation": "1.0"
     },
+    "suggest": {
+        "zendframework/zend-httphandlerrunner": "Emit PSR-7 responses"
+    },
     "autoload": {
         "psr-4": {
             "GuzzleHttp\\Psr7\\": "src/"
         },
         "files": ["src/functions_include.php"]
     },
+    "autoload-dev": {
+        "psr-4": {
+            "GuzzleHttp\\Tests\\Psr7\\": "tests/"
+        }
+    },
     "extra": {
         "branch-alias": {
-            "dev-master": "1.4-dev"
+            "dev-master": "1.6-dev"
         }
     }
 }

+ 12 - 4
api/vendor/guzzlehttp/psr7/src/AppendStream.php

@@ -16,7 +16,6 @@ class AppendStream implements StreamInterface
     private $seekable = true;
     private $current = 0;
     private $pos = 0;
-    private $detached = false;
 
     /**
      * @param StreamInterface[] $streams Streams to decorate. Each stream must
@@ -73,6 +72,7 @@ class AppendStream implements StreamInterface
     public function close()
     {
         $this->pos = $this->current = 0;
+        $this->seekable = true;
 
         foreach ($this->streams as $stream) {
             $stream->close();
@@ -82,14 +82,22 @@ class AppendStream implements StreamInterface
     }
 
     /**
-     * Detaches each attached stream
+     * Detaches each attached stream.
+     *
+     * Returns null as it's not clear which underlying stream resource to return.
      *
      * {@inheritdoc}
      */
     public function detach()
     {
-        $this->close();
-        $this->detached = true;
+        $this->pos = $this->current = 0;
+        $this->seekable = true;
+
+        foreach ($this->streams as $stream) {
+            $stream->detach();
+        }
+
+        $this->streams = [];
     }
 
     public function tell()

+ 9 - 0
api/vendor/guzzlehttp/psr7/src/FnStream.php

@@ -52,6 +52,15 @@ class FnStream implements StreamInterface
         }
     }
 
+    /**
+     * An unserialize would allow the __destruct to run when the unserialized value goes out of scope.
+     * @throws \LogicException
+     */
+    public function __wakeup()
+    {
+        throw new \LogicException('FnStream should never be unserialized');
+    }
+
     /**
      * Adds custom functionality to an underlying stream by intercepting
      * specific method calls.

+ 1 - 1
api/vendor/guzzlehttp/psr7/src/InflateStream.php

@@ -27,7 +27,7 @@ class InflateStream implements StreamInterface
         $stream = new LimitStream($stream, -1, 10 + $filenameHeaderLength);
         $resource = StreamWrapper::getResource($stream);
         stream_filter_append($resource, 'zlib.inflate', STREAM_FILTER_READ);
-        $this->stream = new Stream($resource);
+        $this->stream = $stream->isSeekable() ? new Stream($resource) : new NoSeekStream(new Stream($resource));
     }
 
     /**

+ 1 - 1
api/vendor/guzzlehttp/psr7/src/LimitStream.php

@@ -72,7 +72,7 @@ class LimitStream implements StreamInterface
     {
         if ($whence !== SEEK_SET || $offset < 0) {
             throw new \RuntimeException(sprintf(
-                'Cannot seek to offset % with whence %s',
+                'Cannot seek to offset %s with whence %s',
                 $offset,
                 $whence
             ));

+ 45 - 15
api/vendor/guzzlehttp/psr7/src/MessageTrait.php

@@ -66,11 +66,8 @@ trait MessageTrait
 
     public function withHeader($header, $value)
     {
-        if (!is_array($value)) {
-            $value = [$value];
-        }
-
-        $value = $this->trimHeaderValues($value);
+        $this->assertHeader($header);
+        $value = $this->normalizeHeaderValue($value);
         $normalized = strtolower($header);
 
         $new = clone $this;
@@ -85,11 +82,8 @@ trait MessageTrait
 
     public function withAddedHeader($header, $value)
     {
-        if (!is_array($value)) {
-            $value = [$value];
-        }
-
-        $value = $this->trimHeaderValues($value);
+        $this->assertHeader($header);
+        $value = $this->normalizeHeaderValue($value);
         $normalized = strtolower($header);
 
         $new = clone $this;
@@ -144,11 +138,13 @@ trait MessageTrait
     {
         $this->headerNames = $this->headers = [];
         foreach ($headers as $header => $value) {
-            if (!is_array($value)) {
-                $value = [$value];
+            if (is_int($header)) {
+                // Numeric array keys are converted to int by PHP but having a header name '123' is not forbidden by the spec
+                // and also allowed in withHeader(). So we need to cast it to string again for the following assertion to pass.
+                $header = (string) $header;
             }
-
-            $value = $this->trimHeaderValues($value);
+            $this->assertHeader($header);
+            $value = $this->normalizeHeaderValue($value);
             $normalized = strtolower($header);
             if (isset($this->headerNames[$normalized])) {
                 $header = $this->headerNames[$normalized];
@@ -160,6 +156,19 @@ trait MessageTrait
         }
     }
 
+    private function normalizeHeaderValue($value)
+    {
+        if (!is_array($value)) {
+            return $this->trimHeaderValues([$value]);
+        }
+
+        if (count($value) === 0) {
+            throw new \InvalidArgumentException('Header value can not be an empty array.');
+        }
+
+        return $this->trimHeaderValues($value);
+    }
+
     /**
      * Trims whitespace from the header values.
      *
@@ -177,7 +186,28 @@ trait MessageTrait
     private function trimHeaderValues(array $values)
     {
         return array_map(function ($value) {
-            return trim($value, " \t");
+            if (!is_scalar($value) && null !== $value) {
+                throw new \InvalidArgumentException(sprintf(
+                    'Header value must be scalar or null but %s provided.',
+                    is_object($value) ? get_class($value) : gettype($value)
+                ));
+            }
+
+            return trim((string) $value, " \t");
         }, $values);
     }
+
+    private function assertHeader($header)
+    {
+        if (!is_string($header)) {
+            throw new \InvalidArgumentException(sprintf(
+                'Header name must be a string but %s provided.',
+                is_object($header) ? get_class($header) : gettype($header)
+            ));
+        }
+
+        if ($header === '') {
+            throw new \InvalidArgumentException('Header name can not be empty.');
+        }
+    }
 }

+ 11 - 2
api/vendor/guzzlehttp/psr7/src/Request.php

@@ -36,6 +36,7 @@ class Request implements RequestInterface
         $body = null,
         $version = '1.1'
     ) {
+        $this->assertMethod($method);
         if (!($uri instanceof UriInterface)) {
             $uri = new Uri($uri);
         }
@@ -45,7 +46,7 @@ class Request implements RequestInterface
         $this->setHeaders($headers);
         $this->protocol = $version;
 
-        if (!$this->hasHeader('Host')) {
+        if (!isset($this->headerNames['host'])) {
             $this->updateHostFromUri();
         }
 
@@ -91,6 +92,7 @@ class Request implements RequestInterface
 
     public function withMethod($method)
     {
+        $this->assertMethod($method);
         $new = clone $this;
         $new->method = strtoupper($method);
         return $new;
@@ -110,7 +112,7 @@ class Request implements RequestInterface
         $new = clone $this;
         $new->uri = $uri;
 
-        if (!$preserveHost) {
+        if (!$preserveHost || !isset($this->headerNames['host'])) {
             $new->updateHostFromUri();
         }
 
@@ -139,4 +141,11 @@ class Request implements RequestInterface
         // See: http://tools.ietf.org/html/rfc7230#section-5.4
         $this->headers = [$header => [$host]] + $this->headers;
     }
+
+    private function assertMethod($method)
+    {
+        if (!is_string($method) || $method === '') {
+            throw new \InvalidArgumentException('Method must be a non-empty string.');
+        }
+    }
 }

+ 24 - 2
api/vendor/guzzlehttp/psr7/src/Response.php

@@ -93,7 +93,11 @@ class Response implements ResponseInterface
         $version = '1.1',
         $reason = null
     ) {
-        $this->statusCode = (int) $status;
+        $this->assertStatusCodeIsInteger($status);
+        $status = (int) $status;
+        $this->assertStatusCodeRange($status);
+
+        $this->statusCode = $status;
 
         if ($body !== '' && $body !== null) {
             $this->stream = stream_for($body);
@@ -121,12 +125,30 @@ class Response implements ResponseInterface
 
     public function withStatus($code, $reasonPhrase = '')
     {
+        $this->assertStatusCodeIsInteger($code);
+        $code = (int) $code;
+        $this->assertStatusCodeRange($code);
+
         $new = clone $this;
-        $new->statusCode = (int) $code;
+        $new->statusCode = $code;
         if ($reasonPhrase == '' && isset(self::$phrases[$new->statusCode])) {
             $reasonPhrase = self::$phrases[$new->statusCode];
         }
         $new->reasonPhrase = $reasonPhrase;
         return $new;
     }
+
+    private function assertStatusCodeIsInteger($statusCode)
+    {
+        if (filter_var($statusCode, FILTER_VALIDATE_INT) === false) {
+            throw new \InvalidArgumentException('Status code must be an integer value.');
+        }
+    }
+
+    private function assertStatusCodeRange($statusCode)
+    {
+        if ($statusCode < 100 || $statusCode >= 600) {
+            throw new \InvalidArgumentException('Status code must be an integer value between 1xx and 5xx.');
+        }
+    }
 }

+ 18 - 0
api/vendor/guzzlehttp/psr7/src/Rfc7230.php

@@ -0,0 +1,18 @@
+<?php
+
+namespace GuzzleHttp\Psr7;
+
+final class Rfc7230
+{
+    /**
+     * Header related regular expressions (copied from amphp/http package)
+     * (Note: once we require PHP 7.x we could just depend on the upstream package)
+     *
+     * Note: header delimiter (\r\n) is modified to \r?\n to accept line feed only delimiters for BC reasons.
+     *
+     * @link    https://github.com/amphp/http/blob/v1.0.1/src/Rfc7230.php#L12-L15
+     * @license https://github.com/amphp/http/blob/v1.0.1/LICENSE
+     */
+    const HEADER_REGEX = "(^([^()<>@,;:\\\"/[\]?={}\x01-\x20\x7F]++):[ \t]*+((?:[ \t]*+[\x21-\x7E\x80-\xFF]++)*+)[ \t]*+\r?\n)m";
+    const HEADER_FOLD_REGEX = "(\r?\n[ \t]++)";
+}

+ 26 - 8
api/vendor/guzzlehttp/psr7/src/ServerRequest.php

@@ -166,9 +166,9 @@ class ServerRequest extends Request implements ServerRequestInterface
     public static function fromGlobals()
     {
         $method = isset($_SERVER['REQUEST_METHOD']) ? $_SERVER['REQUEST_METHOD'] : 'GET';
-        $headers = function_exists('getallheaders') ? getallheaders() : [];
+        $headers = getallheaders();
         $uri = self::getUriFromGlobals();
-        $body = new LazyOpenStream('php://input', 'r+');
+        $body = new CachingStream(new LazyOpenStream('php://input', 'r+'));
         $protocol = isset($_SERVER['SERVER_PROTOCOL']) ? str_replace('HTTP/', '', $_SERVER['SERVER_PROTOCOL']) : '1.1';
 
         $serverRequest = new ServerRequest($method, $uri, $headers, $body, $protocol, $_SERVER);
@@ -180,23 +180,41 @@ class ServerRequest extends Request implements ServerRequestInterface
             ->withUploadedFiles(self::normalizeFiles($_FILES));
     }
 
+    private static function extractHostAndPortFromAuthority($authority)
+    {
+        $uri = 'http://'.$authority;
+        $parts = parse_url($uri);
+        if (false === $parts) {
+            return [null, null];
+        }
+
+        $host = isset($parts['host']) ? $parts['host'] : null;
+        $port = isset($parts['port']) ? $parts['port'] : null;
+
+        return [$host, $port];
+    }
+
     /**
      * Get a Uri populated with values from $_SERVER.
      *
      * @return UriInterface
      */
-    public static function getUriFromGlobals() {
+    public static function getUriFromGlobals()
+    {
         $uri = new Uri('');
 
         $uri = $uri->withScheme(!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' ? 'https' : 'http');
 
         $hasPort = false;
         if (isset($_SERVER['HTTP_HOST'])) {
-            $hostHeaderParts = explode(':', $_SERVER['HTTP_HOST']);
-            $uri = $uri->withHost($hostHeaderParts[0]);
-            if (isset($hostHeaderParts[1])) {
+            list($host, $port) = self::extractHostAndPortFromAuthority($_SERVER['HTTP_HOST']);
+            if ($host !== null) {
+                $uri = $uri->withHost($host);
+            }
+
+            if ($port !== null) {
                 $hasPort = true;
-                $uri = $uri->withPort($hostHeaderParts[1]);
+                $uri = $uri->withPort($port);
             }
         } elseif (isset($_SERVER['SERVER_NAME'])) {
             $uri = $uri->withHost($_SERVER['SERVER_NAME']);
@@ -210,7 +228,7 @@ class ServerRequest extends Request implements ServerRequestInterface
 
         $hasQuery = false;
         if (isset($_SERVER['REQUEST_URI'])) {
-            $requestUriParts = explode('?', $_SERVER['REQUEST_URI']);
+            $requestUriParts = explode('?', $_SERVER['REQUEST_URI'], 2);
             $uri = $uri->withPath($requestUriParts[0]);
             if (isset($requestUriParts[1])) {
                 $hasQuery = true;

+ 39 - 29
api/vendor/guzzlehttp/psr7/src/Stream.php

@@ -10,6 +10,17 @@ use Psr\Http\Message\StreamInterface;
  */
 class Stream implements StreamInterface
 {
+    /**
+     * Resource modes.
+     *
+     * @var string
+     *
+     * @see http://php.net/manual/function.fopen.php
+     * @see http://php.net/manual/en/function.gzopen.php
+     */
+    const READABLE_MODES = '/r|a\+|ab\+|w\+|wb\+|x\+|xb\+|c\+|cb\+/';
+    const WRITABLE_MODES = '/a|w|r\+|rb\+|rw|x|c/';
+
     private $stream;
     private $size;
     private $seekable;
@@ -18,22 +29,6 @@ class Stream implements StreamInterface
     private $uri;
     private $customMetadata;
 
-    /** @var array Hash of readable and writable stream types */
-    private static $readWriteHash = [
-        'read' => [
-            'r' => true, 'w+' => true, 'r+' => true, 'x+' => true, 'c+' => true,
-            'rb' => true, 'w+b' => true, 'r+b' => true, 'x+b' => true,
-            'c+b' => true, 'rt' => true, 'w+t' => true, 'r+t' => true,
-            'x+t' => true, 'c+t' => true, 'a+' => true
-        ],
-        'write' => [
-            'w' => true, 'w+' => true, 'rw' => true, 'r+' => true, 'x+' => true,
-            'c+' => true, 'wb' => true, 'w+b' => true, 'r+b' => true,
-            'x+b' => true, 'c+b' => true, 'w+t' => true, 'r+t' => true,
-            'x+t' => true, 'c+t' => true, 'a' => true, 'a+' => true
-        ]
-    ];
-
     /**
      * This constructor accepts an associative array of options.
      *
@@ -65,20 +60,11 @@ class Stream implements StreamInterface
         $this->stream = $stream;
         $meta = stream_get_meta_data($this->stream);
         $this->seekable = $meta['seekable'];
-        $this->readable = isset(self::$readWriteHash['read'][$meta['mode']]);
-        $this->writable = isset(self::$readWriteHash['write'][$meta['mode']]);
+        $this->readable = (bool)preg_match(self::READABLE_MODES, $meta['mode']);
+        $this->writable = (bool)preg_match(self::WRITABLE_MODES, $meta['mode']);
         $this->uri = $this->getMetadata('uri');
     }
 
-    public function __get($name)
-    {
-        if ($name == 'stream') {
-            throw new \RuntimeException('The stream is detached');
-        }
-
-        throw new \BadMethodCallException('No value for ' . $name);
-    }
-
     /**
      * Closes the stream when the destructed
      */
@@ -99,6 +85,10 @@ class Stream implements StreamInterface
 
     public function getContents()
     {
+        if (!isset($this->stream)) {
+            throw new \RuntimeException('Stream is detached');
+        }
+
         $contents = stream_get_contents($this->stream);
 
         if ($contents === false) {
@@ -173,11 +163,19 @@ class Stream implements StreamInterface
 
     public function eof()
     {
-        return !$this->stream || feof($this->stream);
+        if (!isset($this->stream)) {
+            throw new \RuntimeException('Stream is detached');
+        }
+
+        return feof($this->stream);
     }
 
     public function tell()
     {
+        if (!isset($this->stream)) {
+            throw new \RuntimeException('Stream is detached');
+        }
+
         $result = ftell($this->stream);
 
         if ($result === false) {
@@ -194,9 +192,15 @@ class Stream implements StreamInterface
 
     public function seek($offset, $whence = SEEK_SET)
     {
+        $whence = (int) $whence;
+        
+        if (!isset($this->stream)) {
+            throw new \RuntimeException('Stream is detached');
+        }
         if (!$this->seekable) {
             throw new \RuntimeException('Stream is not seekable');
-        } elseif (fseek($this->stream, $offset, $whence) === -1) {
+        }
+        if (fseek($this->stream, $offset, $whence) === -1) {
             throw new \RuntimeException('Unable to seek to stream position '
                 . $offset . ' with whence ' . var_export($whence, true));
         }
@@ -204,6 +208,9 @@ class Stream implements StreamInterface
 
     public function read($length)
     {
+        if (!isset($this->stream)) {
+            throw new \RuntimeException('Stream is detached');
+        }
         if (!$this->readable) {
             throw new \RuntimeException('Cannot read from non-readable stream');
         }
@@ -225,6 +232,9 @@ class Stream implements StreamInterface
 
     public function write($string)
     {
+        if (!isset($this->stream)) {
+            throw new \RuntimeException('Stream is detached');
+        }
         if (!$this->writable) {
             throw new \RuntimeException('Cannot write to a non-writable stream');
         }

+ 43 - 3
api/vendor/guzzlehttp/psr7/src/StreamWrapper.php

@@ -38,9 +38,21 @@ class StreamWrapper
                 . 'writable, or both.');
         }
 
-        return fopen('guzzle://stream', $mode, null, stream_context_create([
+        return fopen('guzzle://stream', $mode, null, self::createStreamContext($stream));
+    }
+
+    /**
+     * Creates a stream context that can be used to open a stream as a php stream resource.
+     *
+     * @param StreamInterface $stream
+     *
+     * @return resource
+     */
+    public static function createStreamContext(StreamInterface $stream)
+    {
+        return stream_context_create([
             'guzzle' => ['stream' => $stream]
-        ]));
+        ]);
     }
 
     /**
@@ -94,12 +106,21 @@ class StreamWrapper
         return true;
     }
 
+    public function stream_cast($cast_as)
+    {
+        $stream = clone($this->stream);
+
+        return $stream->detach();
+    }
+
     public function stream_stat()
     {
         static $modeMap = [
             'r'  => 33060,
+            'rb' => 33060,
             'r+' => 33206,
-            'w'  => 33188
+            'w'  => 33188,
+            'wb' => 33188
         ];
 
         return [
@@ -118,4 +139,23 @@ class StreamWrapper
             'blocks'  => 0
         ];
     }
+
+    public function url_stat($path, $flags)
+    {
+        return [
+            'dev'     => 0,
+            'ino'     => 0,
+            'mode'    => 0,
+            'nlink'   => 0,
+            'uid'     => 0,
+            'gid'     => 0,
+            'rdev'    => 0,
+            'size'    => 0,
+            'atime'   => 0,
+            'mtime'   => 0,
+            'ctime'   => 0,
+            'blksize' => 0,
+            'blocks'  => 0
+        ];
+    }
 }

+ 91 - 33
api/vendor/guzzlehttp/psr7/src/Uri.php

@@ -301,15 +301,7 @@ class Uri implements UriInterface
      */
     public static function withoutQueryValue(UriInterface $uri, $key)
     {
-        $current = $uri->getQuery();
-        if ($current === '') {
-            return $uri;
-        }
-
-        $decodedKey = rawurldecode($key);
-        $result = array_filter(explode('&', $current), function ($part) use ($decodedKey) {
-            return rawurldecode(explode('=', $part)[0]) !== $decodedKey;
-        });
+        $result = self::getFilteredQueryString($uri, [$key]);
 
         return $uri->withQuery(implode('&', $result));
     }
@@ -331,26 +323,29 @@ class Uri implements UriInterface
      */
     public static function withQueryValue(UriInterface $uri, $key, $value)
     {
-        $current = $uri->getQuery();
+        $result = self::getFilteredQueryString($uri, [$key]);
 
-        if ($current === '') {
-            $result = [];
-        } else {
-            $decodedKey = rawurldecode($key);
-            $result = array_filter(explode('&', $current), function ($part) use ($decodedKey) {
-                return rawurldecode(explode('=', $part)[0]) !== $decodedKey;
-            });
-        }
+        $result[] = self::generateQueryString($key, $value);
 
-        // Query string separators ("=", "&") within the key or value need to be encoded
-        // (while preventing double-encoding) before setting the query string. All other
-        // chars that need percent-encoding will be encoded by withQuery().
-        $key = strtr($key, self::$replaceQuery);
+        return $uri->withQuery(implode('&', $result));
+    }
 
-        if ($value !== null) {
-            $result[] = $key . '=' . strtr($value, self::$replaceQuery);
-        } else {
-            $result[] = $key;
+    /**
+     * Creates a new URI with multiple specific query string values.
+     *
+     * It has the same behavior as withQueryValue() but for an associative array of key => value.
+     *
+     * @param UriInterface $uri           URI to use as a base.
+     * @param array        $keyValueArray Associative array of key and values
+     *
+     * @return UriInterface
+     */
+    public static function withQueryValues(UriInterface $uri, array $keyValueArray)
+    {
+        $result = self::getFilteredQueryString($uri, array_keys($keyValueArray));
+
+        foreach ($keyValueArray as $key => $value) {
+            $result[] = self::generateQueryString($key, $value);
         }
 
         return $uri->withQuery(implode('&', $result));
@@ -442,9 +437,9 @@ class Uri implements UriInterface
 
     public function withUserInfo($user, $password = null)
     {
-        $info = $user;
-        if ($password != '') {
-            $info .= ':' . $password;
+        $info = $this->filterUserInfoComponent($user);
+        if ($password !== null) {
+            $info .= ':' . $this->filterUserInfoComponent($password);
         }
 
         if ($this->userInfo === $info) {
@@ -542,7 +537,9 @@ class Uri implements UriInterface
         $this->scheme = isset($parts['scheme'])
             ? $this->filterScheme($parts['scheme'])
             : '';
-        $this->userInfo = isset($parts['user']) ? $parts['user'] : '';
+        $this->userInfo = isset($parts['user'])
+            ? $this->filterUserInfoComponent($parts['user'])
+            : '';
         $this->host = isset($parts['host'])
             ? $this->filterHost($parts['host'])
             : '';
@@ -559,7 +556,7 @@ class Uri implements UriInterface
             ? $this->filterQueryAndFragment($parts['fragment'])
             : '';
         if (isset($parts['pass'])) {
-            $this->userInfo .= ':' . $parts['pass'];
+            $this->userInfo .= ':' . $this->filterUserInfoComponent($parts['pass']);
         }
 
         $this->removeDefaultPort();
@@ -581,6 +578,26 @@ class Uri implements UriInterface
         return strtolower($scheme);
     }
 
+    /**
+     * @param string $component
+     *
+     * @return string
+     *
+     * @throws \InvalidArgumentException If the user info is invalid.
+     */
+    private function filterUserInfoComponent($component)
+    {
+        if (!is_string($component)) {
+            throw new \InvalidArgumentException('User info must be a string');
+        }
+
+        return preg_replace_callback(
+            '/(?:[^%' . self::$charUnreserved . self::$charSubDelims . ']+|%(?![A-Fa-f0-9]{2}))/',
+            [$this, 'rawurlencodeMatchZero'],
+            $component
+        );
+    }
+
     /**
      * @param string $host
      *
@@ -611,15 +628,56 @@ class Uri implements UriInterface
         }
 
         $port = (int) $port;
-        if (1 > $port || 0xffff < $port) {
+        if (0 > $port || 0xffff < $port) {
             throw new \InvalidArgumentException(
-                sprintf('Invalid port: %d. Must be between 1 and 65535', $port)
+                sprintf('Invalid port: %d. Must be between 0 and 65535', $port)
             );
         }
 
         return $port;
     }
 
+    /**
+     * @param UriInterface $uri
+     * @param array        $keys
+     * 
+     * @return array
+     */
+    private static function getFilteredQueryString(UriInterface $uri, array $keys)
+    {
+        $current = $uri->getQuery();
+
+        if ($current === '') {
+            return [];
+        }
+
+        $decodedKeys = array_map('rawurldecode', $keys);
+
+        return array_filter(explode('&', $current), function ($part) use ($decodedKeys) {
+            return !in_array(rawurldecode(explode('=', $part)[0]), $decodedKeys, true);
+        });
+    }
+
+    /**
+     * @param string      $key
+     * @param string|null $value
+     * 
+     * @return string
+     */
+    private static function generateQueryString($key, $value)
+    {
+        // Query string separators ("=", "&") within the key or value need to be encoded
+        // (while preventing double-encoding) before setting the query string. All other
+        // chars that need percent-encoding will be encoded by withQuery().
+        $queryString = strtr($key, self::$replaceQuery);
+
+        if ($value !== null) {
+            $queryString .= '=' . strtr($value, self::$replaceQuery);
+        }
+
+        return $queryString;
+    }
+
     private function removeDefaultPort()
     {
         if ($this->port !== null && self::isDefaultPort($this)) {

+ 101 - 30
api/vendor/guzzlehttp/psr7/src/functions.php

@@ -69,10 +69,10 @@ function uri_for($uri)
  * - metadata: Array of custom metadata.
  * - size: Size of the stream.
  *
- * @param resource|string|null|int|float|bool|StreamInterface|callable $resource Entity body data
- * @param array                                                        $options  Additional options
+ * @param resource|string|null|int|float|bool|StreamInterface|callable|\Iterator $resource Entity body data
+ * @param array                                                                  $options  Additional options
  *
- * @return Stream
+ * @return StreamInterface
  * @throws \InvalidArgumentException if the $resource arg is not valid.
  */
 function stream_for($resource = '', array $options = [])
@@ -238,7 +238,7 @@ function modify_request(RequestInterface $request, array $changes)
     }
 
     if ($request instanceof ServerRequestInterface) {
-        return new ServerRequest(
+        return (new ServerRequest(
             isset($changes['method']) ? $changes['method'] : $request->getMethod(),
             $uri,
             $headers,
@@ -247,7 +247,11 @@ function modify_request(RequestInterface $request, array $changes)
                 ? $changes['version']
                 : $request->getProtocolVersion(),
             $request->getServerParams()
-        );
+        ))
+        ->withParsedBody($request->getParsedBody())
+        ->withQueryParams($request->getQueryParams())
+        ->withCookieParams($request->getCookieParams())
+        ->withUploadedFiles($request->getUploadedFiles());
     }
 
     return new Request(
@@ -431,7 +435,7 @@ function hash(
  * @param StreamInterface $stream    Stream to read from
  * @param int             $maxLength Maximum buffer length
  *
- * @return string|bool
+ * @return string
  */
 function readline(StreamInterface $stream, $maxLength = null)
 {
@@ -495,7 +499,7 @@ function parse_response($message)
     // between status-code and reason-phrase is required. But browsers accept
     // responses without space and reason as well.
     if (!preg_match('/^HTTP\/.* [0-9]{3}( .*|$)/', $data['start-line'])) {
-        throw new \InvalidArgumentException('Invalid response string');
+        throw new \InvalidArgumentException('Invalid response string: ' . $data['start-line']);
     }
     $parts = explode(' ', $data['start-line'], 3);
 
@@ -516,8 +520,8 @@ function parse_response($message)
  * PHP style arrays into an associative array (e.g., foo[a]=1&foo[b]=2 will
  * be parsed into ['foo[a]' => '1', 'foo[b]' => '2']).
  *
- * @param string      $str         Query string to parse
- * @param bool|string $urlEncoding How the query string is encoded
+ * @param string   $str         Query string to parse
+ * @param int|bool $urlEncoding How the query string is encoded
  *
  * @return array
  */
@@ -533,9 +537,9 @@ function parse_query($str, $urlEncoding = true)
         $decoder = function ($value) {
             return rawurldecode(str_replace('+', ' ', $value));
         };
-    } elseif ($urlEncoding == PHP_QUERY_RFC3986) {
+    } elseif ($urlEncoding === PHP_QUERY_RFC3986) {
         $decoder = 'rawurldecode';
-    } elseif ($urlEncoding == PHP_QUERY_RFC1738) {
+    } elseif ($urlEncoding === PHP_QUERY_RFC1738) {
         $decoder = 'urldecode';
     } else {
         $decoder = function ($str) { return $str; };
@@ -633,6 +637,7 @@ function mimetype_from_filename($filename)
 function mimetype_from_extension($extension)
 {
     static $mimetypes = [
+        '3gp' => 'video/3gpp',
         '7z' => 'application/x-7z-compressed',
         'aac' => 'audio/x-aac',
         'ai' => 'application/postscript',
@@ -680,6 +685,7 @@ function mimetype_from_extension($extension)
         'mid' => 'audio/midi',
         'midi' => 'audio/midi',
         'mov' => 'video/quicktime',
+        'mkv' => 'video/x-matroska',
         'mp3' => 'audio/mpeg',
         'mp4' => 'video/mp4',
         'mp4a' => 'audio/mp4',
@@ -718,6 +724,7 @@ function mimetype_from_extension($extension)
         'txt' => 'text/plain',
         'wav' => 'audio/x-wav',
         'webm' => 'video/webm',
+        'webp' => 'image/webp',
         'wma' => 'audio/x-ms-wma',
         'wmv' => 'video/x-ms-wmv',
         'woff' => 'application/x-font-woff',
@@ -758,29 +765,53 @@ function _parse_message($message)
         throw new \InvalidArgumentException('Invalid message');
     }
 
-    // Iterate over each line in the message, accounting for line endings
-    $lines = preg_split('/(\\r?\\n)/', $message, -1, PREG_SPLIT_DELIM_CAPTURE);
-    $result = ['start-line' => array_shift($lines), 'headers' => [], 'body' => ''];
-    array_shift($lines);
+    $message = ltrim($message, "\r\n");
 
-    for ($i = 0, $totalLines = count($lines); $i < $totalLines; $i += 2) {
-        $line = $lines[$i];
-        // If two line breaks were encountered, then this is the end of body
-        if (empty($line)) {
-            if ($i < $totalLines - 1) {
-                $result['body'] = implode('', array_slice($lines, $i + 2));
-            }
-            break;
-        }
-        if (strpos($line, ':')) {
-            $parts = explode(':', $line, 2);
-            $key = trim($parts[0]);
-            $value = isset($parts[1]) ? trim($parts[1]) : '';
-            $result['headers'][$key][] = $value;
+    $messageParts = preg_split("/\r?\n\r?\n/", $message, 2);
+
+    if ($messageParts === false || count($messageParts) !== 2) {
+        throw new \InvalidArgumentException('Invalid message: Missing header delimiter');
+    }
+
+    list($rawHeaders, $body) = $messageParts;
+    $rawHeaders .= "\r\n"; // Put back the delimiter we split previously
+    $headerParts = preg_split("/\r?\n/", $rawHeaders, 2);
+
+    if ($headerParts === false || count($headerParts) !== 2) {
+        throw new \InvalidArgumentException('Invalid message: Missing status line');
+    }
+
+    list($startLine, $rawHeaders) = $headerParts;
+
+    if (preg_match("/(?:^HTTP\/|^[A-Z]+ \S+ HTTP\/)(\d+(?:\.\d+)?)/i", $startLine, $matches) && $matches[1] === '1.0') {
+        // Header folding is deprecated for HTTP/1.1, but allowed in HTTP/1.0
+        $rawHeaders = preg_replace(Rfc7230::HEADER_FOLD_REGEX, ' ', $rawHeaders);
+    }
+
+    /** @var array[] $headerLines */
+    $count = preg_match_all(Rfc7230::HEADER_REGEX, $rawHeaders, $headerLines, PREG_SET_ORDER);
+
+    // If these aren't the same, then one line didn't match and there's an invalid header.
+    if ($count !== substr_count($rawHeaders, "\n")) {
+        // Folding is deprecated, see https://tools.ietf.org/html/rfc7230#section-3.2.4
+        if (preg_match(Rfc7230::HEADER_FOLD_REGEX, $rawHeaders)) {
+            throw new \InvalidArgumentException('Invalid header syntax: Obsolete line folding');
         }
+
+        throw new \InvalidArgumentException('Invalid header syntax');
     }
 
-    return $result;
+    $headers = [];
+
+    foreach ($headerLines as $headerLine) {
+        $headers[$headerLine[1]][] = $headerLine[2];
+    }
+
+    return [
+        'start-line' => $startLine,
+        'headers' => $headers,
+        'body' => $body,
+    ];
 }
 
 /**
@@ -809,6 +840,46 @@ function _parse_request_uri($path, array $headers)
     return $scheme . '://' . $host . '/' . ltrim($path, '/');
 }
 
+/**
+ * Get a short summary of the message body
+ *
+ * Will return `null` if the response is not printable.
+ *
+ * @param MessageInterface $message    The message to get the body summary
+ * @param int              $truncateAt The maximum allowed size of the summary
+ *
+ * @return null|string
+ */
+function get_message_body_summary(MessageInterface $message, $truncateAt = 120)
+{
+    $body = $message->getBody();
+
+    if (!$body->isSeekable() || !$body->isReadable()) {
+        return null;
+    }
+
+    $size = $body->getSize();
+
+    if ($size === 0) {
+        return null;
+    }
+
+    $summary = $body->read($truncateAt);
+    $body->rewind();
+
+    if ($size > $truncateAt) {
+        $summary .= ' (truncated...)';
+    }
+
+    // Matches any printable character, including unicode characters:
+    // letters, marks, numbers, punctuation, spacing, and separators.
+    if (preg_match('/[^\pL\pM\pN\pP\pS\pZ\n\r\t]/', $summary)) {
+        return null;
+    }
+
+    return $summary;
+}
+
 /** @internal */
 function _caseless_remove($keys, array $data)
 {

+ 21 - 0
api/vendor/ralouphie/getallheaders/LICENSE

@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) 2014 Ralph Khattar
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.

+ 27 - 0
api/vendor/ralouphie/getallheaders/README.md

@@ -0,0 +1,27 @@
+getallheaders
+=============
+
+PHP `getallheaders()` polyfill. Compatible with PHP >= 5.3.
+
+[![Build Status](https://travis-ci.org/ralouphie/getallheaders.svg?branch=master)](https://travis-ci.org/ralouphie/getallheaders)
+[![Coverage Status](https://coveralls.io/repos/ralouphie/getallheaders/badge.png?branch=master)](https://coveralls.io/r/ralouphie/getallheaders?branch=master)
+[![Latest Stable Version](https://poser.pugx.org/ralouphie/getallheaders/v/stable.png)](https://packagist.org/packages/ralouphie/getallheaders)
+[![Latest Unstable Version](https://poser.pugx.org/ralouphie/getallheaders/v/unstable.png)](https://packagist.org/packages/ralouphie/getallheaders)
+[![License](https://poser.pugx.org/ralouphie/getallheaders/license.png)](https://packagist.org/packages/ralouphie/getallheaders)
+
+
+This is a simple polyfill for [`getallheaders()`](http://www.php.net/manual/en/function.getallheaders.php).
+
+## Install
+
+For PHP version **`>= 5.6`**:
+
+```
+composer require ralouphie/getallheaders
+```
+
+For PHP version **`< 5.6`**:
+
+```
+composer require ralouphie/getallheaders "^2"
+```

+ 26 - 0
api/vendor/ralouphie/getallheaders/composer.json

@@ -0,0 +1,26 @@
+{
+	"name": "ralouphie/getallheaders",
+	"description": "A polyfill for getallheaders.",
+	"license": "MIT",
+	"authors": [
+		{
+			"name": "Ralph Khattar",
+			"email": "ralph.khattar@gmail.com"
+		}
+	],
+	"require": {
+		"php": ">=5.6"
+	},
+	"require-dev": {
+		"phpunit/phpunit": "^5 || ^6.5",
+		"php-coveralls/php-coveralls": "^2.1"
+	},
+	"autoload": {
+		"files": ["src/getallheaders.php"]
+	},
+	"autoload-dev": {
+		"psr-4": {
+			"getallheaders\\Tests\\": "tests/"
+		}
+	}
+}

+ 46 - 0
api/vendor/ralouphie/getallheaders/src/getallheaders.php

@@ -0,0 +1,46 @@
+<?php
+
+if (!function_exists('getallheaders')) {
+
+    /**
+     * Get all HTTP header key/values as an associative array for the current request.
+     *
+     * @return string[string] The HTTP header key/value pairs.
+     */
+    function getallheaders()
+    {
+        $headers = array();
+
+        $copy_server = array(
+            'CONTENT_TYPE'   => 'Content-Type',
+            'CONTENT_LENGTH' => 'Content-Length',
+            'CONTENT_MD5'    => 'Content-Md5',
+        );
+
+        foreach ($_SERVER as $key => $value) {
+            if (substr($key, 0, 5) === 'HTTP_') {
+                $key = substr($key, 5);
+                if (!isset($copy_server[$key]) || !isset($_SERVER[$key])) {
+                    $key = str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', $key))));
+                    $headers[$key] = $value;
+                }
+            } elseif (isset($copy_server[$key])) {
+                $headers[$copy_server[$key]] = $value;
+            }
+        }
+
+        if (!isset($headers['Authorization'])) {
+            if (isset($_SERVER['REDIRECT_HTTP_AUTHORIZATION'])) {
+                $headers['Authorization'] = $_SERVER['REDIRECT_HTTP_AUTHORIZATION'];
+            } elseif (isset($_SERVER['PHP_AUTH_USER'])) {
+                $basic_pass = isset($_SERVER['PHP_AUTH_PW']) ? $_SERVER['PHP_AUTH_PW'] : '';
+                $headers['Authorization'] = 'Basic ' . base64_encode($_SERVER['PHP_AUTH_USER'] . ':' . $basic_pass);
+            } elseif (isset($_SERVER['PHP_AUTH_DIGEST'])) {
+                $headers['Authorization'] = $_SERVER['PHP_AUTH_DIGEST'];
+            }
+        }
+
+        return $headers;
+    }
+
+}