Mercurial > p > roundup > code
changeset 2592:5a8d9465827e
implement the HTTP HEAD command [SF#992544]
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Tue, 20 Jul 2004 02:07:58 +0000 |
| parents | 5f52d113de0c |
| children | c0d6d5004464 |
| files | CHANGES.txt roundup/cgi/actions.py roundup/cgi/client.py roundup/scripts/roundup_server.py |
| diffstat | 4 files changed, 20 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/CHANGES.txt Tue Jul 20 00:43:55 2004 +0000 +++ b/CHANGES.txt Tue Jul 20 02:07:58 2004 +0000 @@ -31,6 +31,7 @@ - fixed DateHTMLProperty for invalid date entry (sf bug 986538) - fixed external password source example (sf bug 986601) - document the STATIC_FILES config var +- implement the HTTP HEAD command (sf bug 992544) 2004-06-24 0.7.5
--- a/roundup/cgi/actions.py Tue Jul 20 00:43:55 2004 +0000 +++ b/roundup/cgi/actions.py Tue Jul 20 02:07:58 2004 +0000 @@ -1,4 +1,4 @@ -#$Id: actions.py,v 1.34 2004-07-13 09:41:15 a1s Exp $ +#$Id: actions.py,v 1.35 2004-07-20 02:07:58 richard Exp $ import re, cgi, StringIO, urllib, Cookie, time, random @@ -882,7 +882,13 @@ h['Content-Type'] = 'text/csv' # some browsers will honor the filename here... h['Content-Disposition'] = 'inline; filename=query.csv' + self.client.header() + + if self.client.env['REQUEST_METHOD'] == 'HEAD': + # all done, return a dummy string + return 'dummy' + writer = rcsv.writer(self.client.request.wfile) writer.writerow(columns)
--- a/roundup/cgi/client.py Tue Jul 20 00:43:55 2004 +0000 +++ b/roundup/cgi/client.py Tue Jul 20 02:07:58 2004 +0000 @@ -1,4 +1,4 @@ -# $Id: client.py,v 1.183 2004-07-13 10:19:13 a1s Exp $ +# $Id: client.py,v 1.184 2004-07-20 02:07:58 richard Exp $ """WWW request handler (also used in the stand-alone server). """ @@ -675,7 +675,8 @@ def write(self, content): if not self.headers_done: self.header() - self.request.wfile.write(content) + if self.env['REQUEST_METHOD'] != 'HEAD': + self.request.wfile.write(content) def write_html(self, content): if not self.headers_done: @@ -694,10 +695,17 @@ 'roundup_charset=%s; expires=%s; Path=%s;' % ( self.charset, expire, self.cookie_path) self.header() + + if self.env['REQUEST_METHOD'] == 'HEAD': + # client doesn't care about content + return + if self.charset != self.STORAGE_CHARSET: # recode output content = content.decode(self.STORAGE_CHARSET, 'replace') content = content.encode(self.charset, 'xmlcharrefreplace') + + # and write self.request.wfile.write(content) def setHeader(self, header, value):
--- a/roundup/scripts/roundup_server.py Tue Jul 20 00:43:55 2004 +0000 +++ b/roundup/scripts/roundup_server.py Tue Jul 20 02:07:58 2004 +0000 @@ -17,7 +17,7 @@ """Command-line script that runs a server over roundup.cgi.client. -$Id: roundup_server.py,v 1.55 2004-07-13 10:24:19 a1s Exp $ +$Id: roundup_server.py,v 1.56 2004-07-20 02:07:58 richard Exp $ """ __docformat__ = 'restructuredtext' @@ -118,7 +118,7 @@ self.wfile.write("</pre>\n") sys.stdin = save_stdin - do_GET = do_POST = run_cgi + do_GET = do_POST = do_HEAD = run_cgi def index(self): ''' Print up an index of the available trackers
