Merge lp://staging/~franciscosouza/txaws/txaws-proxysupport into lp://staging/txaws
Proposed by
Francisco Souza
Status: | Needs review |
---|---|
Proposed branch: | lp://staging/~franciscosouza/txaws/txaws-proxysupport |
Merge into: | lp://staging/txaws |
Diff against target: |
73 lines (+24/-9) 1 file modified
txaws/client/base.py (+24/-9) |
To merge this branch: | bzr merge lp://staging/~franciscosouza/txaws/txaws-proxysupport |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
txAWS Committers | Pending | ||
Review via email: mp+134896@code.staging.launchpad.net |
Description of the change
client: add support for http and https proxying
To post a comment you must log in.
Unmerged revisions
- 154. By Francisco Souza
-
client: trap PotentialDataLoss
Amazon never sends Content-Length header, even on http 1.0.
- 153. By Francisco Souza
-
client: don't pass reator to ProxyAgent
Endpoint already holds the instance of the reactor.
- 152. By Francisco Souza
-
client: add support for http and https proxying
Reviewers: mp+134896_ code.launchpad. net,
Message:
Please take a look.
Description:
client: add support for http and https proxying
https:/ /code.launchpad .net/~francisco souza/txaws/ txaws-proxysupp ort/+merge/ 134896
(do not edit description out of merge proposal)
Please review this at https:/ /codereview. appspot. com/6852064/
Affected files: base.py
A [revision details]
M txaws/client/
Index: [revision details]
=== added file '[revision details]'
--- [revision details] 2012-01-01 00:00:00 +0000
+++ [revision details] 2012-01-01 00:00:00 +0000
@@ -0,0 +1,2 @@
+Old revision: <email address hidden>
+New revision: <email address hidden>
Index: txaws/client/ base.py client/ base.py' base.py 2012-05-16 02:35:26 +0000 base.py 2012-11-19 12:56:26 +0000 ElementTree import ParseError
=== modified file 'txaws/
--- txaws/client/
+++ txaws/client/
@@ -1,3 +1,6 @@
+import os
+import urlparse
+
try:
from xml.etree.
except ImportError:
@@ -6,14 +9,14 @@
import warnings
from StringIO import StringIO
+from twisted. internet. endpoints import TCP4ClientEndpoint internet. ssl import ClientContextFa ctory internet. protocol import Protocol internet. defer import Deferred, succeed, fail web.http_ headers import Headers
self.body_ producer = FileBodyProduce r(StringIO( data)) ssl_hostname_ verification: textFactory( host) get("https_ proxy") urlparse( proxy_endpoint) int(self. reactor, endpoint, self.reactor) tFactory( ) ssl_hostname_ verification: textFactory( host) tFactory( )
self.client. url = url method, url, self.request_ headers,
self. body_producer) get("http_ proxy") urlparse( proxy_endpoint) int(self. reactor,
from twisted.
from twisted.
from twisted.
from twisted.python import failure
from twisted.web import http
from twisted.web.iweb import UNKNOWN_LENGTH
-from twisted.web.client import HTTPClientFactory
-from twisted.web.client import Agent
+from twisted.web.client import Agent, ProxyAgent
from twisted.web.client import ResponseDone
from twisted.web.http import NO_CONTENT
from twisted.
@@ -220,16 +223,28 @@
if (self.body_producer is None) and (data is not None):
if scheme == "https":
- if self.endpoint.
- contextFactory = WebVerifyingCon
+ proxy_endpoint = os.environ.
+ if proxy_endpoint:
+ proxy_url = urlparse.
+ endpoint = TCP4ClientEndpo
proxy_url.hostname, proxy_url.port)
+ agent = ProxyAgent(
else:
- contextFactory = WebClientContex
- agent = Agent(self.reactor, contextFactory)
+ if self.endpoint.
+ contextFactory = WebVerifyingCon
+ else:
+ contextFactory = WebClientContex
+ agent = Agent(self.reactor, contextFactory)
d = agent.request(
else:
- agent = Agent(self.reactor)
+ proxy_endpoint = os.environ.
+ if proxy_endpoint:
+ proxy_url = urlparse.
+ endpoint = TCP4ClientEndpo
proxy_url.hostname, proxy_url.port)
+ agent =...