Skip to content

Commit 216f337

Browse files
author
Richard Jones
committed
fixed cookie path to use TRACKER_WEB [SF#667020]
(thanks Luke Opperman for confirming fix)
1 parent d481a04 commit 216f337

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

CHANGES.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ are given with the most recent entry first.
2121
- applied unicode patch. All data is stored in utf-8. Incoming messages
2222
converted from any encoding to utf-8, outgoing messages are encoded
2323
according to rfc2822 (sf bug 568873)
24+
- fixed cookie path to use TRACKER_WEB (sf bug 667020) (thanks Luke Opperman
25+
for confirming fix)
2426

2527

2628
2003-??-?? 0.5.5

roundup/cgi/client.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# $Id: client.py,v 1.72 2003-01-20 23:05:19 richard Exp $
1+
# $Id: client.py,v 1.73 2003-01-24 06:21:17 richard Exp $
22

33
__doc__ = """
44
WWW request handler (also used in the stand-alone server).
@@ -89,9 +89,13 @@ def __init__(self, instance, request, env, form=None):
8989
# save off the path
9090
self.path = env['PATH_INFO']
9191

92-
# this is the base URL for this instance
92+
# this is the base URL for this tracker
9393
self.base = self.instance.config.TRACKER_WEB
9494

95+
# this is the "cookie path" for this tracker (ie. the path part of
96+
# the "base" url)
97+
self.cookie_path = urlparse.urlparse(self.base)[2]
98+
9599
# see if we need to re-parse the environment for the form (eg Zope)
96100
if form is None:
97101
self.form = cgi.FieldStorage(environ=env)
@@ -480,10 +484,9 @@ def set_cookie(self, user):
480484
expire = Cookie._getdate(86400*365)
481485

482486
# generate the cookie path - make sure it has a trailing '/'
483-
path = '/'.join((self.env['SCRIPT_NAME'], self.env['TRACKER_NAME'],
484-
''))
485487
self.additional_headers['Set-Cookie'] = \
486-
'roundup_user_2=%s; expires=%s; Path=%s;'%(self.session, expire, path)
488+
'roundup_user_2=%s; expires=%s; Path=%s;'%(self.session, expire,
489+
self.cookie_path)
487490

488491
def make_user_anonymous(self):
489492
''' Make us anonymous
@@ -578,10 +581,9 @@ def logout_action(self):
578581

579582
# construct the logout cookie
580583
now = Cookie._getdate()
581-
path = '/'.join((self.env['SCRIPT_NAME'], self.env['TRACKER_NAME'],
582-
''))
583584
self.additional_headers['Set-Cookie'] = \
584-
'roundup_user_2=deleted; Max-Age=0; expires=%s; Path=%s;'%(now, path)
585+
'roundup_user_2=deleted; Max-Age=0; expires=%s; Path=%s;'%(now,
586+
self.cookie_path)
585587

586588
# Let the user know what's going on
587589
self.ok_message.append(_('You are logged out'))

0 commit comments

Comments
 (0)