You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by pq...@apache.org on 2010/04/28 01:26:13 UTC

svn commit: r938719 - /incubator/libcloud/trunk/libcloud/base.py

Author: pquerna
Date: Tue Apr 27 23:26:12 2010
New Revision: 938719

URL: http://svn.apache.org/viewvc?rev=938719&view=rev
Log:
Only set the content length of the data in a request after we have encoded it.

Submitted by: Eric Woods <woodstae gmail.com>

Modified:
    incubator/libcloud/trunk/libcloud/base.py

Modified: incubator/libcloud/trunk/libcloud/base.py
URL: http://svn.apache.org/viewvc/incubator/libcloud/trunk/libcloud/base.py?rev=938719&r1=938718&r2=938719&view=diff
==============================================================================
--- incubator/libcloud/trunk/libcloud/base.py (original)
+++ incubator/libcloud/trunk/libcloud/base.py Tue Apr 27 23:26:12 2010
@@ -409,12 +409,12 @@ class ConnectionKey(object):
         # Extend default headers
         headers = self.add_default_headers(headers)
         # We always send a content length and user-agent header
-        headers.update({'Content-Length': len(data)})
         headers.update({'User-Agent': self._user_agent()})
         headers.update({'Host': self.host})
         # Encode data if necessary
         if data != '':
             data = self.encode_data(data)
+        headers.update({'Content-Length': len(data)})
         url = '?'.join((action, urllib.urlencode(params)))
         
         # Removed terrible hack...this a less-bad hack that doesn't execute a