Check if ALL request headers are allowed

@param array $headers
@return bool
435031
protected function isHeadersAllowed(array $headers)
    {
        /**
         * Webkit browsers are known to include simple headers in access-control-request-headers.
         * We need to remove these so they aren't considered in the check for allowed headers.
         * @see http://stackoverflow.com/questions/17330302/why-non-custom-headers-in-access-control-request-headers
         */
        // Strip out any requests for simple headers
        $headers = array_udiff(
            $headers,
            $this->simpleHeaders,
            'strcasecmp'
        );

        // Check for any access-control-request-headers not in allowed headers, using case-insensitive comparison
        return array_udiff(
            $headers,
            $this->config['allowHeaders'],
            'strcasecmp'
        ) === [];
    }
1250011
public function isHostAllowed($allowedHosts)
    {
        $currentHost = $this->request->hostName;
        
        $rules = (array) $allowedHosts;
        
        foreach ($rules as $allowedHost) {
            if (StringHelper::matchWildcard($allowedHost, $currentHost)) {
                return true;
            }
        }
        
        return false;
    }
1229294
protected function mapHeaderKeys(array $headers)
    {
        $phpHeaders = array();
        foreach ($headers as $key => $value) {
            $phpHeaders['HTTP_' . str_replace('-', '_', strtoupper($key))] = $value;
        }

        return $phpHeaders;
    }
1334356
public function setHeaders(array $headers = []): Headers
    {
        $this->headers = array();

        foreach ($headers as $header => $data) {
            $this->setHeader((string)$header, (string)$data);
        }

        return $this;
    }
193774
public function withHeaders( array $headers )
	{
		foreach ( $headers as $key => $value )
		{
			$this->headers->set( $key, $value );
		}

		return $this;
	}
1121484
protected function addHeaders(array $headers)
    {
        foreach ($headers as $key => $val) {
            $normalized = strtolower($key);
            $this->headers[$key] = (array)$val;
            $this->headerNames[$normalized] = $key;
        }
    }
651048
public function setHeaders($headers)
    {
        foreach ($headers as $key => $value) {
            $this->headers[$key] = $value;
        }

        $headers = array();
        foreach ($this->headers as $key => $value) {
            $headers[] = $key . ': ' . $value;
        }
        $this->setOpt(CURLOPT_HTTPHEADER, $headers);
    }
629075
public function filterHeaders(&$headers) {
    $unset = array();
    foreach ($headers as $name => $value) {
      $lower = strtolower($name);
      if (isset($this->reservedHeaders[$lower])) {
        $unset[] = $name;
      }
    }
    foreach ($unset as $u) {
      unset($headers[$u]);
    }

    return $this;
  }
401156
public function setHeaders($headers)
    {
        $this->requireOpenConnection();

        $response = $this->curl(
            'POST',
            '/proxy/' . $this->port . '/headers',
            (object)$headers
        );
    }
353982
public function header(array $headers) {

        $formattedHeaders = [];

        $combinedHeaders = array_change_key_case(array_merge($this->header, $headers));

        foreach ($combinedHeaders as $key => $val)

            $formattedHeaders[] = trim(strtolower($key)) . ':' . $val;

        $this->header = $formattedHeaders;

        return $this;

    }
765792
private function convertHeaders(array $headers)
    {
        $result = [];
        foreach ($headers as $key => $value) {
            $result[] = $key . ': ' . $value;
        }

        return $result;
    }
546629
public function setHeaders(array $headers)
    {
        foreach ($this->headers as $name => $value) {
            $this->addHeader($name, $value);
        }
        return $this;
    }
973700
public function getHttpResponse(array $headers = [])
    {
        $client = new Client();
        $urls = $this->getUrl();

        return $client->request('GET', $urls[0], ['stream' => true, 'headers' => $headers]);
    }
739910
protected function fixHeaders(array $headers)
    {
        $fixedHeaders = array();

        foreach ($headers as $key => $value) {
            if (is_int($key)) {
                $fixedHeaders[] = $value;
            } else {
                $fixedHeaders[] = sprintf('%s:%s', $key, $value);
            }
        }

        return $fixedHeaders;
    }
747750
protected function setHeaders(array $headers = array()) {
        if(count($headers) === 0) {
            return;
        }
        $this->headers = array_merge($this->headers, $headers);

        $curl_headers = [];

        $curl_version = curl_version();

        foreach ($this->headers as $key => $value) {
            $curl_headers[] = $key.': '.$value;
        }

        // add some helpful information about environment
        $server_info = array(
            'curl_version' => (isset($curl_version['version']) ? $curl_version['version'] : null),
            'php_version' => phpversion(),
            'php_sapi' => php_sapi_name()
        );
        $curl_headers[] = 'X-Server-Lang: PHP';
        $curl_headers[] = 'X-Server-Lang-Info: ' . base64_encode(json_encode($server_info));
        $curl_headers[] = 'X-Server-Software: '. (!empty($_SERVER['SERVER_SOFTWARE']) ? $_SERVER['SERVER_SOFTWARE'] : null);
        $curl_headers[] = 'X-Server-Protocol: '. (!empty($_SERVER['SERVER_PROTOCOL']) ? $_SERVER['SERVER_PROTOCOL'] : null);
        curl_setopt($this->request, CURLOPT_HTTPHEADER, $curl_headers);
    }
494563
protected function setHeaders(array $headers)
    {
        // Ensure this is an atomic operation, either all headers are set or none.
        $before = $this->headers;

        try {
            foreach ($headers as $name => $value) {
                $this->setHeader($name, $value);
            }
        } catch (\Throwable $e) {
            $this->headers = $before;

            throw $e;
        }
    }
545392
protected function findStatusInHeaders($headers)
    {
        if (!isset($headers[0]) || strpos($headers[0], 'HTTP/') !== 0) {
            throw new UnexpectedValueException('Invalid HTTP Headers, missing status line');
        }

        $parts = explode(' ', trim($headers[0]));

        return (int)trim($parts[1]);
    }