HTTP proxy server for Motorola E815 phone in Python

Discussion in 'Python' started by Dan Lenski, Feb 22, 2007.

  1. Dan Lenski

    Dan Lenski Guest

    Hi all,
    I've recently written an HTTP proxy server for the Motorola E815 cell
    phone, based on Suzuki Hisao's "Tiny HTTP Proxy" (http://
    www.okisoft.co.jp/esc/python/proxy/). This cell phone allows free
    Internet access if you change the default proxy server, but it has a
    severely buggy HTTP client implementation which will freeze if there's
    no Content-Length header. Basically, it's impossible to read normal
    web pages without some massaging of the headers.

    So my proxy adds the correct Content-Length header and tweaks the
    response in a couple of other ways. It works great now, you can get
    the code from: http://tonquil.homeip.net/~dlenski/cellphoneproxy/
    I've MIT licensed it. It works fine as a proxy for a "normal" web
    browser too!

    One of the things I had trouble with was getting decent speed out of
    this proxy. The original "Tiny HTTP Proxy" didn't support persistent
    connections... which seriously slows down web browsing with a proxy,
    since it essentially DOUBLES the number of TCP connections that need
    to be made for each page access. So my proxy *does* support
    persistent connections, using the standard Connection or non-standard
    Proxy-Connection headers to determine whether to keep the connection
    alive or not.

    It's still not perfect though... apparently sometimes a web browser
    will SAY that it wants to keep a connection alive, and then just drop
    it. The proxy normally runs in a multi-threaded mode, and it counts
    the number of times that each connection is reused, printing this when
    the RequestHandler.finish() method is eventually called. If I force
    the proxy to run in a single thread, and use it as a proxy for
    Firefox, it will freeze up after a few page requests... the proxy will
    wait around for a new request on the same socket that never comes.

    So, my question is... is there any way to improve on this? Is there a
    way to make BaseHTTPRequestHandler detect when its connection has been
    closed by the peer without waiting for a long timeout? Is there a way
    to get the browser to always reuse a connection when it says it's
    going to? Any advice on improving the code is appreciated!

    Thanks,
    Dan Lenski
     
    Dan Lenski, Feb 22, 2007
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Zahoor
    Replies:
    1
    Views:
    817
    Darryl L. Pierce
    Nov 15, 2003
  2. Replies:
    0
    Views:
    284
  3. chen selina
    Replies:
    0
    Views:
    888
    chen selina
    Jul 7, 2010
  4. Luis Esteban Valencia

    Is there a way to develop on .net on a V220 Motorola Mobile Phone?

    Luis Esteban Valencia, Dec 14, 2004, in forum: ASP .Net Mobile
    Replies:
    1
    Views:
    136
    JuanDG
    Dec 14, 2004
  5. Rene Ivon Shamberger

    convert Phone Letters to Phone numbers

    Rene Ivon Shamberger, Dec 4, 2012, in forum: C++
    Replies:
    5
    Views:
    393
Loading...

Share This Page