[CalendarServer-changes] [3657] CalendarServer/trunk/twistedcaldav

source_changes at macosforge.org source_changes at macosforge.org
Wed Feb 11 00:42:29 PST 2009


Revision: 3657
          http://trac.macosforge.org/projects/calendarserver/changeset/3657
Author:   darla at apple.com
Date:     2009-02-11 00:42:23 -0800 (Wed, 11 Feb 2009)
Log Message:
-----------
Escaping double-quotes in access log URIs.  Skipping lines in the access logs that have quotes in the URIs, printing a warning, and continuing with the rest of the file.

Modified Paths:
--------------
    CalendarServer/trunk/twistedcaldav/accesslog.py
    CalendarServer/trunk/twistedcaldav/admin/logs.py

Modified: CalendarServer/trunk/twistedcaldav/accesslog.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/accesslog.py	2009-02-11 05:23:09 UTC (rev 3656)
+++ CalendarServer/trunk/twistedcaldav/accesslog.py	2009-02-11 08:42:23 UTC (rev 3657)
@@ -60,13 +60,13 @@
     def emit(self, eventDict):
 
         if eventDict.get('interface') is iweb.IRequest:
-
+            
             request = eventDict['request']
             response = eventDict['response']
             loginfo = eventDict['loginfo']
             firstLine = '%s %s HTTP/%s' %(
                 request.method,
-                request.uri,
+                request.uri.replace('"', '%22'),
                 '.'.join([str(x) for x in request.clientproto]))
     
             # Try to determine authentication and authorization identifiers

Modified: CalendarServer/trunk/twistedcaldav/admin/logs.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/admin/logs.py	2009-02-11 05:23:09 UTC (rev 3656)
+++ CalendarServer/trunk/twistedcaldav/admin/logs.py	2009-02-11 08:42:23 UTC (rev 3657)
@@ -26,13 +26,13 @@
 import sys
 import time
 
-from twext.python.plistlib import readPlist, writePlist
+from twext.python.plistlib import readPlist, writePlist, Dict
 
 from twistedcaldav.admin import util
 
 PLIST_VERSION = 4
 
-statsTemplate = plistlib.Dict(
+statsTemplate = Dict(
     version=PLIST_VERSION,
     bytesOut="0",
     startDate="",
@@ -272,6 +272,11 @@
                     else:
                         pline = parseCLFLine(line)
                         
+                        # Warn about problems but continue processing the file.
+                        if (len(pline) < 10):
+                            print "\nWarning: Skipping line %d: %s" % (line_count, line)
+                            continue
+                        
                         if self.stats.addDate(pline[3]):
                             self.stats.addBytes(int(pline[6]))
                             self.stats.addRequestStats(pline[4].split(' ')[0], int(pline[5]), int(pline[6]), float(pline[9][:-3]))
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20090211/73dec9f8/attachment-0001.html>


More information about the calendarserver-changes mailing list