Commit 72c4ac4d authored by Andreas Jung's avatar Andreas Jung

Zope now logs the authen. username to the server logs (Collector #2261)

parent ffafb76e
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
# All Rights Reserved. # All Rights Reserved.
# #
RCS_ID = '$Id: http_server.py,v 1.25 2001/05/01 12:49:04 andreas Exp $' RCS_ID = '$Id: http_server.py,v 1.26 2001/05/30 16:19:15 andreas Exp $'
# python modules # python modules
import os import os
...@@ -16,6 +16,7 @@ import stat ...@@ -16,6 +16,7 @@ import stat
import string import string
import sys import sys
import time import time
import base64
# async modules # async modules
import asyncore import asyncore
...@@ -270,9 +271,20 @@ class http_request: ...@@ -270,9 +271,20 @@ class http_request:
if not user_agent: user_agent='' if not user_agent: user_agent=''
referer=self.get_header('referer') referer=self.get_header('referer')
if not referer: referer='' if not referer: referer=''
auth=self.get_header('Authorization')
name='Anonymous'
if auth is not None:
if string.lower(auth[:6]) == 'basic ':
[name,password] = string.split(
base64.decodestring(
string.split(auth)[-1]), ':')
self.channel.server.logger.log ( self.channel.server.logger.log (
self.channel.addr[0], self.channel.addr[0],
' - - [%s] "%s" %d %d "%s" "%s"\n' % ( ' - %s [%s] "%s" %d %d "%s" "%s"\n' % (
name,
self.log_date_string (time.time()), self.log_date_string (time.time()),
self.request, self.request,
self.reply_code, self.reply_code,
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
# All Rights Reserved. # All Rights Reserved.
# #
RCS_ID = '$Id: http_server.py,v 1.25 2001/05/01 12:49:04 andreas Exp $' RCS_ID = '$Id: http_server.py,v 1.26 2001/05/30 16:19:15 andreas Exp $'
# python modules # python modules
import os import os
...@@ -16,6 +16,7 @@ import stat ...@@ -16,6 +16,7 @@ import stat
import string import string
import sys import sys
import time import time
import base64
# async modules # async modules
import asyncore import asyncore
...@@ -270,9 +271,20 @@ class http_request: ...@@ -270,9 +271,20 @@ class http_request:
if not user_agent: user_agent='' if not user_agent: user_agent=''
referer=self.get_header('referer') referer=self.get_header('referer')
if not referer: referer='' if not referer: referer=''
auth=self.get_header('Authorization')
name='Anonymous'
if auth is not None:
if string.lower(auth[:6]) == 'basic ':
[name,password] = string.split(
base64.decodestring(
string.split(auth)[-1]), ':')
self.channel.server.logger.log ( self.channel.server.logger.log (
self.channel.addr[0], self.channel.addr[0],
' - - [%s] "%s" %d %d "%s" "%s"\n' % ( ' - %s [%s] "%s" %d %d "%s" "%s"\n' % (
name,
self.log_date_string (time.time()), self.log_date_string (time.time()),
self.request, self.request,
self.reply_code, self.reply_code,
......
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