#2006: broken images and attachments. SSL related.
-------------------------------------------------+--------------------------
Reporter: tiger@tadol.net | Owner: jonas
Type: defect | Status: new
Priority: normal | Milestone:
Component: browser | Version: devel
Severity: normal | Keywords: https ssl broken images attachments |
-------------------------------------------------+--------------------------
There is a problem in viewing images and dowloading attachments
in https mode.
Symptoms:
1. Attachment image being show once normally.
2. When you refresh page browser reports that image is broken.
3. Again refresh - image again being shown normally.
This goes in a cyclic fashion.
With attachments also problem that attachment is being cached by
the browser. So you often getting stale files after attachment was
updated.
I found that that's all related to the cache control headers.
Here is a patch which fixes such behaviour:
{{{
Index: trac/web/main.py
===================================================================
--- trac/web/main.py (revision 2067)
+++ trac/web/main.py (working copy)
@@ -218,9 +218,12 @@
self.send_response(200)
if not mimetype:
mimetype = mimetypes.guess_type(path)[0]
+
+ self.send_header('Cache-control', 'must-revalidate')
+ self.send_header('Expires', 'Fri, 01 Jan 1999 00:00:00 GMT')
self.send_header('Content-Type', mimetype)
self.send_header('Content-Length', stat.st_size)
- self.send_header('Last-Modified', last_modified)
+ #self.send_header('Last-Modified', last_modified)
self.end_headers()
if self.method != 'HEAD':
}}}
--
Ticket URL: <http://projects.edgewall.com/trac/ticket/2006>
The Trac Project <http://trac.edgewall.com/>
-------------------------------------------------+--------------------------
Reporter: tiger@tadol.net | Owner: jonas
Type: defect | Status: new
Priority: normal | Milestone:
Component: browser | Version: devel
Severity: normal | Keywords: https ssl broken images attachments |
-------------------------------------------------+--------------------------
There is a problem in viewing images and dowloading attachments
in https mode.
Symptoms:
1. Attachment image being show once normally.
2. When you refresh page browser reports that image is broken.
3. Again refresh - image again being shown normally.
This goes in a cyclic fashion.
With attachments also problem that attachment is being cached by
the browser. So you often getting stale files after attachment was
updated.
I found that that's all related to the cache control headers.
Here is a patch which fixes such behaviour:
{{{
Index: trac/web/main.py
===================================================================
--- trac/web/main.py (revision 2067)
+++ trac/web/main.py (working copy)
@@ -218,9 +218,12 @@
self.send_response(200)
if not mimetype:
mimetype = mimetypes.guess_type(path)[0]
+
+ self.send_header('Cache-control', 'must-revalidate')
+ self.send_header('Expires', 'Fri, 01 Jan 1999 00:00:00 GMT')
self.send_header('Content-Type', mimetype)
self.send_header('Content-Length', stat.st_size)
- self.send_header('Last-Modified', last_modified)
+ #self.send_header('Last-Modified', last_modified)
self.end_headers()
if self.method != 'HEAD':
}}}
--
Ticket URL: <http://projects.edgewall.com/trac/ticket/2006>
The Trac Project <http://trac.edgewall.com/>