[CalendarServer-changes] [4566] CalendarServer/branches/users/wsanchez/deployment/twistedcaldav

source_changes at macosforge.org source_changes at macosforge.org
Thu Oct 1 17:15:06 PDT 2009


Revision: 4566
          http://trac.macosforge.org/projects/calendarserver/changeset/4566
Author:   cdaboo at apple.com
Date:     2009-10-01 17:15:03 -0700 (Thu, 01 Oct 2009)
Log Message:
-----------
Add extended logging for content-length on PUT and POST. Add extended logging for auto-accept attendees
in iTIP REQUESTs.

Modified Paths:
--------------
    CalendarServer/branches/users/wsanchez/deployment/twistedcaldav/method/put.py
    CalendarServer/branches/users/wsanchez/deployment/twistedcaldav/schedule.py

Modified: CalendarServer/branches/users/wsanchez/deployment/twistedcaldav/method/put.py
===================================================================
--- CalendarServer/branches/users/wsanchez/deployment/twistedcaldav/method/put.py	2009-09-30 21:47:34 UTC (rev 4565)
+++ CalendarServer/branches/users/wsanchez/deployment/twistedcaldav/method/put.py	2009-10-02 00:15:03 UTC (rev 4566)
@@ -53,6 +53,9 @@
             d = waitForDeferred(allDataFromStream(request.stream))
             yield d
             calendardata = d.getResult()
+            if not hasattr(request, "extendedLogItems"):
+                request.extendedLogItems = {}
+            request.extendedLogItems["cl"] = str(len(calendardata))
 
             # We must have some data at this point
             if calendardata is None:
@@ -79,6 +82,16 @@
     else:
         d = waitForDeferred(super(CalDAVFile, self).http_PUT(request))
         yield d
-        yield d.getResult()
+        result = d.getResult()
 
+        if not hasattr(request, "extendedLogItems"):
+            request.extendedLogItems = {}
+        clength = request.headers.getHeader("content-length", 0)
+        if clength == 0:
+            clength = self.fp.getsize()
+        request.extendedLogItems["cl"] = str(clength)
+
+        yield result
+        return
+
 http_PUT = deferredGenerator(http_PUT)

Modified: CalendarServer/branches/users/wsanchez/deployment/twistedcaldav/schedule.py
===================================================================
--- CalendarServer/branches/users/wsanchez/deployment/twistedcaldav/schedule.py	2009-09-30 21:47:34 UTC (rev 4565)
+++ CalendarServer/branches/users/wsanchez/deployment/twistedcaldav/schedule.py	2009-10-02 00:15:03 UTC (rev 4566)
@@ -320,6 +320,7 @@
         # Parse the calendar object from the HTTP request stream
         try:
             calendar = yield Component.fromIStream(request.stream)
+            calendardata = str(calendar)
         except:
             self.log_error("Error while handling POST: %s" % (Failure(),))
             raise HTTPError(ErrorResponse(responsecode.FORBIDDEN, (caldav_namespace, "valid-calendar-data")))
@@ -422,7 +423,7 @@
                 emitAccounting(
                     "iTIP-VFREEBUSY", organizerPrincipal,
                     "Originator: %s\nRecipients: %s\n\n%s"
-                    % (originator, ", ".join(recipients), str(calendar))
+                    % (originator, ", ".join(recipients), calendardata)
                 )
             request.extendedLogItems["freebusy"] = len(recipients)
     
@@ -431,9 +432,10 @@
                 emitAccounting(
                     "iTIP", organizerPrincipal,
                     "Originator: %s\nRecipients: %s\n\n%s"
-                    % (originator, ", ".join(recipients), str(calendar))
+                    % (originator, ", ".join(recipients), calendardata)
                 )
             request.extendedLogItems["itip.%s" % (calendar.propertyValue("METHOD").lower(),)] = len(recipients)
+        request.extendedLogItems["cl"] = str(len(calendardata))
 
         # Prepare for multiple responses
         responses = ScheduleResponseQueue("POST", responsecode.OK)
@@ -558,7 +560,7 @@
                 
                 else:
                     # Hash the iCalendar data for use as the last path element of the URI path
-                    name = md5.new(str(calendar) + str(time.time()) + inbox.fp.path).hexdigest() + ".ics"
+                    name = md5.new(calendardata + str(time.time()) + inbox.fp.path).hexdigest() + ".ics"
                 
                     # Get a resource for the new item
                     childURL = joinURL(inboxURL, name)
@@ -572,7 +574,7 @@
                             sourcecal = False,
                             destination = child,
                             destination_uri = childURL,
-                            calendardata = str(calendar),
+                            calendardata = calendardata,
                             destinationparent = inbox,
                             destinationcal = True,
                             isiTIP = True
@@ -601,6 +603,8 @@
             # First check that we have a method that we can auto-respond to
             if not itip.canAutoRespond(calendar):
                 autoresponses = []
+            else:
+                request.extendedLogItems["itip.auto"] = len(autoresponses)
             
         # Now do the actual auto response
         for principal, inbox, child in autoresponses:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20091001/a9f77f87/attachment.html>


More information about the calendarserver-changes mailing list