|
Jim Gallacher
jg.lists at sympatico.ca
Wed Jun 15 20:02:03 EDT 2005
Graham Dumpleton wrote:
> Dan Eloff wrote ..
>
>>Just discovered this.
>>
>># XXX Not sure why, but on Win32 hlist.directory
>># may contain a trailing \ - need to investigate,
>># this value is given to us directly by httpd
>>if os.name == 'nt' and c.path[-1] == '\\':
>> c.path = c.path[:-1]
>
>
> The underlying problem is a known issue. The hack in the session
> code was presumably put there because someone didn't understand
> the root cause. Anyway, the underlying problem has already been
> fixed for 3.2 and the hack in Session code removed.
Yes, it's been fixed. Current code in svn mod_python/trunk looks like this:
def make_cookie(self):
if self._secret:
c = Cookie.SignedCookie(COOKIE_NAME, self._sid,
secret=self._secret)
else:
c = Cookie.Cookie(COOKIE_NAME, self._sid)
config = self._req.get_options()
if config.has_key("ApplicationPath"):
c.path = config["ApplicationPath"]
else:
# the path where *Handler directive was specified
dirpath = self._req.hlist.directory
if dirpath:
docroot = self._req.document_root()
c.path = dirpath[len(docroot):]
else:
c.path = '/'
# Sometimes there is no path, e.g. when Location
# is used. When Alias or UserDir are used, then
# the path wouldn't match the URI. In those cases
# just default to '/'
if not c.path or not self._req.uri.startswith(c.path):
c.path = '/'
return c
Jim
|