Understanding http proxies

Tim Roberts timr at probo.com
Sun Oct 14 15:58:26 EDT 2012


Olive <diolu at bigfoot.com> 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.

Consider the ways HTTP could have been implemented.  Say we have a request
to get http://www.bigsite.com/pictures/index.html .

One way HTTP could have been implemented is by sending this request to the
server at www.bigsite.com:

    GET /pictures/index.html HTTP/1.0

If that were how HTTP were done, you could not implement a proxy, because
there isn't enough information for any intermediates to know where the
request had to end up.

Instead, http looks like this:

    GET /pictures/index.html HTTP/1.1
    Host: www.bigsite.com

Now, even if this is sent to someone who is not "www.bigsite.com", that
receipient can tell exactly who is supposed to get the message.

So, a web proxy receives requests intended for other sites, and forwards
them on, possibly after restricting or modifying them.  That's it.
-- 
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.



More information about the Python-list mailing list