Sends the cookie to the HTTP client Stores the cookie definition in session

@return Cookie
11064
public function send()
    {
        if ($this->useEncryption && !empty($this->value)) {
            $value = $this->encrypt($this->value);
        } else {
            $value = $this->value;
        }

        setcookie($this->name, $value, $this->expire, $this->path, $this->domain, $this->secure, $this->httpOnly);

        return $this;
    }
1093091
private function curl()
    {
        if (!($this->curl instanceof cURL)) {
            $this->curl = new cURL();
        }

        if ($this->hasAuth()) {
            $this->curl->setCredentials($this->user, $this->pass);
        }

        if ($this->cookie && is_writeable(dirname($this->cookie))) {
            $this->curl->setCookieStorage($this->cookie);
        }

        return $this->curl->setTimeout($this->timeout);
    }
1215490
private function create(): CookieAuthSession
    {
        $response = $this->request($this->endpoint . $this->path, [
            RequestOptions::JSON => [
                'username' => $this->username,
                'password' => $this->password,
            ],
        ]);

        $body = $response->getBody();
        $body->seek(0);
        $contents = $body->getContents();

        $contents = json_decode($contents, true);

        if (isset($contents['session']['name'], $contents['session']['value'])) {
            return new CookieAuthSession($contents['session']['name'], $contents['session']['value']);
        }

        throw new \Exception('Failed to create ' . CookieAuthSession::class . '.');
    }
855686
protected function getRequestCookies()
    {
        $pairs = array();

        foreach ($this->cookies as $k => $v) {
            $pairs[] = "$k=$v";
        }

        return join($pairs, ';');
    }
712181
public static function init()
    {
        self::add(self::HEADER_SET_COOKIE, '__Host-sess=' . session_id() . '; path=' . Request::$subfolders . '; Secure; HttpOnly; SameSite;');
        if (Request::isSecure()) {
            self::add(self::HEADER_CONTENT_SECURITY_POLICY, self::HEADER_CONTENT_SECURITY_POLICY_CONTENT_SECURE);
            self::add(self::HEADER_STRICT_TRANSPORT_SECURITY, self::HEADER_STRICT_TRANSPORT_SECURITY_CONTENT);
            self::add(self::HEADER_X_CONTENT_SECURITY_POLICY, self::HEADER_CONTENT_SECURITY_POLICY_CONTENT_SECURE);
        } elseif (Request::isLocalhost()) {
            self::add(self::HEADER_CONTENT_SECURITY_POLICY, self::HEADER_CONTENT_SECURITY_POLICY_CONTENT_LOCALHOST);
            self::add(self::HEADER_X_CONTENT_SECURITY_POLICY, self::HEADER_CONTENT_SECURITY_POLICY_CONTENT_LOCALHOST);
        } else {
            self::add(self::HEADER_CONTENT_SECURITY_POLICY, self::HEADER_CONTENT_SECURITY_POLICY_CONTENT_INSECURE);
            self::add(self::HEADER_X_CONTENT_SECURITY_POLICY, self::HEADER_CONTENT_SECURITY_POLICY_CONTENT_INSECURE);
        }
        self::$initialized = true;
    }
992245
protected function sendCookies()
    {
        $cookies = $this->getCookies();

        foreach ($cookies as $name => $cookie) {
            setcookie($name, $cookie['value'], (int)$cookie['expire'],
                $cookie['path']);
        }

        return $this;
    }
1057418
public static function instance()
    {
        if (null === self::$_instance) {
            $session_factory = new SessionFactory;
            $session = $session_factory->newInstance($_COOKIE);
            $segment = $session->getSegment('Barebone\Session');

            self::$_instance = $segment;
        }
        return self::$_instance;
    }
414625
public function send()
    {
        /* @var $cookie \Core\Http\Cookie\CookieInterface */
        foreach ($this->cookies as $cookie) {
            setcookie($cookie->getName(), $cookie->getValue(), $cookie->getExpire(), $cookie->getPath(), $cookie->getDomain(), $cookie->getSecure(), $cookie->getHttponly());
        }
    }
1229011
public function send()
    {
        $request = $this->createRequest();

        $response = $this->httpClient->sendRequest($request);

        return $this->mapResponse((array) $this->parseResponse($response));
    }
988795
public function sendHeaders() {

		// headers have already been sent by the developer

		if (headers_sent()) {
			return $this;
		}

		if (!$this->headers->has('Date')) {
			$this->setDate(\DateTime::createFromFormat('U', time()));
		}
		
		// headers

		foreach ($this->headers->allPreserveCase() as $name => $values) {
			foreach ($values as $value) {
				header($name . ': ' . $value, FALSE);
			}
		}

		// status

		header(sprintf('HTTP/%s %s %s', $this->version, $this->statusCode, $this->statusText), TRUE, $this->statusCode);

		// cookies
		foreach ($this->headers->getCookies() as $cookie) {
			setcookie($cookie->getName(), $cookie->getValue(), $cookie->getExpiresTime(), $cookie->getPath(), $cookie->getDomain(), $cookie->isSecure(), $cookie->isHttpOnly());
		}

		return $this;

	}
101365
private static function getFromSession()
    {
        if (empty($_SESSION['current_user'])) {
            // No user in session, create one.
            $entityClassName = static::ENTITIES_CLASS_NAME;
            $user = new $entityClassName(array(
                'source' => 'cookie',
            ));
            self::setCurrent($user);
        } else {
            Logger::get()->debug('Found user in session.');
            // Regenerate session ID every SESSION_DURATION minutes.
            if (time() > ($_SESSION['timestamp'] +  + self::SESSION_DURATION)) {
                Logger::get()->debug('Regenerated session ID.');
                session_regenerate_id();
            }
        }

        return $_SESSION['current_user'];
    }
928149
protected function cookies()
        {
            $ref = new \ReflectionClass('Symfony\Component\HttpFoundation\Cookie');

            // All of the cookies for the response are actually stored on the
            // Cookie class until we're ready to send the response back to
            // the browser. This allows our cookies to be set easily.
            foreach (Cookie::$jar as $name => $cookie) {
                $config = array_values($cookie);
                $this->headers()->setCookie($ref->newInstanceArgs($config));
            }
        }
404475
public function sendHeaders()
    {
        // headers have already been sent by the developer
        if (headers_sent()) {
            return $this;
        }

        // headers
        foreach ($this->headers->allPreserveCaseWithoutCookies() as $name => $values) {
            $replace = 0 === strcasecmp($name, 'Content-Type');
            foreach ($values as $value) {
                header($name.': '.$value, $replace, $this->statusCode);
            }
        }

        // cookies
        foreach ($this->headers->getCookies() as $cookie) {
            header('Set-Cookie: '.$cookie->getName().strstr($cookie, '='), false, $this->statusCode);
        }

        // status
        header(sprintf('HTTP/%s %s %s', $this->version, $this->statusCode, $this->statusText), true, $this->statusCode);

        return $this;
    }
88724
def set_cookie!
      cookies[:user_session] = {
        :value => self.temporary_token,
        :secure => controller.request.ssl?,
        :httponly => true,
        :expires => self.expires_at
      }
      Authie.config.events.dispatch(:session_cookie_updated, self)
      true
    end
109271
public function createSession()
    {
        $config = $this->app['config']['concrete.session'];
        $storage = $this->getSessionStorage($config);

        // We have to use "build" here because we have bound this classname to this factory method
        $session = $this->app->build(SymfonySession::class, [$storage]);
        $session->setName(array_get($config, 'name'));

        /* @TODO Remove this call. We should be able to set this against the request somewhere much higher than this */
        /*       At the very least we should have an observer that can track the session status and set this */
        $this->app->make(\Concrete\Core\Http\Request::class)->setSession($session);

        return $session;
    }
48033
public function getSession() {
    if (!$this->sessionLoaded) {
      $session = null;
      $write_cookie = true;

      // try loading session from signed_request in $_REQUEST
      $signedRequest = $this->getSignedRequest();
      if ($signedRequest) {
        // sig is good, use the signedRequest
        $session = $this->createSessionFromSignedRequest($signedRequest);
      }

      // try loading session from $_REQUEST
      if (!$session && isset($_REQUEST['session'])) {
        $session = json_decode(
          get_magic_quotes_gpc()
            ? stripslashes($_REQUEST['session'])
            : $_REQUEST['session'],
          true
        );
        $session = $this->validateSessionObject($session);
      }

      // try loading session from cookie if necessary
      if (!$session && $this->useCookieSupport()) {
        $cookieName = $this->getSessionCookieName();
        if (isset($_COOKIE[$cookieName])) {
          $session = array();
          parse_str(trim(
            get_magic_quotes_gpc()
              ? stripslashes($_COOKIE[$cookieName])
              : $_COOKIE[$cookieName],
            '"'
          ), $session);
          $session = $this->validateSessionObject($session);
          // write only if we need to delete a invalid session cookie
          $write_cookie = empty($session);
        }
      }

      $this->setSession($session, $write_cookie);
    }

    return $this->session;
  }
328934
public static function Session() {
      if (is_null(self::$_Session))
         self::$_Session = self::Factory(self::AliasSession);
      return self::$_Session;
   }