Skip to content

Commit fa6f67b

Browse files
author
Richard Jones
committed
Manually constructing cookie headers now.
1 parent a339773 commit fa6f67b

File tree

1 file changed

+9
-15
lines changed

1 file changed

+9
-15
lines changed

roundup/cgi_client.py

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1616
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1717
#
18-
# $Id: cgi_client.py,v 1.32 2001-10-16 03:36:21 richard Exp $
18+
# $Id: cgi_client.py,v 1.33 2001-10-17 00:18:41 richard Exp $
1919

2020
import os, cgi, pprint, StringIO, urlparse, re, traceback, mimetypes
2121
import base64, Cookie, time
@@ -513,10 +513,7 @@ def login_action(self, message=None):
513513
user = base64.encodestring('%s:%s'%(self.user, password))[:-1]
514514
path = '/'.join((self.env['SCRIPT_NAME'], self.env['INSTANCE_NAME'],
515515
''))
516-
cookie = Cookie.SmartCookie()
517-
cookie['roundup_user'] = user
518-
cookie['roundup_user']['path'] = path
519-
self.header({'Set-Cookie': str(cookie)})
516+
self.header({'Set-Cookie': 'roundup_user=%s; Path=%s;'%(user, path)})
520517
return self.index()
521518

522519
def make_user_anonymous(self):
@@ -532,12 +529,9 @@ def logout(self, message=None):
532529
# construct the logout cookie
533530
path = '/'.join((self.env['SCRIPT_NAME'], self.env['INSTANCE_NAME'],
534531
''))
535-
cookie = Cookie.SmartCookie()
536-
cookie['roundup_user'] = 'deleted'
537-
cookie['roundup_user']['path'] = path
538-
cookie['roundup_user']['expires'] = 0
539-
cookie['roundup_user']['max-age'] = 0
540-
self.header({'Set-Cookie': str(cookie)})
532+
now = Cookie._getdate()
533+
self.header({'Set-Cookie':
534+
'roundup_user=deleted; Max-Age=0; expires=%s; Path=%s;'%(now, path)})
541535
return self.index()
542536

543537
def newuser_action(self, message=None):
@@ -555,10 +549,7 @@ def newuser_action(self, message=None):
555549
user = base64.encodestring('%s:%s'%(self.user, password))[:-1]
556550
path = '/'.join((self.env['SCRIPT_NAME'], self.env['INSTANCE_NAME'],
557551
''))
558-
cookie = Cookie.SmartCookie()
559-
cookie['roundup_user'] = user
560-
cookie['roundup_user']['path'] = path
561-
self.header({'Set-Cookie': str(cookie)})
552+
self.header({'Set-Cookie': 'roundup_user=%s; Path=%s;'%(user, path)})
562553
return self.index()
563554

564555
def main(self, dre=re.compile(r'([^\d]+)(\d+)'),
@@ -780,6 +771,9 @@ def parsePropsFromForm(db, cl, form, nodeid=0):
780771

781772
#
782773
# $Log: not supported by cvs2svn $
774+
# Revision 1.32 2001/10/16 03:36:21 richard
775+
# CGI interface wasn't handling checkboxes at all.
776+
#
783777
# Revision 1.31 2001/10/14 10:55:00 richard
784778
# Handle empty strings in HTML template Link function
785779
#

0 commit comments

Comments
 (0)