Understanding http proxies

Discussion in 'Python' started by Olive, Oct 13, 2012.

  1. Olive

    Olive Guest

    I am trying to understand how to build an http proxy server in python,
    and I have found the following example:

    http://www.oki-osk.jp/esc/python/proxy/

    But I do not have found an exact description of what exactly a proxy
    server is suppose to do (all references gice only the basic principe of
    proxy that I know). In the following model

    Client <-> Proxy <-> Server

    it seems when I read the code above that the proxy acts mostly as an
    orinary server with respect to the client except that it is supposed to
    receive the full URL instead of just the path. Am I right? Is there any
    documentation on what an http proxy is supposed to implement.

    Olive
     
    Olive, Oct 13, 2012
    #1
    1. Advertising

  2. On Sun, Oct 14, 2012 at 5:43 AM, Olive <> wrote:
    > it seems when I read the code above that the proxy acts mostly as an
    > orinary server with respect to the client except that it is supposed to
    > receive the full URL instead of just the path. Am I right? Is there any
    > documentation on what an http proxy is supposed to implement.


    The easiest way to test this is to knock together a quick little
    server, set your browser to use localhost as a proxy, and see what
    requests you get.

    You're correct as regards most requests, but HTTPS is more
    complicated. All your proxy will see is a CONNECT request; you have to
    accept or deny on the basis of address alone, you don't get the whole
    URL (for obvious reasons). But that aside, yes, you'll normally get a
    request that looks pretty similar to what the origin server would get.

    ahh, happy memories of MUDding through a local proxy that permitted
    CONNECT on more ports than 443... and even happier memories of getting
    port 23 opened to direct access, hehe...

    ChrisA
     
    Chris Angelico, Oct 13, 2012
    #2
    1. Advertising

  3. On 13Oct2012 20:43, Olive <> wrote:
    | I am trying to understand how to build an http proxy server in python,
    | and I have found the following example:
    | http://www.oki-osk.jp/esc/python/proxy/
    |
    | But I do not have found an exact description of what exactly a proxy
    | server is suppose to do (all references gice only the basic principe of
    | proxy that I know). In the following model
    |
    | Client <-> Proxy <-> Server
    |
    | it seems when I read the code above that the proxy acts mostly as an
    | orinary server with respect to the client except that it is supposed to
    | receive the full URL instead of just the path. Am I right? Is there any
    | documentation on what an http proxy is supposed to implement.

    As mentioned elsewhere, in HTTP 1.0 you get a full URL in the opening
    line.

    In HTTP 1.1 you get the path component in the opening line and the host
    part in the Host: header of the request.

    Have a read of RFC2616 (which defines HTTP 1.0):

    http://tools.ietf.org/html/rfc2616

    It has sections on proxies, too, outlining which they must do beyond
    what a plain HTTP server must do (not much, but a few things, and there
    are proxy-specific authentication fields available too):

    Proxy Servers
    http://tools.ietf.org/html/rfc2616#section-8.1.3

    Proxy Authenticate
    http://tools.ietf.org/html/rfc2616#section-14.33

    Cheers,
    --
    Cameron Simpson <>

    There's two kinds of climbers...smart ones, and dead ones. - Don Whillans
     
    Cameron Simpson, Oct 15, 2012
    #3
  4. Olive

    Olive Guest

    Thank you for all yours answers. There are very usefull!

    Olive
     
    Olive, Oct 15, 2012
    #4
    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. Ryan
    Replies:
    0
    Views:
    334
  2. Chris Smith

    Java HTTP proxies fail open?

    Chris Smith, Jul 18, 2005, in forum: Java
    Replies:
    1
    Views:
    514
    Acidus
    Jul 18, 2005
  3. BobSmith
    Replies:
    2
    Views:
    659
    BobSmith
    Aug 8, 2005
  4. Alan Kennedy
    Replies:
    0
    Views:
    374
    Alan Kennedy
    Jul 2, 2009
  5. Lennon Day-Reynolds

    SOAP4R+WSDL+HTTP proxies?

    Lennon Day-Reynolds, Aug 13, 2004, in forum: Ruby
    Replies:
    2
    Views:
    346
    Lennon Day-Reynolds
    Aug 14, 2004
Loading...

Share This Page