comparison roundup/scripts/roundup_server.py @ 1473:21a80a8dfc6d

fix (again?) trailing / redirect [SF#692910]
author Richard Jones <richard@users.sourceforge.net>
date Wed, 26 Feb 2003 05:05:56 +0000
parents 79d8956de3f5
children 693b915041e6
comparison
equal deleted inserted replaced
1472:77942e0a12fe 1473:21a80a8dfc6d
14 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, 14 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
15 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 15 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
16 # 16 #
17 """ HTTP Server that serves roundup. 17 """ HTTP Server that serves roundup.
18 18
19 $Id: roundup_server.py,v 1.19 2003-02-26 04:51:41 richard Exp $ 19 $Id: roundup_server.py,v 1.20 2003-02-26 05:05:56 richard Exp $
20 """ 20 """
21 21
22 # python version check 22 # python version check
23 from roundup import version_check 23 from roundup import version_check
24 24
121 if i >= 0: 121 if i >= 0:
122 rest, query = rest[:i], rest[i+1:] 122 rest, query = rest[:i], rest[i+1:]
123 else: 123 else:
124 query = '' 124 query = ''
125 125
126 # figure the tracker 126 # no tracker - spit out the index
127 if rest == '/': 127 if rest == '/':
128 return self.index() 128 return self.index()
129
130 # figure the tracker
129 l_path = rest.split('/') 131 l_path = rest.split('/')
130 tracker_name = urllib.unquote(l_path[1]) 132 tracker_name = urllib.unquote(l_path[1])
133
134 # handle missing trailing '/'
135 if len(l_path) == 2:
136 self.send_response(301)
137 # redirect - XXX https??
138 protocol = 'http'
139 url = '%s://%s%s/'%(protocol, self.headers['host'], self.path)
140 self.send_header('Location', url)
141 self.end_headers()
142 self.wfile.write('Moved Permanently')
143 return
144
131 if self.TRACKER_HOMES.has_key(tracker_name): 145 if self.TRACKER_HOMES.has_key(tracker_name):
132 tracker_home = self.TRACKER_HOMES[tracker_name] 146 tracker_home = self.TRACKER_HOMES[tracker_name]
133 tracker = roundup.instance.open(tracker_home) 147 tracker = roundup.instance.open(tracker_home)
134 else: 148 else:
135 raise client.NotFound 149 raise client.NotFound

Roundup Issue Tracker: http://roundup-tracker.org/