Skip to content

Commit c60fb05

Browse files
author
Richard Jones
committed
fix (again?) trailing / redirect [SF#692910]
1 parent e7f1d02 commit c60fb05

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

CHANGES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ are given with the most recent entry first.
6565
file serving
6666
- added Node.get() method
6767
- open static files using binary mode (sf bug 693208)
68+
- fixed deja-vu bug 692910
6869

6970

7071
2003-??-?? 0.5.6

roundup/scripts/roundup_server.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#
1717
""" HTTP Server that serves roundup.
1818
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 $
2020
"""
2121

2222
# python version check
@@ -123,11 +123,25 @@ def inner_run_cgi(self):
123123
else:
124124
query = ''
125125

126-
# figure the tracker
126+
# no tracker - spit out the index
127127
if rest == '/':
128128
return self.index()
129+
130+
# figure the tracker
129131
l_path = rest.split('/')
130132
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+
131145
if self.TRACKER_HOMES.has_key(tracker_name):
132146
tracker_home = self.TRACKER_HOMES[tracker_name]
133147
tracker = roundup.instance.open(tracker_home)

0 commit comments

Comments
 (0)