The generate URL, e.g. http://example.com/image/generate/thumbnail/sites/default/files/pictures..., returns the proper image but with a 500 Internal Server Error HTTP status code. This is because the image module does not use the updated header format that was introduced in #147310: Implement better cache headers for reverse proxies.

This patch fixes that. It also adds proper HTTP status codes when the generated image cannot be returned.

CommentFileSizeAuthor
#3 image-headers-2.patch9.88 KBc960657
image-headers-1.patch9.62 KBc960657
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Dries’s picture

Status: Needs review » Reviewed & tested by the community

Excellent patch -- this looks good to me. My only reservation was that 10 seconds feels long but that is really minor as this code shouldn't trigger that often.

webchick’s picture

Hm. I think we could probably move this down to more like 2 or 3 seconds at the most. Then it wouldn't appear like an error to someone browsing the site.

The expanded tests look really helpful.

@c960657, was there a particular reason why 10 was chosen?

c960657’s picture

FileSize
9.88 KB

The 10 seconds was chosen on an assumption that after that long the image generation is (almost) definitely done. But I guess the client can just try several times, if for some reason the generation takes very long. I changed it to 2.

I doubt any browsers actually request the image again after the specified time, but some web spiders may support the header. I just added a note about this, so that people reading the code wont expect too much.

quicksketch’s picture

This looks good to me, I didn't know we'd fixed the headers. A significant improvement!

Dries’s picture

Status: Reviewed & tested by the community » Fixed

I fixed a typo, and committed this to CVS HEAD. Thanks again, c960657!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.