[CalendarServer-changes] [9310] CalendarServer/trunk/contrib/performance/loadtest/ical.py

source_changes at macosforge.org source_changes at macosforge.org
Tue May 29 20:14:40 PDT 2012


Revision: 9310
          http://trac.macosforge.org/projects/calendarserver/changeset/9310
Author:   cdaboo at apple.com
Date:     2012-05-29 20:14:37 -0700 (Tue, 29 May 2012)
Log Message:
-----------
Handle gzip decoding of server response.

Modified Paths:
--------------
    CalendarServer/trunk/contrib/performance/loadtest/ical.py

Modified: CalendarServer/trunk/contrib/performance/loadtest/ical.py
===================================================================
--- CalendarServer/trunk/contrib/performance/loadtest/ical.py	2012-05-30 02:32:43 UTC (rev 9309)
+++ CalendarServer/trunk/contrib/performance/loadtest/ical.py	2012-05-30 03:14:37 UTC (rev 9310)
@@ -40,7 +40,7 @@
 from twisted.python.filepath import FilePath
 from twisted.python.log import addObserver, err, msg
 from twisted.python.util import FancyEqMixin
-from twisted.web.client import Agent
+from twisted.web.client import Agent, ContentDecoderAgent, GzipDecoder
 from twisted.web.http import OK, MULTI_STATUS, CREATED, NO_CONTENT, PRECONDITION_FAILED, MOVED_PERMANENTLY,\
     FORBIDDEN
 from twisted.web.http_headers import Headers
@@ -51,9 +51,9 @@
 from uuid import uuid4
 from xml.etree import ElementTree
 
+import json
+import os
 import random
-import os
-import json
 
 ElementTree.QName.__repr__ = lambda self: '<QName %r>' % (self.text,)
 
@@ -349,7 +349,12 @@
         self._client_id = str(uuid4())
 
         self.reactor = reactor
-        self.agent = AuthHandlerAgent(Agent(self.reactor), auth)
+
+        # The server might use gzip encoding
+        agent = Agent(self.reactor)
+        agent = ContentDecoderAgent(agent, [("gzip", GzipDecoder)])
+        self.agent = AuthHandlerAgent(agent, auth)
+
         self.root = root
         self.principalPathTemplate = principalPathTemplate
         self.record = record
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20120529/c59ce437/attachment.html>


More information about the calendarserver-changes mailing list