public function getCurrentSession(\blaze\netlet\http\HttpNetletRequest $request, $create = false) { if ($this->session == null) { $sessionId = null; foreach ($request->getCookies() as $cookie) { if ($cookie->getName()->compareTo(self::SESSION_NAME) == 0) { $sessionId = $cookie->getValue(); break; } } if ($sessionId != null) { $this->readSession($sessionId); } if ($this->session == null && $create) { session_name(self::SESSION_NAME); session_id(hash('sha512', md5(uniqid()) . sha1(uniqid()))); ini_set('session.use_cookies', '0'); session_start(); $this->session = new HttpSessionImpl($this, session_id(), $_SESSION); } } return $this->session; }
public function getCookies() { return $this->request->getCookies(); }