Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'python,': 0.02; 'example:': 0.03; 'defines': 0.07; 'suppose': 0.07; 'don': 0.09; 'path.': 0.09; 'cc:addr:python-list': 0.10; 'sections': 0.13; 'component': 0.15; 'elsewhere,': 0.16; 'from:addr:cs': 0.16; 'from:addr:zip.com.au': 0.16; 'from:name:cameron simpson': 0.16; 'host:': 0.16; 'message-id:@cskk.homeip.net': 0.16; 'proxies,': 0.16; 'received:202.125.174': 0.16; 'received:202.125.174.133': 0.16; 'received:boardofstudies.nsw.edu.au': 0.16; 'received:cskk.homeip.net': 0.16; 'received:edu.au': 0.16; 'received:harvey.boardofstudies.nsw.edu.au': 0.16; 'received:homeip.net': 0.16; 'received:nsw.edu.au': 0.16; 'simpson': 0.16; 'url:33': 0.16; 'wrote:': 0.17; '(not': 0.20; 'mostly': 0.20; 'trying': 0.21; 'supposed': 0.21; '(all': 0.22; 'http': 0.22; 'ones.': 0.22; 'cheers,': 0.23; 'cc:2**0': 0.23; 'references': 0.23; 'seems': 0.23; 'cc:no real name:2**0': 0.24; 'header': 0.24; 'host': 0.24; 'cc:addr:python.org': 0.25; 'header :In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; '(which': 0.26; 'plain': 0.27; 'things,': 0.29; 'basic': 0.30; 'code': 0.31; 'url:python': 0.32; 'ones,': 0.33; 'right?': 0.33; 'server': 0.35; 'path': 0.35; 'there': 0.35; 'except': 0.36; 'but': 0.36; 'url:org': 0.36; 'received:au': 0.36; 'client': 0.36; 'charset:us- ascii': 0.36; 'beyond': 0.37; 'subject:http': 0.37; 'two': 0.37; 'subject:: ': 0.38; 'description': 0.39; 'instead': 0.39; 'build': 0.39; 'content-disposition:inline': 0.60; 'dead': 0.62; 'mentioned': 0.63; 'respect': 0.63; 'request.': 0.64; 'receive': 0.71; 'acts': 0.71; 'much,': 0.84; 'outlining': 0.84; 'too):': 0.84; 'url:proxy': 0.84 Date: Mon, 15 Oct 2012 11:57:31 +1100 From: Cameron Simpson To: Olive Subject: Re: Understanding http proxies MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20121013204358.6d400240@pcolivier.chezmoi.net> User-Agent: Mutt/1.5.21 (2010-09-15) References: <20121013204358.6d400240@pcolivier.chezmoi.net> Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 41 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1350262654 news.xs4all.nl 6858 [2001:888:2000:d::a6]:33111 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:31270 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