Corrects indentation and line length

This commit is contained in:
Simon Welsh 2013-01-24 19:56:02 +13:00
parent 1f1b115ef9
commit 3439e30ac1
5 changed files with 17 additions and 14 deletions

View File

@ -282,7 +282,7 @@ class HTTP {
$responseHeaders["Cache-Control"] = "max-age=" . self::$cache_age . ", must-revalidate, no-transform"; $responseHeaders["Cache-Control"] = "max-age=" . self::$cache_age . ", must-revalidate, no-transform";
$responseHeaders["Pragma"] = ""; $responseHeaders["Pragma"] = "";
// To do: User-Agent should only be added in situations where you *are* actually varying according to user-agent. // To do: User-Agent should only be added in situations where you *are* actually varying according to it.
$responseHeaders['Vary'] = 'Cookie, X-Forwarded-Protocol, User-Agent, Accept'; $responseHeaders['Vary'] = 'Cookie, X-Forwarded-Protocol, User-Agent, Accept';
} else { } else {
@ -293,11 +293,12 @@ class HTTP {
$responseHeaders["Last-Modified"] = self::gmt_date(self::$modification_date); $responseHeaders["Last-Modified"] = self::gmt_date(self::$modification_date);
/* Chrome ignores Varies when redirecting back (http://code.google.com/p/chromium/issues/detail?id=79758) /* Chrome ignores Varies when redirecting back (http://code.google.com/p/chromium/issues/detail?id=79758)
which means that if you log out, you get redirected back to a page which Chrome then checks against last-modified (which passes, getting a 304) which means that if you log out, you get redirected back to a page which Chrome then checks against
when it shouldn't be trying to use that page at all because it's the "logged in" version. last-modified (which passes, getting a 304) when it shouldn't be trying to use that page at all because
it's the "logged in" version.
By also using and etag that includes both the modification date and all the varies values which we also check against we can catch By also using and etag that includes both the modification date and all the varies values which we also
this and not return a 304 check against we can catch this and not return a 304
*/ */
$etagParts = array(self::$modification_date, serialize($_COOKIE)); $etagParts = array(self::$modification_date, serialize($_COOKIE));
if (isset($_SERVER['HTTP_X_FORWARDED_PROTOCOL'])) $etagParts[] = $_SERVER['HTTP_X_FORWARDED_PROTOCOL']; if (isset($_SERVER['HTTP_X_FORWARDED_PROTOCOL'])) $etagParts[] = $_SERVER['HTTP_X_FORWARDED_PROTOCOL'];

View File

@ -655,7 +655,9 @@ class Form extends RequestHandler {
$needsCacheDisabled = false; $needsCacheDisabled = false;
if ($this->getSecurityToken()->isEnabled()) $needsCacheDisabled = true; if ($this->getSecurityToken()->isEnabled()) $needsCacheDisabled = true;
if ($this->FormMethod() != 'get') $needsCacheDisabled = true; if ($this->FormMethod() != 'get') $needsCacheDisabled = true;
if (!($this->validator instanceof RequiredFields) || count($this->validator->getRequired())) $needsCacheDisabled = true; if (!($this->validator instanceof RequiredFields) || count($this->validator->getRequired())) {
$needsCacheDisabled = true;
}
// If we need to disable cache, do it // If we need to disable cache, do it
if ($needsCacheDisabled) HTTP::set_cache_age(0); if ($needsCacheDisabled) HTTP::set_cache_age(0);