In order to pass information for the AJAX-phase, a JavaScript snipped is appended to each cached page in a shutdown function. This results in several problems when caching non-HTML content. In order to prevent unexpected behavior, attachment of the script settings should be done using the standard drupal way using drupal_add_js and Drupal.settings. JavaScript attached to a page in this way will never interfere with non-HTML content.

Because drupal attaches JavaScript when the page is rendered, thus earlier than the current authcacheFooter injection, some authcache information is not available at page build time. Luckily there is no need for the core authcache functions to run as late as possible, only the debug information must be collected at the very end of a page cycle.

The idea is now to save this debug information along with the compressed page into the same cache-object. This information can be accessed later during the ajax phase. The only problem is that there is no way to store debug information when a page is not cached. In order to cover that case, the reason for when a page was not stored is written into a cookie. Such that it can be accessed later from the debug JavaScript.

As an extra benefit of this approach, we have better protection of the debug information because the AJAX phase is authenticated. Therefore the risk of leaking information via the cached authcacheFooter is reduced.

Members fund testing for the Drupal project. Drupal Association Learn more


znerol’s picture

Patch is against 7.x-1.x plus patches applied up to comment 109 in #966152-109: Authcache » Drupal 7 port.

znerol’s picture

Status: Active » Needs review
znerol’s picture

Forgot to comment on that hunk:

diff --git a/authcache.module b/authcache.module
index f04c423..b74551b 100644
--- a/authcache.module
+++ b/authcache.module
@@ -125,26 +125,12 @@ function authcache_menu() {
 function authcache_init() {
   global $user, $_authcache_is_cacheable, $_authcache_info;
-  // Pressflow compatibility (since Pressflow doesn't set this cookie)
-  if (($sysblock = system_block_info()) && $sysblock['powered-by'] == t('Powered by Pressflow')) {
-    drupal_add_js("document.cookie = 'has_js=1; path=/';", array('scope' => 'header'));
-  }

Diffing pressflow 7 against stock drupal 7 gives no indication that this cookie has been removed. I therefore did not bother keeping that hack.

znerol’s picture

znerol’s picture

Rebase on top of #966152-122: Authcache » Drupal 7 port. Additionally I'm in the phase of reworking the JavaScript part into behaviors. The debug widget and browser-side caching (max_age) still need some work. Apart from that most things are converted and operational.

znerol’s picture

Status: Needs review » Closed (fixed)

Implemented in 7.x-2.x-dev.