diff --git foolscap/negotiate.py foolscap/negotiate.py
index f74daba..ac8e9cb 100644
|
|
class Negotiation(protocol.Protocol): |
329 | 329 | # we are using an encrypted Tub is separate, and expressed in our |
330 | 330 | # Hello block. |
331 | 331 | req = [] |
| 332 | proxyPrefix = '' |
| 333 | if 'http-proxy' in self.tub.options: |
| 334 | proxyPrefix = 'http://' + self.targetHost |
| 335 | self.log("sendPlaintextClient: using HTTP Proxy %s" |
| 336 | % self.tub.options['http-proxy']) |
332 | 337 | if self.target.encrypted: |
333 | 338 | self.log("sendPlaintextClient: GET for tubID %s" % |
334 | 339 | self.target.tubID) |
335 | | req.append("GET /id/%s HTTP/1.1" % self.target.tubID) |
| 340 | req.append("GET %s/id/%s HTTP/1.1" % (proxyPrefix, self.target.tubID)) |
336 | 341 | else: |
337 | 342 | self.log("sendPlaintextClient: GET for no tubID") |
338 | | req.append("GET /id/ HTTP/1.1") |
| 343 | req.append("GET %s/id/ HTTP/1.1" % proxyPrefix) |
339 | 344 | req.append("Host: %s" % self.targetHost) |
340 | 345 | self.log("sendPlaintextClient: wantEncryption=%s" % self.wantEncryption) |
341 | 346 | if self.wantEncryption: |
… |
… |
class TubConnector(object): |
1353 | 1358 | if location in self.attemptedLocations: |
1354 | 1359 | continue |
1355 | 1360 | self.attemptedLocations.append(location) |
1356 | | host, port = location |
| 1361 | if 'http-proxy' in self.tub.options: |
| 1362 | host, port = self.tub.options['http-proxy'].split(':') |
| 1363 | destination = location[0] |
| 1364 | else: |
| 1365 | host, port = location |
| 1366 | destination = host |
1357 | 1367 | lp = self.log("connectTCP to %s" % (location,)) |
1358 | | f = TubConnectorClientFactory(self, host, lp) |
1359 | | c = reactor.connectTCP(host, port, f) |
| 1368 | f = TubConnectorClientFactory(self, destination, lp) |
| 1369 | c = reactor.connectTCP(host, int(port), f) |
1360 | 1370 | self.pendingConnections[f] = c |
1361 | 1371 | # the tcp.Connector that we get back from reactor.connectTCP will |
1362 | 1372 | # retain a reference to the transport that it creates, so we can |
diff --git foolscap/pb.py foolscap/pb.py
index 83a3e06..d742ff4 100644
|
|
class Tub(service.MultiService): |
205 | 205 | connection negotiation. Currently defined keys are: |
206 | 206 | - debug_slow: if True, wait half a second between |
207 | 207 | each negotiation response |
| 208 | - http-proxy: if set, connect using this HTTP proxy |
208 | 209 | |
209 | 210 | @ivar brokers: maps TubIDs to L{Broker} instances |
210 | 211 | |
… |
… |
class Tub(service.MultiService): |
359 | 360 | self.setLogGathererFURL(value) |
360 | 361 | elif name == "log-gatherer-furlfile": |
361 | 362 | self.setLogGathererFURLFile(value) |
| 363 | elif name == "http-proxy": |
| 364 | self.options['http-proxy'] = value |
362 | 365 | elif name == "bridge-twisted-logs": |
363 | 366 | assert value is not False, "cannot unbridge twisted logs" |
364 | 367 | if value is True: |