Improve cookie security; Secure flag

SSL 항상 사용 옵션인 경우 쿠키도 이에 맞추어 SSL 인 경우에만 사용되도록 `secure` flag 를 추가합니다.
선택적 SSL 인 경우 SSL 이 적용되지 않은 구간에서도 쿠키를 읽을 수 있어야 하므로, 적용하지 않습니다.
This commit is contained in:
Min-Soo Kim 2018-04-24 19:30:38 +09:00
parent 5ebbbf5b36
commit c1c9a94623
7 changed files with 26 additions and 9 deletions

View file

@ -73,7 +73,7 @@ class Mobile
$uatype = $uahash . ':' . (self::$_ismobile ? '1' : '0');
if ($cookie !== $uatype)
{
setcookie('rx_uatype', $uatype, 0);
setcookie('rx_uatype', $uatype, 0, null, null, Context::checkSslEnforce());
$_COOKIE['rx_uatype'] = $uatype;
}