From a093a615e5253c10bccf132138d4a8f29c64b7e5 Mon Sep 17 00:00:00 2001
From: Itamar Turner-Trauring <itamar@futurefoundries.com>
Date: Thu, 16 May 2013 13:53:35 -0400
Subject: [PATCH] Actually run the creation code against real Azure service,
 and corresponding bug fix.

---
 .../backends/cloud/msazure/msazure_container.py        | 10 +++++++++-
 src/allmydata/test/test_storage.py                     |  3 +++
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/src/allmydata/storage/backends/cloud/msazure/msazure_container.py b/src/allmydata/storage/backends/cloud/msazure/msazure_container.py
index 11303d05..c2936b04 100644
--- a/src/allmydata/storage/backends/cloud/msazure/msazure_container.py
+++ b/src/allmydata/storage/backends/cloud/msazure/msazure_container.py
@@ -221,7 +221,8 @@ class MSAzureStorageContainer(CommonContainerMixin):
         url = self._make_container_url(self.URI)
         url += "?restype=container"
         d = self._authorized_http_request("MS Azure PUT container", 'PUT',
-                                          url, {}, body=None,
+                                          url, {'Content-length': ['0']},
+                                          body=None,
                                           need_response_body=False)
         d.addCallback(lambda (response, body): body)
         return d
@@ -245,6 +246,13 @@ if __name__ == '__main__':
 
     @defer.inlineCallbacks
     def testtransactions():
+        print "Creating container...",
+        try:
+            yield msc.create()
+        except Exception, e:
+            print "failed:", e
+        else:
+            print "succeeded."
         yield msc.put_object("key", "the value")
         print "Uploaded 'key', with value 'the value'"
         print
diff --git a/src/allmydata/test/test_storage.py b/src/allmydata/test/test_storage.py
index 2b7843eb..e0e6c0fd 100644
--- a/src/allmydata/test/test_storage.py
+++ b/src/allmydata/test/test_storage.py
@@ -1522,6 +1522,9 @@ class MSAzureStorageBackendTests(unittest.TestCase, CloudStorageBackendMixin):
             "MS Azure PUT container", "PUT",
             "https://theaccount.blob.core.windows.net/thebucket?restype=container",
             {"Authorization": [self.authorization],
+             # This is not documented as required, but is apparently necessary
+             # nonetheless:
+             'Content-length': ['0'],
              "x-ms-version": ["2012-02-12"],
              "x-ms-date": [self.date],
              },
-- 
2.45.2