Problem/Motivation
This is basically an follow-up to #1926884: CDN module is not compatible with security fix in Drupal core update 7.20.
It looks like the farfuture option doesn't properly work with image style tokens in _cdn_basic_farfuture_generate_file().
The url's generated and called by that function won't contain the image style token and thus the idea of having a loop to ensure a file is available / generated doesn't work out anymore.
This presents in the watchdog log as numerous errors of the type cdn: Nested HTTP request to generate
Proposed resolution
Use the limited information we have about to url to figure out if it is an image style token is needed. If so generate the token and add it to the url before making the request.
Remaining tasks
Not yet tested with private files. But I assume it should work since the stream wrappers are handled dynamically.
User interface changes
None.
API changes
_cdn_basic_farfuture_generate_file() has new parameter as we need the orignal url with the stream wrapper prefix.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | interdiff-0-2.txt | 369 bytes | paranojik |
| #2 | 2407287-Farfuture-incopatible-with-image-style-tokens-2.patch | 2.7 KB | paranojik |
| cdn-farfuture-image-style-token-compatibility.patch | 2.57 KB | das-peter |
Comments
Comment #1
das-peter commentedJust deployed this and the watchdog now shows notices instead criticals.
I hope these soon also disappear because the files are finally generated.
Comment #2
paranojik commentedTested. And works as expected. I only removed a redundant line. I think this is RTBC.
Comment #3
paranojik commented...and changed the status :)
Comment #4
hswong3i commentedRTBC +1
Comment #5
johnennew commentedThis does appear to have solved this issue, prior to applying this patch i was receiving many WATCHDOG_ERROR messages (not WATCHDOG_INFO) of the type: WD cdn: Nested HTTP request to generate. After applying these appear to have stopped. I've updated issue summary to include this watchdog message which users might notice first.
Comment #6
wim leersManually tested, works perfectly.
I can't believe this slipped through the cracks back then :( This is why we need all these things to be unit testable… The CDN module in Drupal 8 will be so much more maintainable!
Comment #8
wim leers#2050085: Generate File and #1966936: Intermittent failure to generate images are duplicates of this.
Comment #9
wim leersAnother indirect duplicate: #2088503: CDN + Adaptive Image styles (AIS) for responsive images.