From: Tim Düsterhus Date: Fri, 1 Feb 2013 11:10:53 +0000 (+0100) Subject: Add max-age header for cookies X-Git-Tag: 2.0.0_Beta_1~518^2 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=5595ebaa54c9be95b527981ea68ce7681692ebf2;p=GitHub%2FWoltLab%2FWCF.git Add max-age header for cookies Closes #1083 --- diff --git a/wcfsetup/install/files/lib/util/HeaderUtil.class.php b/wcfsetup/install/files/lib/util/HeaderUtil.class.php index c7be01a4d1..9fca57c3a4 100644 --- a/wcfsetup/install/files/lib/util/HeaderUtil.class.php +++ b/wcfsetup/install/files/lib/util/HeaderUtil.class.php @@ -21,7 +21,8 @@ final class HeaderUtil { public static function setCookie($name, $value = '', $expire = 0) { $application = ApplicationHandler::getInstance()->getActiveApplication(); $addDomain = (StringUtil::indexOf($application->cookieDomain, '.') === false || StringUtil::endsWith($application->cookieDomain, '.lan') || StringUtil::endsWith($application->cookieDomain, '.local')) ? false : true; - @header('Set-Cookie: '.rawurlencode(COOKIE_PREFIX.$name).'='.rawurlencode($value).($expire ? '; expires='.gmdate('D, d-M-Y H:i:s', $expire).' GMT' : '').'; path='.$application->cookiePath.($addDomain ? '; domain='.$application->cookieDomain : '').(RouteHandler::secureConnection() ? '; secure' : '').'; HttpOnly', false); + + @header('Set-Cookie: '.rawurlencode(COOKIE_PREFIX.$name).'='.rawurlencode($value).($expire ? '; expires='.gmdate('D, d-M-Y H:i:s', $expire).' GMT; max-age='.($expire - TIME_NOW) : '').'; path='.$application->cookiePath.($addDomain ? '; domain='.$application->cookieDomain : '').(RouteHandler::secureConnection() ? '; secure' : '').'; HttpOnly', false); } /**