comparison vendor/symfony/http-foundation/ServerBag.php @ 17:129ea1e6d783

Update, including to Drupal core 8.6.10
author Chris Cannam
date Thu, 28 Feb 2019 13:21:36 +0000
parents 1fec387a4317
children
comparison
equal deleted inserted replaced
16:c2387f117808 17:129ea1e6d783
25 * 25 *
26 * @return array 26 * @return array
27 */ 27 */
28 public function getHeaders() 28 public function getHeaders()
29 { 29 {
30 $headers = array(); 30 $headers = [];
31 $contentHeaders = array('CONTENT_LENGTH' => true, 'CONTENT_MD5' => true, 'CONTENT_TYPE' => true); 31 $contentHeaders = ['CONTENT_LENGTH' => true, 'CONTENT_MD5' => true, 'CONTENT_TYPE' => true];
32 foreach ($this->parameters as $key => $value) { 32 foreach ($this->parameters as $key => $value) {
33 if (0 === strpos($key, 'HTTP_')) { 33 if (0 === strpos($key, 'HTTP_')) {
34 $headers[substr($key, 5)] = $value; 34 $headers[substr($key, 5)] = $value;
35 } 35 }
36 // CONTENT_* are not prefixed with HTTP_ 36 // CONTENT_* are not prefixed with HTTP_
66 66
67 if (null !== $authorizationHeader) { 67 if (null !== $authorizationHeader) {
68 if (0 === stripos($authorizationHeader, 'basic ')) { 68 if (0 === stripos($authorizationHeader, 'basic ')) {
69 // Decode AUTHORIZATION header into PHP_AUTH_USER and PHP_AUTH_PW when authorization header is basic 69 // Decode AUTHORIZATION header into PHP_AUTH_USER and PHP_AUTH_PW when authorization header is basic
70 $exploded = explode(':', base64_decode(substr($authorizationHeader, 6)), 2); 70 $exploded = explode(':', base64_decode(substr($authorizationHeader, 6)), 2);
71 if (2 == count($exploded)) { 71 if (2 == \count($exploded)) {
72 list($headers['PHP_AUTH_USER'], $headers['PHP_AUTH_PW']) = $exploded; 72 list($headers['PHP_AUTH_USER'], $headers['PHP_AUTH_PW']) = $exploded;
73 } 73 }
74 } elseif (empty($this->parameters['PHP_AUTH_DIGEST']) && (0 === stripos($authorizationHeader, 'digest '))) { 74 } elseif (empty($this->parameters['PHP_AUTH_DIGEST']) && (0 === stripos($authorizationHeader, 'digest '))) {
75 // In some circumstances PHP_AUTH_DIGEST needs to be set 75 // In some circumstances PHP_AUTH_DIGEST needs to be set
76 $headers['PHP_AUTH_DIGEST'] = $authorizationHeader; 76 $headers['PHP_AUTH_DIGEST'] = $authorizationHeader;