You need to make some changes to urlfetch_stub.py and
dev_appserver.py:
urlfetch_stub.py fragment: (I will leave the diff as the exercise for
the reader)
try:
if protocol == 'http':
proxy = os.getenv("http_proxy")
if proxy:
if proxy.startswith('http://'): host_and_port = proxy[7:]
from urllib import splitport
proxy_host, proxy_port = splitport(host_and_port)
connection = httplib.HTTPConnection(proxy_host,
proxy_port)
else:
connection = httplib.HTTPConnection(host)
elif protocol == 'https':
proxy = os.getenv("https_proxy")
if proxy:
if proxy.startswith('https://'): host_and_port = proxy[8:]
from urllib import splitport
proxy_host, proxy_port = splitport(host_and_port)
connection = httplib.HTTPConnection(proxy_host,
proxy_port)
else:
connection = httplib.HTTPSConnection(host)
else:
error_msg = 'Redirect specified invalid protocol: "%s"' %
protocol
a bit lower down:
try:
socket.setdefaulttimeout(deadline)
if proxy: full_path = protocol + "://" + host + full_path
connection.request(method, full_path, payload,
adjusted_headers)
http_response = connection.getresponse()
And from dev_appserver.py:
import io
...
'SERVER_PROTOCOL': self.protocol_version,
'SERVER_PORT': str(self.server.server_port),
'HTTP_PROXY' : os.environ['http_proxy'],
'HTTPS_PROXY' : os.environ['https_proxy'],
}
Note that these are not mine, a few other kind folks posted these on
the enhancement request for this.
Works like a charm with Charles now :)
J
On Feb 15, 8:02 pm, mattb <[email protected]> wrote:
> Hello,
> I need to peek at the HTTPS traffic generated by my local instance
> of the app-server when debugging.
>
> How do I configure the local appengine instance to use to a http
> proxy for it's web requests? Or is there a way to configure a proxy
> to employed by urlfetch using the urlfetch API (I didn't see anything
> in the docs)
>
> I use Charles on OS-X to peek at web traffic, and it's "OS-X Proxy"
> capture doesn't pick up the urlfetch's I am calling in my Python
> appengine app.
>
> - mattb
>
> PS: I can't simply sniff the packets because my request is HTTPS and I
> need Charles or something that understands HTTPS to decrypt the
> traffic for me.
--
You received this message because you are subscribed to the Google Groups
"Google App Engine" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-appengine?hl=en.