diff options
Diffstat (limited to 'bin/wiki/vendor/ralouphie/getallheaders')
8 files changed, 273 insertions, 0 deletions
diff --git a/bin/wiki/vendor/ralouphie/getallheaders/.gitignore b/bin/wiki/vendor/ralouphie/getallheaders/.gitignore new file mode 100644 index 00000000..1324e7d3 --- /dev/null +++ b/bin/wiki/vendor/ralouphie/getallheaders/.gitignore @@ -0,0 +1,5 @@ +.idea +.DS_store +/vendor/ +composer.phar +composer.lock diff --git a/bin/wiki/vendor/ralouphie/getallheaders/.travis.yml b/bin/wiki/vendor/ralouphie/getallheaders/.travis.yml new file mode 100644 index 00000000..f45b55fa --- /dev/null +++ b/bin/wiki/vendor/ralouphie/getallheaders/.travis.yml @@ -0,0 +1,18 @@ +language: php + +php: + - 5.3 + - 5.4 + - 5.5 + - 5.6 + - 7.0 + +before_script: + - composer install + +script: + - mkdir -p build/logs + - php vendor/bin/phpunit -c phpunit.xml + +after_script: + - php vendor/bin/coveralls -v
\ No newline at end of file diff --git a/bin/wiki/vendor/ralouphie/getallheaders/LICENSE b/bin/wiki/vendor/ralouphie/getallheaders/LICENSE new file mode 100644 index 00000000..be5540c2 --- /dev/null +++ b/bin/wiki/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. diff --git a/bin/wiki/vendor/ralouphie/getallheaders/README.md b/bin/wiki/vendor/ralouphie/getallheaders/README.md new file mode 100644 index 00000000..f3329d66 --- /dev/null +++ b/bin/wiki/vendor/ralouphie/getallheaders/README.md @@ -0,0 +1,19 @@ +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 + +``` +composer require ralouphie/getallheaders +``` diff --git a/bin/wiki/vendor/ralouphie/getallheaders/composer.json b/bin/wiki/vendor/ralouphie/getallheaders/composer.json new file mode 100644 index 00000000..5a0d595c --- /dev/null +++ b/bin/wiki/vendor/ralouphie/getallheaders/composer.json @@ -0,0 +1,21 @@ +{ + "name": "ralouphie/getallheaders", + "description": "A polyfill for getallheaders.", + "license": "MIT", + "authors": [ + { + "name": "Ralph Khattar", + "email": "ralph.khattar@gmail.com" + } + ], + "require": { + "php": ">=5.3" + }, + "require-dev": { + "phpunit/phpunit": "~3.7.0", + "satooshi/php-coveralls": ">=1.0" + }, + "autoload": { + "files": ["src/getallheaders.php"] + } +}
\ No newline at end of file diff --git a/bin/wiki/vendor/ralouphie/getallheaders/phpunit.xml b/bin/wiki/vendor/ralouphie/getallheaders/phpunit.xml new file mode 100644 index 00000000..7255b23d --- /dev/null +++ b/bin/wiki/vendor/ralouphie/getallheaders/phpunit.xml @@ -0,0 +1,22 @@ +<phpunit + bootstrap="vendor/autoload.php" + convertErrorsToExceptions="true" + convertNoticesToExceptions="true" + convertWarningsToExceptions="true" + strict="true"> + + <testsuite> + <directory>./tests</directory> + </testsuite> + + <filter> + <whitelist> + <directory suffix=".php">src</directory> + </whitelist> + </filter> + + <logging> + <log type="coverage-clover" target="build/logs/clover.xml"/> + </logging> + +</phpunit>
\ No newline at end of file diff --git a/bin/wiki/vendor/ralouphie/getallheaders/src/getallheaders.php b/bin/wiki/vendor/ralouphie/getallheaders/src/getallheaders.php new file mode 100644 index 00000000..c7285a5b --- /dev/null +++ b/bin/wiki/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; + } + +} diff --git a/bin/wiki/vendor/ralouphie/getallheaders/tests/GetAllHeadersTest.php b/bin/wiki/vendor/ralouphie/getallheaders/tests/GetAllHeadersTest.php new file mode 100644 index 00000000..8e3d1790 --- /dev/null +++ b/bin/wiki/vendor/ralouphie/getallheaders/tests/GetAllHeadersTest.php @@ -0,0 +1,121 @@ +<?php + +class GetAllHeadersTest extends \PHPUnit_Framework_TestCase +{ + + /** + * @dataProvider testWorksData + */ + public function testWorks($test_type, $expected, $server) + { + foreach ($server as $key => $val) { + $_SERVER[$key] = $val; + } + $result = getallheaders(); + $this->assertEquals($expected, $result, "Error testing $test_type works."); + } + + public function testWorksData() + { + return array( + array( + 'normal case', + array( + 'Key-One' => 'foo', + 'Key-Two' => 'bar', + 'Another-Key-For-Testing' => 'baz' + ), + array( + 'HTTP_KEY_ONE' => 'foo', + 'HTTP_KEY_TWO' => 'bar', + 'HTTP_ANOTHER_KEY_FOR_TESTING' => 'baz' + ) + ), + array( + 'Content-Type', + array( + 'Content-Type' => 'two' + ), + array( + 'HTTP_CONTENT_TYPE' => 'one', + 'CONTENT_TYPE' => 'two' + ) + ), + array( + 'Content-Length', + array( + 'Content-Length' => '222' + ), + array( + 'CONTENT_LENGTH' => '222', + 'HTTP_CONTENT_LENGTH' => '111' + ) + ), + array( + 'Content-Length (HTTP_CONTENT_LENGTH only)', + array( + 'Content-Length' => '111' + ), + array( + 'HTTP_CONTENT_LENGTH' => '111' + ) + ), + array( + 'Content-MD5', + array( + 'Content-Md5' => 'aef123' + ), + array( + 'CONTENT_MD5' => 'aef123', + 'HTTP_CONTENT_MD5' => 'fea321' + ) + ), + array( + 'Content-MD5 (HTTP_CONTENT_MD5 only)', + array( + 'Content-Md5' => 'f123' + ), + array( + 'HTTP_CONTENT_MD5' => 'f123' + ) + ), + array( + 'Authorization (normal)', + array( + 'Authorization' => 'testing' + ), + array( + 'HTTP_AUTHORIZATION' => 'testing', + ) + ), + array( + 'Authorization (redirect)', + array( + 'Authorization' => 'testing redirect' + ), + array( + 'REDIRECT_HTTP_AUTHORIZATION' => 'testing redirect', + ) + ), + array( + 'Authorization (PHP_AUTH_USER + PHP_AUTH_PW)', + array( + 'Authorization' => 'Basic ' . base64_encode('foo:bar') + ), + array( + 'PHP_AUTH_USER' => 'foo', + 'PHP_AUTH_PW' => 'bar' + ) + ), + array( + 'Authorization (PHP_AUTH_DIGEST)', + array( + 'Authorization' => 'example-digest' + ), + array( + 'PHP_AUTH_DIGEST' => 'example-digest' + ) + ) + ); + } +} |