~awsome-core/ubuntu/precise/txaws/drop-patches

« back to all changes in this revision

Viewing changes to debian/patches/fix-s3-alternate-port.patch

  • Committer: Jelmer Vernooij
  • Date: 2012-01-18 21:52:00 UTC
  • Revision ID: jelmer@ubuntu.com-20120118215200-4g1ssem1lv135lwh
Drop some patches broken against trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
From: Clint Byrum <clint@ubuntu.com>
2
 
Description: Makes txaws use alternate port in S3 URL
3
 
Bug: http://pad.lv/824403
4
 
Origin: https://code.launchpad.net/~clint-fewbar/txaws/fix-s3-port/+merge/71289
5
 
Forwarded: yes
6
 
 
7
 
=== modified file 'txaws/s3/client.py'
8
 
--- a/txaws/s3/client.py        2011-04-14 19:50:30 +0000
9
 
+++ b/txaws/s3/client.py        2011-08-29 19:06:23 +0000
10
 
@@ -57,8 +57,12 @@
11
 
         return path
12
 
 
13
 
     def get_url(self):
14
 
-        return "%s://%s%s" % (
15
 
-            self.endpoint.scheme, self.get_host(), self.get_path())
16
 
+        if self.endpoint.port is not None:
17
 
+            return "%s://%s:%d%s" % (
18
 
+                self.endpoint.scheme, self.get_host(), self.endpoint.port, self.get_path())
19
 
+        else:
20
 
+            return "%s://%s%s" % (
21
 
+                self.endpoint.scheme, self.get_host(), self.get_path())
22
 
 
23
 
 
24
 
 class S3Client(BaseClient):
25
 
 
26
 
=== modified file 'txaws/s3/tests/test_client.py'
27
 
--- a/txaws/s3/tests/test_client.py     2011-04-14 19:50:30 +0000
28
 
+++ b/txaws/s3/tests/test_client.py     2011-08-29 19:06:23 +0000
29
 
@@ -62,6 +62,29 @@
30
 
             url_context.get_url(),
31
 
             "http://localhost/mydocs/notes.txt")
32
 
 
33
 
+    def test_custom_port_endpoint(self):
34
 
+        test_uri='http://0.0.0.0:12345/'
35
 
+        endpoint = AWSServiceEndpoint(uri=test_uri)
36
 
+        self.assertEquals(endpoint.port, 12345)
37
 
+        self.assertEquals(endpoint.scheme, 'http')
38
 
+        context = client.URLContext(service_endpoint=endpoint,
39
 
+                bucket="foo",
40
 
+                object_name="bar")
41
 
+        self.assertEquals(context.get_host(), '0.0.0.0')
42
 
+        self.assertEquals(context.get_url(), test_uri + 'foo/bar')
43
 
+
44
 
+    def test_custom_port_endpoint_https(self):
45
 
+        test_uri='https://0.0.0.0:12345/'
46
 
+        endpoint = AWSServiceEndpoint(uri=test_uri)
47
 
+        self.assertEquals(endpoint.port, 12345)
48
 
+        self.assertEquals(endpoint.scheme, 'https')
49
 
+        context = client.URLContext(service_endpoint=endpoint,
50
 
+                bucket="foo",
51
 
+                object_name="bar")
52
 
+        self.assertEquals(context.get_host(), '0.0.0.0')
53
 
+        self.assertEquals(context.get_url(), test_uri + 'foo/bar')
54
 
+
55
 
+
56
 
 URLContextTestCase.skip = s3clientSkip
57
 
 
58
 
 
59