#1402 closed defect (wontfix)
Image attachment display broken
Reported by: | Owned by: | Christopher Lenz | |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | wiki system | Version: | 0.8.1 |
Severity: | major | Keywords: | |
Cc: | Branch: | ||
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
Running Trac 0.8.1 on Apache 1.3.33 (Darwin) on an Apple xserve, I get intermittent image display. Attached images show up exactly every other time- the first time I load the image, it display properly, but the second time I load the image it shows up as a broken image (IE), or gives a "The image cannot be displayed, because it contains errors." error (Firefox).
I ran ethereal on the connection to grab the transferred data:
Success
GET /cgi-bin/mstl.cgi/attachment/wiki/JacobFarkas/thumbsup.jpg?format=raw HTTP/1.1 Host: aeroxserv.aero.calpoly.edu User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0 Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5 Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 300 Connection: keep-alive Cookie: trac_session=ae55ae88dea5e6e546e10bff; trac_auth=64a37dfce1bd402648a12f761732292f Authorization: Basic amZhcmthczozYTVhZmp2MjM= Cache-Control: max-age=0 HTTP/1.1 200 Date: Tue, 05 Apr 2005 00:23:17 GMT Server: Apache/1.3.33 (Darwin) DAV/1.0.3 mod_ssl/2.8.22 OpenSSL/0.9.7b PHP/4.3.10 Expires: Mon, 26 Jul 1997 05:00:00 GMT Pragma: no-cache Cache-Control: max-age=60 Expires: Tue, 05 Apr 2005 00:24:17 GMT Content-Length: 80897 Last-Modified: Sun, 27 Mar 2005 08:17:01 GMT Connection: close Content-Type: image/jpeg [Image data cut]
Failure
GET /cgi-bin/mstl.cgi/attachment/wiki/JacobFarkas/thumbsup.jpg?format=raw HTTP/1.1 Host: aeroxserv.aero.calpoly.edu User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0 Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5 Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 300 Connection: keep-alive Cookie: trac_session=ae55ae88dea5e6e546e10bff; trac_auth=64a37dfce1bd402648a12f761732292f If-Modified-Since: Sun, 27 Mar 2005 08:17:01 GMT Authorization: Basic amZhcmthczozYTVhZmp2MjM= Cache-Control: max-age=0 HTTP/1.1 200 Date: Tue, 05 Apr 2005 00:26:34 GMT Server: Apache/1.3.33 (Darwin) DAV/1.0.3 mod_ssl/2.8.22 OpenSSL/0.9.7b PHP/4.3.10 Connection: close Expires: Mon, 26 Jul 1997 05:00:00 GMT Expires: Tue, 05 Apr 2005 00:27:34 GMT Cache-Control: max-age=60
Attachments (3)
Change History (10)
comment:1 by , 20 years ago
comment:2 by , 20 years ago
Thanks for the tip about Live HTTP Headers- that saved me some headaches!
I ran into this problem migrating from a Linux server to an OS X xserve, so I had a known working copy of the site to work against. Between migrating I also changed versions from Trac 0.8.0 to Trac 0.8.1. That appears to be what caused the problem.
In File.py the Cache-Control line was removed from version version 0.8.0 to version 0.8.1. This caused the images to load incorrectly every other time. I tested this by removing the line in my Trac 0.8.0 install and encountered the same problem.
Here are the lines that were removed:
File.py:80-82
self.req.send_header('Cache-Control', 'no-store, no-cache, must-revalidate, max-age=0') self.req.send_header('Cache-Control', 'post-check=0, pre-check=0')
I noticed that more specifically, it seems that not having the 'no-store' property is causing the problem.
Since this happens on both the xserve 0.8.1 install and the Linux 0.8.0 install, I don't think it's related to any specific server, although I'm surprised no one else has run into this problem. Can anyone else confirm this problem?
I created a patch that adds the 'Cache-Control: no-store' header back in to File.py and have attached it to this ticket.
I looked at the code in Trunk and it looks like File.py has been refactored out, but the necessary Cache-Control line is still missing from attachment.py. I'll download and install the latest code on a test box and see if I can recreate the problem.
comment:3 by , 20 years ago
I just confirmed this same problem on revision 1504. I've attached a patch to fix the problem.
by , 20 years ago
Attachment: | nostore.diff added |
---|
comment:4 by , 20 years ago
It looks like this may be related to Ticket #1020. Does adding no-store back in break Explorer?
comment:5 by , 20 years ago
Owner: | changed from | to
---|
cmlenz: is this the same issue you fixed for #1680?
comment:6 by , 20 years ago
#1680 applied only to trunk, while this one is about a similar but still different issue with 0.8.x. So no, I don't think this is fixed, but OTOH, the target milestone would be 0.8.5, which isn't planned yet.
comment:7 by , 19 years ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
Thanks for the headers, though I find it easier to use the Firefox plugin "Live HTTP Headers" instead of Ethereal.
So, it appears that there's a problem with the expiration headers that are being returned. There are two contradictory "Expires" headers and the "Pragma: no-cache" that don't seem to belong there. Then in the second request, the response code should be a 304 (Not Modified) instead of 200 (OK).
I'm not entirely sure why these headers are being added, but the "Mon, 26 Jul 1997 05:00:00 GMT" date in the expires header seems to be a convention in PHP for forcing immediate expiration. There may be something in your webserver and/or PHP configuration that is generating these expiration headers to prevent caching of PHP-related pages, but it is interfering with the operation of Trac as well.