[google-appengine] Re: Monitoring HTTPS traffic from app engine - running locally

2010-02-21 Thread mattb
Thanks for the fast reply.  Works like a charm.

   For posterity, link to the google change request #544:
http://code.google.com/p/googleappengine/issues/detail?id=544

On Feb 17, 3:26 am, Jan Z jan.zawad...@gmail.com wrote:
 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 tenfeet...@gmail.com 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 google-appeng...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.



[google-appengine] Monitoring HTTPS traffic from app engine - running locally

2010-02-15 Thread mattb
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 google-appeng...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.