Commit 4ddf6bed authored by Chris McDonough's avatar Chris McDonough

Bugfix for logging of username. Previous revision could raise errors which restarted Zope.

parent a786f8a4
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
# All Rights Reserved. # All Rights Reserved.
# #
RCS_ID = '$Id: http_server.py,v 1.26 2001/05/30 16:19:15 andreas Exp $' RCS_ID = '$Id: http_server.py,v 1.27 2001/07/02 13:48:46 chrism Exp $'
# python modules # python modules
import os import os
...@@ -276,10 +276,13 @@ class http_request: ...@@ -276,10 +276,13 @@ class http_request:
name='Anonymous' name='Anonymous'
if auth is not None: if auth is not None:
if string.lower(auth[:6]) == 'basic ': if string.lower(auth[:6]) == 'basic ':
[name,password] = string.split( try: decoded=base64.decodestring(auth[6:])
base64.decodestring( except base64.binascii.Error: decoded=''
string.split(auth)[-1]), ':') t = string.split(decoded, ':', 1)
if len(t) < 2:
name = 'Unknown (bad auth string)'
else:
name = t[0]
self.channel.server.logger.log ( self.channel.server.logger.log (
self.channel.addr[0], self.channel.addr[0],
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
# All Rights Reserved. # All Rights Reserved.
# #
RCS_ID = '$Id: http_server.py,v 1.26 2001/05/30 16:19:15 andreas Exp $' RCS_ID = '$Id: http_server.py,v 1.27 2001/07/02 13:48:46 chrism Exp $'
# python modules # python modules
import os import os
...@@ -276,10 +276,13 @@ class http_request: ...@@ -276,10 +276,13 @@ class http_request:
name='Anonymous' name='Anonymous'
if auth is not None: if auth is not None:
if string.lower(auth[:6]) == 'basic ': if string.lower(auth[:6]) == 'basic ':
[name,password] = string.split( try: decoded=base64.decodestring(auth[6:])
base64.decodestring( except base64.binascii.Error: decoded=''
string.split(auth)[-1]), ':') t = string.split(decoded, ':', 1)
if len(t) < 2:
name = 'Unknown (bad auth string)'
else:
name = t[0]
self.channel.server.logger.log ( self.channel.server.logger.log (
self.channel.addr[0], self.channel.addr[0],
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment