Builds the cookie-header-part for the header to send.

@return string  The cookie-header-part, i.e. "Cookie: test=bla; palimm=palaber"
Returns NULL if no cookies should be send with the header.
423295
protected function buildCookieHeader()
  {
    $cookie_string = "";
    
    @reset($this->cookie_array);
    while(list($key, $value) = @each($this->cookie_array))
    {
      $cookie_string .= "; ".$key."=".$value."";
    }
    
    if ($cookie_string != "")
    {
      return "Cookie: ".substr($cookie_string, 2)."\r\n";
    }
    else
    {
      return null;
    }
  }
725130
protected function searchCookiesInHeaders() {
        $headers = $this->holder->getHeaders()->get('set-cookie');

        foreach ($headers as $header) {
            $cookie = $this->createCookieFromHeader($header);

            if ($cookie !== null) {
                $this->storeCookie($cookie);
            }
        }
    }
718619
private function buildCompleteHeader(): string
    {
        $header = "";
        foreach ($this->headers as $sourceType => $value) {
            $header .= $this->buildHeaderLine($sourceType, $value);
        }
        if (!empty($this->reportUri)) {
            $header .= 'report-uri ' . $this->reportUri . ';';
        }
        return $header;
    }
1145041
protected function getCookie()
    {
        if (isset($_COOKIE[$this->options['name']])) {
            $value = $_COOKIE[$this->options['name']];

            if ($value) {
                return json_decode($value);
            }
        }
    }
1265367
private function buildName(): string
    {
        $name = null;
        foreach ($this->parts as $part) {
            $name .= $part;
        }

        return rtrim((string) $name, '\\');
    }
1271161
public function getMsgAlternativeBody()
    {
        if (
            !empty($this->_parts)
            && (
                $this->getHeaders()->getMessageContentType() == Content::CT_MULTIPART_ALTERNATIVE
                || $this->getHeaders()->getMessageContentType() == Content::CT_MULTIPART_MIXED
            )
        ) {
            foreach ($this->_parts as $part) {
                if ($part->contentType == Content::CT_TEXT_PLAIN) {
                    return $part->getContentDecode();
                }
            }
        }

        return null;
    }
907561
public static function getBearerToken()
    {
        $headers = Request::getAuthorizationHeader();
        if (!empty($headers)) {
            if (preg_match('/Bearer\s(\S+)/', $headers, $matches)) {
                return $matches[1];
            }
        }
        return null;
    }
995653
private function buildHeaderResponse()
    {
        foreach (explode(
            "\n",
            substr($this->output, 0, $this->info['header_size'])
        ) as $val) {
            $val = trim($val);
            if (! empty($val)) {
                $this->headerResponse[] = $val;
            }
        }
        $this->output = substr($this->output, $this->info['header_size']);
    }
840455
public function toString(): string
    {
        // first line
        $output = $this->buildFirstLine() . self::EOL;

        // add headers
        $output .= $this->headers->toHeaderLines(true);

        // set cookies
        foreach ($this->cookies->toHeaders() as $value) {
            $output .= "Set-Cookie: $value" . self::EOL;
        }

        $output .= self::EOL;

        return $output . $this->getBody();
    }
222331
public function getHeaders()
    {
        if ($this->_headers === null) {
            if (!$this->_mail) {
                $this->_headers = array();
            } else {
                $part = $this->_mail->getRawHeader($this->_messageNum);
                Zend_Mime_Decode::splitMessage($part, $this->_headers, $null);
            }
        }

        return $this->_headers;
    }
1084183
protected function buildHeader()
    {
        $header                                     = new Buffer(self::RTP_HEADER_BYTE_LENGTH);
        $header[self::RTP_VERSION_PAD_EXTEND_INDEX] = pack('c', self::RTP_VERSION_PAD_EXTEND);
        $header[self::RTP_PAYLOAD_INDEX]            = pack('c', self::RTP_PAYLOAD_TYPE);
        $header->writeShort($this->seq, self::SEQ_INDEX);
        $header->writeInt($this->timestamp, self::TIMESTAMP_INDEX);
        $header->writeInt($this->ssrc, self::SSRC_INDEX);

        return $header;
    }
1196343
public function getCookieParams()
    {
        $cookies = [];
        foreach ($this->headers->getCookies() as $cookie) {
            $cookies[$cookie->getName()] = $cookie->getValue();
        };
        return $cookies;
    }
186391
protected function buildVariableHeader()
    {
        $header = '';

        $topic = $this->message->getTopic();
        # Topic
        $header .= Utility::PackStringWithLength($topic);
        Debug::Log(Debug::DEBUG, 'Message PUBLISH: topic='.$topic);

        Debug::Log(Debug::DEBUG, 'Message PUBLISH: QoS='.$this->getQos());
        Debug::Log(Debug::DEBUG, 'Message PUBLISH: DUP='.$this->getDup());
        Debug::Log(Debug::DEBUG, 'Message PUBLISH: RETAIN='.$this->getRetain());

        # Message ID if QoS > 0
        if ($this->getQos()) {
            if (!$this->msgid) {
                throw new Exception('MsgID MUST be set if QoS is not 0.');
            }

            $header .= $this->packPacketIdentifer();
        }

        return $header;
    }
435096
public function sendHeader()
    {
        $file = $line = null;
        if ($this->isHeaderSent($file, $line)) {
            if ($this->wei->has('logger')) {
                $this->logger->debug(sprintf('Header has been at %s:%s', $file, $line));
            }
            return false;
        }

        // Send status
        $this->sendRawHeader(sprintf('HTTP/%s %d %s', $this->version, $this->statusCode, $this->statusText));

        // Send headers
        foreach ($this->headers as $name => $values) {
            foreach ($values as $value) {
                $this->sendRawHeader($name . ': ' . $value);
            }
        }

        $this->sendCookie();

        return true;
    }
486924
protected function parseCookies ()
    {
        $cookie = '';

        foreach( $this->cookies as $name => $value )
            $cookie .= $name . '=' . $value . '; ';

        return rtrim( $cookie, ';' );
    }
95891
public function getBearerToken() {

	    $headers = null;
	    $token   = null;

	    if (isset($_SERVER['Authorization'])) {
	        $headers = \trim($_SERVER['Authorization']);
	    } elseif (isset($_SERVER['HTTP_AUTHORIZATION'])) { //Nginx or fast CGI
	        $headers = \trim($_SERVER['HTTP_AUTHORIZATION']);
	    } elseif (\function_exists('apache_request_headers')) {
	        $requestHeaders = \apache_request_headers();
	        // Server-side fix for bug in old Android versions (a nice side-effect of this fix means we don't care about capitalization for Authorization)
	        $requestHeaders = \array_combine(\array_map('ucwords', \array_keys($requestHeaders)), \array_values($requestHeaders));
	        if (isset($requestHeaders['Authorization'])) {
	            $headers = \trim($requestHeaders['Authorization']);
	        }
	    }

	    // HEADER: Get the access token from the header
	    if ($headers) {
	        if (\preg_match('/Bearer\s(\S+)/', $headers, $matches)) {
	            $token = $matches[1];
	        }
	    }

	    return $token;
	}
392708
public function getHeader()
    {
        if ($this->headerContents) {
            return $this->headerContents;
        }

        if (!$this->headerLen) {
            $this->determineHeaderLength();
        }

        fseek($this->fp, $this->headerStart, SEEK_SET);

        $read = 0;
        $bindata = '';
        while ($read < $this->headerLen && ($buff = fread($this->fp, $this->headerLen - $read))) {
            $read += strlen($buff);
            $bindata .= $buff;
        }
        unset($buff);

        $this->headerContents = gzinflate($bindata, $this->options['memoryLimit']);
        unset($bindata);

        if (!strlen($this->headerContents)) {
            throw new RecAnalystException(
                'Cannot decompress header section',
                RecAnalystException::HEADER_DECOMPRESSERROR
            );
        }

        return $this->headerContents;
    }