diff options
-rw-r--r-- | CHANGELOG.txt | 2 | ||||
-rw-r--r-- | includes/bootstrap.inc | 13 | ||||
-rw-r--r-- | modules/aggregator/aggregator.fetcher.inc | 2 | ||||
-rw-r--r-- | modules/aggregator/tests/aggregator_test.module | 2 | ||||
-rw-r--r-- | modules/simpletest/tests/bootstrap.test | 2 |
5 files changed, 16 insertions, 5 deletions
diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 6192f3989..ff0587160 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,6 +1,8 @@ Drupal 7.33, xxxx-xx-xx (development version) ----------------------- +- Changed the date format used in various HTTP headers output by Drupal core + from RFC 1123 format to RFC 7231 format. - Added a "block_cache_bypass_node_grants" variable to allow sites which have node access modules enabled to use the block cache if desired (API addition). - Made image derivative generation HTTP requests return a 404 error (rather diff --git a/includes/bootstrap.inc b/includes/bootstrap.inc index 862fede1c..6516db0ff 100644 --- a/includes/bootstrap.inc +++ b/includes/bootstrap.inc @@ -249,6 +249,15 @@ define('REGISTRY_WRITE_LOOKUP_CACHE', 2); define('DRUPAL_PHP_FUNCTION_PATTERN', '[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*'); /** + * A RFC7231 Compliant date. + * + * http://tools.ietf.org/html/rfc7231#section-7.1.1.1 + * + * Example: Sun, 06 Nov 1994 08:49:37 GMT + */ +define('DATE_RFC7231', 'D, d M Y H:i:s \G\M\T'); + +/** * Provides a caching wrapper to be used in place of large array structures. * * This class should be extended by systems that need to cache large amounts @@ -1266,7 +1275,7 @@ function drupal_page_header() { $default_headers = array( 'Expires' => 'Sun, 19 Nov 1978 05:00:00 GMT', - 'Last-Modified' => gmdate(DATE_RFC1123, REQUEST_TIME), + 'Last-Modified' => gmdate(DATE_RFC7231, REQUEST_TIME), 'Cache-Control' => 'no-cache, must-revalidate, post-check=0, pre-check=0', 'ETag' => '"' . REQUEST_TIME . '"', ); @@ -1336,7 +1345,7 @@ function drupal_serve_page_from_cache(stdClass $cache) { drupal_add_http_header($name, $value); } - $default_headers['Last-Modified'] = gmdate(DATE_RFC1123, $cache->created); + $default_headers['Last-Modified'] = gmdate(DATE_RFC7231, $cache->created); // HTTP/1.0 proxies does not support the Vary header, so prevent any caching // by sending an Expires date in the past. HTTP/1.1 clients ignores the diff --git a/modules/aggregator/aggregator.fetcher.inc b/modules/aggregator/aggregator.fetcher.inc index 0f7287798..ed77bb61d 100644 --- a/modules/aggregator/aggregator.fetcher.inc +++ b/modules/aggregator/aggregator.fetcher.inc @@ -27,7 +27,7 @@ function aggregator_aggregator_fetch($feed) { $headers['If-None-Match'] = $feed->etag; } if ($feed->modified) { - $headers['If-Modified-Since'] = gmdate(DATE_RFC1123, $feed->modified); + $headers['If-Modified-Since'] = gmdate(DATE_RFC7231, $feed->modified); } // Request feed. diff --git a/modules/aggregator/tests/aggregator_test.module b/modules/aggregator/tests/aggregator_test.module index 2d26a5d9a..58d9818df 100644 --- a/modules/aggregator/tests/aggregator_test.module +++ b/modules/aggregator/tests/aggregator_test.module @@ -32,7 +32,7 @@ function aggregator_test_feed($use_last_modified = FALSE, $use_etag = FALSE) { // Send appropriate response. We respond with a 304 not modified on either // etag or on last modified. if ($use_last_modified) { - drupal_add_http_header('Last-Modified', gmdate(DATE_RFC1123, $last_modified)); + drupal_add_http_header('Last-Modified', gmdate(DATE_RFC7231, $last_modified)); } if ($use_etag) { drupal_add_http_header('ETag', $etag); diff --git a/modules/simpletest/tests/bootstrap.test b/modules/simpletest/tests/bootstrap.test index 5dcde3258..f723c6301 100644 --- a/modules/simpletest/tests/bootstrap.test +++ b/modules/simpletest/tests/bootstrap.test @@ -144,7 +144,7 @@ class BootstrapPageCacheTestCase extends DrupalWebTestCase { $this->assertResponse(200, 'Conditional request without If-None-Match returned 200 OK.'); $this->assertEqual($this->drupalGetHeader('X-Drupal-Cache'), 'HIT', 'Page was cached.'); - $this->drupalGet('', array(), array('If-Modified-Since: ' . gmdate(DATE_RFC1123, strtotime($last_modified) + 1), 'If-None-Match: ' . $etag)); + $this->drupalGet('', array(), array('If-Modified-Since: ' . gmdate(DATE_RFC7231, strtotime($last_modified) + 1), 'If-None-Match: ' . $etag)); $this->assertResponse(200, 'Conditional request with new a If-Modified-Since date newer than Last-Modified returned 200 OK.'); $this->assertEqual($this->drupalGetHeader('X-Drupal-Cache'), 'HIT', 'Page was cached.'); |