[Python-apps-team] Bug#561406: tracd uses Cache-control instead of Cache-Control HTTP header in its responses

Sebastien COURET 10function at neuf.com
Wed Dec 16 21:58:08 UTC 2009


Package: trac
Version: 0.11.5-5
Severity: minor
Tags: patch

tracd uses "Cache-control" HTTP response header instead of "Cache-Control" as shown :

A) Launch tracd :

$ tracd --port 8000 /tmp/test
Server starting in PID 21267.
Serving on 0.0.0.0:8000 view at http://127.0.0.1:8000/

B) Query it :

$ telnet 127.0.0.1 8000
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
GET / HTTP/1.1

HTTP/1.0 200 OK
Server: tracd/0.11.5 Python/2.5.4
Date: Wed, 16 Dec 2009 21:46:20 GMT
Cache-control: must-revalidate
Content-Type: text/html;charset=utf-8
Content-Length: 377

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>Available Projects</title>
  </head>
  <body>
    <h1>Available Projects</h1>
    <ul>
      <li>
        <a href="/test" title="My example project">My Project</a>
      </li>
    </ul>
  </body>
</html>Connection closed by foreign host.
$

HTTP RFC specifies "Cache-Control" , but there Cache-control is used. 

A minor bug that could be fixed by the following minor patch :

--- trac/web/api.py     2009-12-16 21:39:06.000000000 +0000
+++ trac/web/api-patched.py     2009-12-16 21:51:20.000000000 +0000
@@ -321,7 +321,7 @@
         self.send_header('Content-Type', 'text/plain')
         self.send_header('Content-Length', 0)
         self.send_header('Pragma', 'no-cache')
-        self.send_header('Cache-control', 'no-cache')
+        self.send_header('Cache-Control', 'no-cache')
         self.send_header('Expires', 'Fri, 01 Jan 1999 00:00:00 GMT')
         self.end_headers()

@@ -350,7 +350,7 @@

     def send(self, content, content_type='text/html', status=200):
         self.send_response(status)
-        self.send_header('Cache-control', 'must-revalidate')
+        self.send_header('Cache-Control', 'must-revalidate')
         self.send_header('Content-Type', content_type + ';charset=utf-8')
         self.send_header('Content-Length', len(content))
         self.end_headers()
@@ -386,7 +386,7 @@

         self.send_response(status)
         self._outheaders = []
-        self.send_header('Cache-control', 'must-revalidate')
+        self.send_header('Cache-Control', 'must-revalidate')
         self.send_header('Expires', 'Fri, 01 Jan 1999 00:00:00 GMT')
         self.send_header('Content-Type', content_type + ';charset=utf-8')
         self.send_header('Content-Length', len(data))

Hope this helps. 
Thanks for all ur good job. trac rulez !

-- System Information:
Debian Release: squeeze/sid
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: i386 (i686)

Kernel: Linux 2.6.30-2-686 (SMP w/1 CPU core)
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
Shell: /bin/sh linked to /bin/bash

Versions of packages trac depends on:
ii  python                       2.5.4-2     An interactive high-level object-o
ii  python-central               0.6.14+nmu2 register and build utility for Pyt
ii  python-genshi                0.5.1-2     Python XML-based template engine
ii  python-pysqlite2             2.5.5-3     Python interface to SQLite 3
ii  python-setuptools            0.6.8-1     Python Distutils Enhancements (set

Versions of packages trac recommends:
ii  apache-ssl [httpd]           1.3.34-4.1  versatile, high-performance HTTP s
ii  apache2                      2.2.14-3    Apache HTTP Server metapackage
ii  apache2-mpm-prefork [httpd]  2.2.14-3    Apache HTTP Server - traditional n
ii  enscript                     1.6.4-13    Converts ASCII text to Postscript,
ii  libjs-jquery                 1.3.3-2     JavaScript library for dynamic web
ii  python-subversion            1.6.3dfsg-1 Python bindings for Subversion
ii  python-tz                    2009p-1     Python version of the Olson timezo

Versions of packages trac suggests:
pn  libapache2-mod-wsgi | libapac <none>     (no description available)
pn  python-docutils               <none>     (no description available)
pn  python-textile                <none>     (no description available)
pn  trac-accountmanager           <none>     (no description available)
pn  trac-bzr                      <none>     (no description available)
pn  trac-email2trac               <none>     (no description available)
pn  trac-git                      <none>     (no description available)
pn  trac-mercurial                <none>     (no description available)
pn  trac-spamfilter               <none>     (no description available)

-- no debconf information






More information about the Python-apps-team mailing list