[CalendarServer-changes] [6320] CalendarServer/trunk/contrib/tools/protocolanalysis.py

source_changes at macosforge.org source_changes at macosforge.org
Tue Sep 21 09:14:35 PDT 2010


Revision: 6320
          http://trac.macosforge.org/projects/calendarserver/changeset/6320
Author:   cdaboo at apple.com
Date:     2010-09-21 09:14:34 -0700 (Tue, 21 Sep 2010)
Log Message:
-----------
Cope with bogus HTTP methods. Pull out more client versions.

Modified Paths:
--------------
    CalendarServer/trunk/contrib/tools/protocolanalysis.py

Modified: CalendarServer/trunk/contrib/tools/protocolanalysis.py
===================================================================
--- CalendarServer/trunk/contrib/tools/protocolanalysis.py	2010-09-21 16:13:44 UTC (rev 6319)
+++ CalendarServer/trunk/contrib/tools/protocolanalysis.py	2010-09-21 16:14:34 UTC (rev 6320)
@@ -81,6 +81,26 @@
     (  None, "(l):120s+"),
 )
 
+httpMethods = set((
+    "ACL",
+    "BIND",
+    "CONNECT",
+    "COPY",
+    "DELETE",
+    "GET",
+    "HEAD",
+    "MKCALENDAR",
+    "MKCOL",
+    "MOVE",
+    "OPTIONS",
+    "POST",
+    "PROPFIND",
+    "PROPPATCH",
+    "PUT",
+    "REPORT",
+    "SEARCH",
+))
+
 class CalendarServerLogAnalyzer(object):
     
     class LogLine(object):
@@ -98,12 +118,21 @@
             self.client = client
             self.extended = extended
 
-    def __init__(self, startHour=None, endHour=None, resolutionMinutes=60, filterByUser=None, filterByClient=None):
+    def __init__(
+        self,
+        startHour=None,
+        endHour=None,
+        resolutionMinutes=60,
+        filterByUser=None,
+        filterByClient=None,
+        ignoreNonHTTPMethods=True,
+    ):
 
         self.startHour = startHour
         self.endHour = endHour
         self.filterByUser = filterByUser
         self.filterByClient = filterByClient
+        self.ignoreNonHTTPMethods = ignoreNonHTTPMethods
         
         self.utcStartHour = UTC_START_HOUR
         self.autoUTC = True
@@ -179,6 +208,10 @@
         
                 self.parseLine(line)
         
+                # Filter method
+                if self.ignoreNonHTTPMethods and self.currentLine.method not in httpMethods:
+                    self.currentLine.method = "???"
+
                 # Do hour ranges
                 logHour = int(self.currentLine.logTime[0:2])
                 logMinute = int(self.currentLine.logTime[3:5])
@@ -465,6 +498,8 @@
                 return "iCal/4.0.1"
             elif name == "iCal/4.0.2":
                 return "iCal/4.0.2"
+            elif name == "iCal/4.0.3":
+                return "iCal/4.0.3"
             elif name.startswith("iCal/4"):
                 return "iCal/4.?"
             elif name.startswith("iCal/5"):
@@ -483,6 +518,12 @@
                 return "iPhone/3.2"
             elif name.startswith("iPhone/3"):
                 return "iPhone/3.?"
+            elif name.startswith("iPhone/4.0"):
+                return "iPhone/4.0"
+            elif name.startswith("iPhone/4.1"):
+                return "iPhone/4.1"
+            elif name.startswith("iPhone/4.2"):
+                return "iPhone/4.2"
             elif name.startswith("iPhone/4"):
                 return "iPhone/4.?"
             else:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20100921/a8c80c3c/attachment.html>


More information about the calendarserver-changes mailing list