Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ETag to post-processor response with support for 304 status #1481

Merged
merged 3 commits into from
Oct 3, 2018

Conversation

westonruter
Copy link
Member

@westonruter westonruter commented Oct 1, 2018

We are already computing a cache key for the post-processor results to be stored in the object cache. We can use this same cache key also for the ETag of the response. Then a browser can serve the ETag value in its If-None-Match request header, and WordPress can short-circuit sending any response in favor of sendind 304 Not Modified.

  • Add some tests.

@westonruter westonruter added this to the v1.1 milestone Oct 1, 2018
status_header( 304 );
return '';
}
AMP_HTTP::send_header( 'ETag', $response_cache_key );
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This header needs to be sent even when it is a 304 response.

Copy link
Member

@amedina amedina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

includes/class-amp-theme-support.php Show resolved Hide resolved
@westonruter westonruter changed the title [WIP] Add ETags to post-processor response with support for 304 status Add ETag to post-processor response with support for 304 status Oct 3, 2018
@westonruter westonruter merged commit 3eca3ed into develop Oct 3, 2018
@westonruter westonruter deleted the add/etag branch October 3, 2018 17:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants