X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=app%2FSession.php;h=f2a5dbd58ac52de334d1f1eb3f95b921cc93244c;hb=36cfa28cf2dcee3422f0231f91c6692eb28e7824;hp=87189dc0bacda2584fe589573467cf19c4ce042d;hpb=ebc0d017c8a24bd16ca1f4347b39b07ba4349135;p=pharext%2Fpharext.org diff --git a/app/Session.php b/app/Session.php index 87189dc..f2a5dbd 100644 --- a/app/Session.php +++ b/app/Session.php @@ -3,14 +3,25 @@ namespace app; use ArrayAccess; -use merry\Config; +use http\Env\Response; +use http\Params; class Session implements ArrayAccess { - function __construct(Config $config) { + function __construct(Config $config, Response $response) { foreach ($config->session as $key => $val) { ini_set("session.$key", $val); } + if (ini_get("session.use_cookies")) { + $response->addHeader("Vary", "cookie"); + } + $response->addHeader("Cache-Control", + new Params([ + "private" => true, + "must-revalidate" => true, + "max-age" => ini_get("session.cache_expire") * 60 + ]) + ); session_start(); }