Ticket #1286: ugly-fix-for-1286.darcs.patch

File ugly-fix-for-1286.darcs.patch, 8.4 KB (added by davidsarah, at 2010-12-31T06:33:06Z)

Ugly, ugly fix for #1286. There must be a better way than relying on internal _-prefixed variables in Twisted. Lacks tests, do not apply yet.

Line 
11 patch for repository davidsarah@dev.allmydata.org:/home/darcs/tahoe/trunk:
2
3Fri Dec 31 06:01:28 GMT Standard Time 2010  david-sarah@jacaranda.org
4  * Ugly, ugly fix for #1286. There must be a better way than relying on internal _-prefixed variables in Twisted. Lacks tests, do not apply yet.
5
6New patches:
7
8[Ugly, ugly fix for #1286. There must be a better way than relying on internal _-prefixed variables in Twisted. Lacks tests, do not apply yet.
9david-sarah@jacaranda.org**20101231060128
10 Ignore-this: 451b4afff42954ef5ceadb0a93a4528d
11] {
12hunk ./src/allmydata/test/no_network.py 290
13                                num_servers=num_servers,
14                                client_config_hooks=client_config_hooks)
15         self.g.setServiceParent(self.s)
16-        self.client_webports = [c.getServiceNamed("webish").listener._port.getHost().port
17-                                for c in self.g.clients]
18-        self.client_baseurls = ["http://localhost:%d/" % p
19-                                for p in self.client_webports]
20+        client_services = [c.getServiceNamed("webish") for c in self.g.clients]
21+        self.client_webports = [s.get_scheme_and_port()[1] for s in client_services]
22+        self.client_baseurls = [s.get_url() for s in client_services]
23 
24     def get_clientdir(self, i=0):
25         return self.g.clients[i].basedir
26hunk ./src/allmydata/webish.py 163
27         service.MultiService.startService(self)
28         self._started.callback(None)
29 
30-    def _write_nodeurl_file(self, junk, nodeurl_path):
31-        # what is our webport?
32+    def get_scheme_and_port(self):
33         s = self.listener
34hunk ./src/allmydata/webish.py 165
35-        if isinstance(s, internet.TCPServer):
36-            base_url = "http://127.0.0.1:%d/" % s._port.getHost().port
37+        if hasattr(s, 'endpoint') and hasattr(s.endpoint, '_port'):
38+            # Twisted 10.2 or later
39+            return ((s.endpoint.__class__.__name__.startswith('SSL')) and 'https' or 'http', s.endpoint._port)
40+        elif isinstance(s, internet.TCPServer):
41+            return ('http', s._port.getHost().port)
42         elif isinstance(s, internet.SSLServer):
43hunk ./src/allmydata/webish.py 171
44-            base_url = "https://127.0.0.1:%d/" % s._port.getHost().port
45+            return ('https', s._port.getHost().port)
46+        else:
47+            return None
48+
49+    def get_url(self):
50+        scheme_and_port = self.get_scheme_and_port()
51+        if scheme_and_port:
52+            return "%s://127.0.0.1:%d/" % scheme_and_port
53         else:
54hunk ./src/allmydata/webish.py 180
55-            base_url = None
56+            return None
57+
58+    def _write_nodeurl_file(self, junk, nodeurl_path):
59+        base_url = self.get_url()
60         if base_url:
61             f = open(nodeurl_path, 'wb')
62             # this file is world-readable
63}
64
65Context:
66
67[Update foolscap version requirement to 0.6.0, to address http://foolscap.lothar.com/trac/ticket/167
68david-sarah@jacaranda.org**20101231060039
69 Ignore-this: 98d2b8086a1a500b9f4565bca5a3810
70]
71[docs/webapi.rst: typos.
72david-sarah@jacaranda.org**20101230034422
73 Ignore-this: d1f5166d72cc711f7e0d9981eac9105e
74]
75[docs/webapi.rst: capitalization, formatting of section on URL character encoding, and a correction about Internet Explorer.
76david-sarah@jacaranda.org**20101230034049
77 Ignore-this: b3b9819d2fb264b4cdc5c8afd4e8c48d
78]
79[docs: corrections and clarifications.
80david-sarah@jacaranda.org**20101227051056
81 Ignore-this: e33202858c7644c58f3f924b164294b6
82]
83[docs: more formatting cleanups and corrections. Spell webapi and wapi as web-API.
84david-sarah@jacaranda.org**20101227050533
85 Ignore-this: 18b23cbfb780df585d8a722a1ec63e94
86]
87[docs/debian.rst: bring description of building dependencies from source up-to-date, and change hostname from allmydata.com to tahoe-lafs.org.
88david-sarah@jacaranda.org**20101212222912
89 Ignore-this: f38462afc88b4475195610385a28391c
90]
91[docs/architecture.rst: correct rst syntax.
92david-sarah@jacaranda.org**20101212202003
93 Ignore-this: 3fbe12feb28bec6f1c63aedbc79aad21
94]
95[docs/architecture.rst: formatting.
96david-sarah@jacaranda.org**20101212201719
97 Ignore-this: 305fa5dfc2939355eaf6d0d2161eb1ff
98]
99[docs: linkification, wording improvements.
100david-sarah@jacaranda.org**20101212201234
101 Ignore-this: 4e67287f527a8bc728cfbd93255d2aae
102]
103[docs: formatting.
104david-sarah@jacaranda.org**20101212201115
105 Ignore-this: 2e0ed394ac7726651d3a4f2c4b0d3798
106]
107[docs/configuration.rst: more formatting tweaks; which -> that.
108david-sarah@jacaranda.org**20101212195522
109 Ignore-this: a7becb7021854ca5a90edd892b36fdd7
110]
111[docs/configuration.rst: more changes to formatting.
112david-sarah@jacaranda.org**20101212194511
113 Ignore-this: 491aac33e5f5268d224359f1447d10be
114]
115[docs/configuration.rst: changes to formatting (mainly putting commands and filenames in monospace).
116david-sarah@jacaranda.org**20101212181828
117 Ignore-this: 8a1480e2d5f43bee678476424615b50f
118]
119[scripts/backupdb.py: more accurate comment about path field.
120david-sarah@jacaranda.org**20101212170320
121 Ignore-this: 50e47a2228a85207bbcd188a78a0d4e6
122]
123[scripts/cli.py: fix missing 'put' in usage example for 'tahoe put'.
124david-sarah@jacaranda.org**20101212170207
125 Ignore-this: 2cbadf066fff611fc03d3c0ff97ce6ec
126]
127[docs/frontends/CLI.rst: changes to formatting (mainly putting commands and filenames in monospace), and to command syntax to reflect that DIRCAP/... is accepted. Clarify the syntax of 'tahoe put' and other minor corrections. Tahoe -> Tahoe-LAFS.
128david-sarah@jacaranda.org**20101212165800
129 Ignore-this: a123ef6b564aa8624d1e79c97068ea12
130]
131[docs/frontends/CLI.rst: Unicode arguments to 'tahoe' work on Windows as of v1.7.1.
132david-sarah@jacaranda.org**20101212063740
133 Ignore-this: 3977a99dfa86ac33a44171deaf43aaab
134]
135[docs/known_issues.rst: fix title and linkify another URL. refs #1225
136david-sarah@jacaranda.org**20101212062817
137 Ignore-this: cc91287f7fb51c23440b3d2fe79c449c
138]
139[docs/known_issues.rst: fix an external link. refs #1225
140david-sarah@jacaranda.org**20101212062435
141 Ignore-this: b8cbf12f353131756c358965c48060ec
142]
143[Fix a link from uri.rst to dirnodes.rst. refs #1225
144david-sarah@jacaranda.org**20101212054502
145 Ignore-this: af6205299f5c9a33229cab259c00f9d5
146]
147[Fix a link from webapi.rst to FTP-and-SFTP.rst. refs #1225
148david-sarah@jacaranda.org**20101212053435
149 Ignore-this: 2b9f88678c3447ea860d6b61e8799858
150]
151[More specific hyperlink to architecture.rst from helper.rst. refs #1225
152david-sarah@jacaranda.org**20101212052607
153 Ignore-this: 50424c768fca481252fabf58424852dc
154]
155[Update hyperlinks between docs, and linkify some external references. refs #1225
156david-sarah@jacaranda.org**20101212051459
157 Ignore-this: cd43a4c3d3de1f832abfa88d5fc4ace1
158]
159[docs/specifications/dirnodes.rst: fix references to mutable.rst. refs #1225
160david-sarah@jacaranda.org**20101212012720
161 Ignore-this: 6819b4b4e06e947ee48b365e840db37d
162]
163[docs/specifications/mutable.rst: correct the magic string for v1 mutable containers. refs #1225
164david-sarah@jacaranda.org**20101212011400
165 Ignore-this: 99a5fcdd40cef83dbb08f323f6cdaaca
166]
167[Move .txt files in docs/frontends and docs/specifications to .rst. refs #1225
168david-sarah@jacaranda.org**20101212010251
169 Ignore-this: 8796d35d928370f7dc6ad2dafdc1c0fe
170]
171[Convert docs/frontends and docs/specifications to reStructuredText format (not including file moves).
172david-sarah@jacaranda.org**20101212004632
173 Ignore-this: e3ceb2d832d73875abe48624ddbb5622
174]
175[scripts/cli.py: remove the disclaimer in the help for 'tahoe cp' that it does not handle non-ASCII filenames well. (At least, we intend to handle them.)
176david-sarah@jacaranda.org**20101130002145
177 Ignore-this: 94c003efaa20b9eb4a83503d79844ca
178]
179[relnotes.txt: fifth -> sixth labor-of-love release
180zooko@zooko.com**20101129045647
181 Ignore-this: 21c245015268b38916e3a138d256c09d
182]
183[Makefile: BB_BRANCH is set to the empty string for trunk, not the string 'trunk'.
184david-sarah@jacaranda.org**20101128233512
185 Ignore-this: 5a7ef8eb10475636d21b91e25b56c369
186]
187[relnotes.txt: eleventh -> twelfth release.
188david-sarah@jacaranda.org**20101128223321
189 Ignore-this: 1e26410156a665271c1170803dea2c0d
190]
191[relnotes.tst: point to known_issues.rst, not known_issues.txt.
192david-sarah@jacaranda.org**20101128222918
193 Ignore-this: 60194eb4544cac446fe4f60b3e34b887
194]
195[quickstart.html: fix link to point to allmydata-tahoe-1.8.1.zip.
196david-sarah@jacaranda.org**20101128221728
197 Ignore-this: 7b3ee86f8256aa12f5d862f689f3ee29
198]
199[TAG allmydata-tahoe-1.8.1
200david-sarah@jacaranda.org**20101128212336
201 Ignore-this: 9c18bdeaef4822f590d2a0d879e00621
202]
203Patch bundle hash:
20484cdd47e9d0749a835da08bfb15c2122d30013f5