Path: csiph.com!usenet.pasdenom.info!news.etla.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed3.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.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; ';-)': 0.03; 'causing': 0.04; 'app,': 0.09; 'cherrypy': 0.09; 'http': 0.09; 'occasionally': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:Cherrypy': 0.09; 'type,': 0.09; 'anyway': 0.14; 'random': 0.14; 'begging': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'prevent': 0.16; 'wrote:': 0.18; 'trying': 0.19; 'server,': 0.19; 'header:User-Agent:1': 0.23; 'proxy': 0.24; 'sends': 0.24; "shouldn't": 0.24; 'question': 0.24; 'performing': 0.26; 'post': 0.26; 'header:X-Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'specifically': 0.29; 'rest': 0.29; 'tim': 0.29; 'matching': 0.30; "i'm": 0.30; 'requests': 0.31; 'serve': 0.31; '(although': 0.31; 'chase': 0.31; 'another': 0.32; 'running': 0.33; 'implemented': 0.33; 'but': 0.35; 'there': 0.35; 'doing': 0.36; 'application': 0.37; 'actions': 0.38; 'question,': 0.38; 'to:addr :python-list': 0.38; 'pm,': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'browser': 0.61; 'making': 0.63; 'skip:n 10': 0.64; 'more': 0.64; 'request.': 0.70; '4:26': 0.84; 'etc,': 0.84; 'effects.': 0.91; 'trouble.': 0.91 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Ned Batchelder Subject: Re: Cherrypy - prevent browser "prefetch"? Date: Mon, 01 Dec 2014 16:50:09 -0500 References: <6B74D6DD-A597-4BCF-8586-D0A56C9CDB77@ravnalaska.net> <20141201152608.09ca6f13@bigbox.christie.dr> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: 18.189.13.240 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 In-Reply-To: <20141201152608.09ca6f13@bigbox.christie.dr> 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: 30 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1417470624 news.xs4all.nl 2935 [2001:888:2000:d::a6]:56943 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:81779 On 12/1/14 4:26 PM, Tim Chase wrote: > On 2014-12-01 11:28, Israel Brewster wrote: >> I don't know if this is a cherrypy specific question (although it >> will be implemented in cherrypy for sure), or more of a general >> http protocol question, but when using cherrypy to serve a web app, >> is there anyway to prevent browser prefetch? I'm running to a >> problem, specifically from Safari on the Mac, where I start to type >> a URL, and Safari auto-fills the rest of a random URL matching what >> I started to type, and simultaneously sends a request for that URL >> to my server, occasionally causing unwanted effects. > > All this to also say that performing non-idempotent actions on a GET > request is just begging for trouble. ;-) > This is the key point: your web application shouldn't be doing these kinds of actions in response to a GET request. Make them POST requests, and Safari won't give you any trouble. Trying to stop Safari from making the GET requests might work for Safari, but then you will find another browser, or a proxy server, or an edge-caching accelerator, etc, that makes the GET requests when you don't want them. The way to indicate to a browser that it shouldn't pre-fetch a URL is to make it a POST request. -- Ned Batchelder, http://nedbatchelder.com