Process HTTP headers
@return boolean Success
13440
protected function httpProcessHeaders()
    {
        $this->req->attrs->paramsDone = true;
        if (isset($this->req->attrs->server['HTTP_CONNECTION'])
            && preg_match('~(?:^|\W)Upgrade(?:\W|$)~i', $this->req->attrs->server['HTTP_CONNECTION'])
            && isset($this->req->attrs->server['HTTP_UPGRADE'])
            && (strtolower($this->req->attrs->server['HTTP_UPGRADE']) === 'websocket')
        ) {
            if ($this->pool->WS) {
                $this->pool->WS->inheritFromRequest($this->req, $this);
            }
            return false;
        }

        $this->req = Daemon::$appResolver->getRequest(
            $this->req,
            $this,
            isset($this->pool->config->responder->value) ? $this->pool->config->responder->value : null
        );

        if ($this->req instanceof \stdClass) {
            $this->endRequest($this->req, 0, 0);
            return false;
        } else {
            if ($this->pool->config->sendfile->value
                && (!$this->pool->config->sendfileonlybycommand->value || isset($this->req->attrs->server['USE_SENDFILE']))
                && !isset($this->req->attrs->server['DONT_USE_SENDFILE'])
            ) {
                $req = $this->req;

                FileSystem::tempnam(
                    $this->pool->config->sendfiledir->value,
                    $this->pool->config->sendfileprefix->value,
                    function ($fn) use ($req) {
                        FileSystem::open($fn, 'wb', function ($file) use ($req) {
                            $req->sendfp = $file;
                        });
                        $req->header('X-Sendfile: ' . $fn);
                    }
                );
            }
            $this->req->callInit();
        }
        return true;
    }
345048
protected function detectHeaders()
	{
		if (\function_exists('getallheaders'))
		{
			// If php is working under Apache, there is a special function
			$this->headers = getallheaders();
		}
		else
		{
			// Else we fill headers from $_SERVER variable
			$this->headers = array();

			foreach ($_SERVER as $name => $value)
			{
				if (substr($name, 0, 5) == 'HTTP_')
				{
					$this->headers[str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($name, 5)))))] = $value;
				}
			}
		}

		// Mark this detection routine as run.
		$this->detection['headers'] = true;
	}
1155316
public function processRequest()
    {
        $requestMethods = ["OPEN", $_SERVER["REQUEST_METHOD"], "CLOSE"];

        foreach ($requestMethods as $requestMethod) {
            if (!array_key_exists($requestMethod, $this->_listeners)) {
                continue;
            }

            $listeners = $this->_listeners[$requestMethod];
            foreach ($listeners as $listener) {
                call_user_func($listener);
            }
        }
    }
39545
private function parseHeadersFormat()
    {
        $headers = array();
        foreach($this->request->getHeaders() as $name => $value)
        {
            $headers[] = $name . ':' . implode(',', $value);
        }
        return $headers;
    }
273477
public function sendHeaders()
	{
		if (!$this->checkHeadersSent())
		{
			foreach ($this->response->headers as $header)
			{
				if ('status' == strtolower($header['name']))
				{
					// 'status' headers indicate an HTTP status, and need to be handled slightly differently
					$this->header(ucfirst(strtolower($header['name'])) . ': ' . $header['value'], null, (int) $header['value']);
				}
				else
				{
					$this->header($header['name'] . ': ' . $header['value']);
				}
			}
		}

		return $this;
	}
473677
public function send_headers()
	{
		if ( ! headers_sent())
		{
			// Send the protocol/status line first, FCGI servers need different status header
			if ( ! empty($_SERVER['FCGI_SERVER_VERSION']))
			{
				header('Status: '.$this->status.' '.static::$statuses[$this->status]);
			}
			else
			{
				$protocol = \Input::server('SERVER_PROTOCOL') ? \Input::server('SERVER_PROTOCOL') : 'HTTP/1.1';
				header($protocol.' '.$this->status.' '.static::$statuses[$this->status]);
			}

			foreach ($this->headers as $name => $value)
			{
				// Parse non-replace headers
				if (is_int($name) and is_array($value))
				{
					 isset($value[0]) and $name = $value[0];
					 isset($value[1]) and $value = $value[1];
				}

				// Create the header
				is_string($name) and $value = "{$name}: {$value}";

				// Send it
				header($value, true);
			}
			return true;
		}
		return false;
	}
144300
public function execute()
    {
        $this->setOption(CURLINFO_HEADER_OUT, true); // track outgoing headers too
        $headers = ["Content-type: application/json", "Accept: application/json", "Authentication: {$this->authentication}", "Timestamp: {$this->timestamp}"];
        $this->setOption(CURLOPT_HTTPHEADER, $headers);
        return curl_exec($this->handle);
    }
729193
private function processHead() {
        if ($this->existsInMetaData($this->uuid, 'ID') === false) {
            $this->getResponse()->setStatusCode(PhpResponse::STATUS_CODE_404);
            return;
        }

        // if file in storage does not exists
        if (!file_exists($this->directory . $this->getFilename())) {
            // allow new upload
            $this->removeFromMetaData($this->uuid);
            $this->getResponse()->setStatusCode(PhpResponse::STATUS_CODE_404);
            return;
        }

        $this->getResponse()->setStatusCode(PhpResponse::STATUS_CODE_200);

        $offset = $this->getMetaDataValue($this->uuid, 'Offset');
        $headers = $this->getResponse()->getHeaders();
        $headers->addHeaderLine('Upload-Offset', $offset);

        $length = $this->getMetaDataValue($this->uuid, 'Size');
        $headers->addHeaderLine('Upload-Length', $length);

        $headers->addHeaderLine('Cache-Control', 'no-store');
    }
777757
public function process()
    {
        // Check if we should verify the request
        if ($this->configuration->getUseAuthorization()) {
            if (
                $this->uri != '/token' &&
                $this->uri != '/authorize' &&
                !$this->tokenServer->verifyResourceRequest(\OAuth2\Request::createFromGlobals())
            ) {
                // Get the data as json and convert it to an array,
                // - so we can set our own response type.
                $data = $this->tokenServer->getResponse()->getResponseBody('json');
                $data = json_decode($data, true);

                // Set the response, status code and output content setting final output to true
                $this->response = $data;
                $this->statusCode = $this->tokenServer->getResponse()->getStatusCode();
                $this->output(true);
                return $this;
            }
        }

        try {
            // Handle OPTIONS requests
            if ($this->method == 'options') {
                $this->handleOptionsRequest();
            } else {
                // Execute the router
                $this->router->execute();
            }
        } catch (\Exception $e) {
            // Set the response and status code to error
            $this->response = ['error' => 1, 'message' => $e->getMessage()];
            $this->statusCode = 500;
        }

        // Output the response
        $this->output();
    }
1061528
public function sendHeaders()
     {
         if (! headers_sent()) {
             $response = $this->getResponse();
             foreach ($response->getHeaders() as $name => $value) {
                 header($name.': '.$value, false);
             }
             header('HTTP/1.1'.' '.$response->getStatusCode().' '.$response->getStatusMessage());
         }

         return $this;
     }
903463
public function processRequest()
    {
        foreach($this->xPluginManager->getRequestPlugins() as $xPlugin)
        {
            if($xPlugin->getName() != Jaxon::FILE_UPLOAD && $xPlugin->canProcessRequest())
            {
                $xUploadPlugin = $this->xPluginManager->getRequestPlugin(Jaxon::FILE_UPLOAD);
                // Process uploaded files
                if($xUploadPlugin != null)
                {
                    $xUploadPlugin->processRequest();
                }
                // Process the request
                return $xPlugin->processRequest();
            }
        }
        // Todo: throw an exception
        return false;
    }
935525
protected function receiveHeader()
    {
        if(strlen($this->bufferData) > 8)
        {
            $header = substr($this->bufferData,0,8);
            $this->waitingFor = intval($header);
            $this->bufferData = substr($this->bufferData,8);
            $this->headerReceived = true;
            return strlen($this->bufferData) > 0;
        }
        return false;
    }
693322
public function process() {
		if (0 === count($this->plugins)) {
			// load plugins which are configured in Settings.yml
			$settings = $this->loadSettings();
			$packages = array_keys($settings);
			$this->loadPlugins($packages);
		}
		$this->executePlugins($this->plugins);
		return $this->response;
	}
1356702
public function process(){
		$this->log->add('Request Received from: '.server('REMOTE_ADDR'));
		$encoding = $this->decode($this->request);
		if($encoding != self::ENC_RAW)
			$this->log->add('Parsed Request: '.print_r($this->request,true));
		return $this;
	}
1335448
public function processResponse()
    {
        // Holds the results
        $results = [];

        // Iterate over the packets
        foreach ($this->packets_response as $response) {
            // Make a buffer
            $buffer = new Buffer($response);

            // Grab the header
            $header = $buffer->readString();

            // Figure out which packet response this is
            if (!array_key_exists($header, $this->responses)) {
                throw new Exception(__METHOD__ . " response type '" . bin2hex($header) . "' is not valid");
            }

            // Now we need to call the proper method
            $results = array_merge(
                $results,
                call_user_func_array([$this, $this->responses[$header]], [$buffer])
            );
        }

        unset($buffer);

        return $results;
    }
1025194
public function process() /*: mixed*/
    {
        if(!isset($this->settings["directives"]))
            return $this->value;
        $directives = $this->settings["directives"];
        $isDirectiveEnabled = function(string $param) use($directives): bool
        {
            return (isset($directives[$param]) && $directives[$param]);
        };

        if($isDirectiveEnabled("index")) {
            $this->with_index = true;
        }

        if($isDirectiveEnabled("unique")) {
            $this->is_unique = true;
        }

        if($isDirectiveEnabled("sha1")) {
            return sha1($this->value);   
        }
        elseif($isDirectiveEnabled("md5")) {
            return md5($this->value);
        }

        return $this->value;
    }
1241922
public static function sendHeaders()
    {
        if (! headers_sent()) {
            foreach (self::$headers as $header) {
                header($header, true);
            }

            return true;
        }

        return false;
    }