Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!newsreader4.netcologne.de!news.netcologne.de!bcyclone03.am1.xlned.com!bcyclone03.am1.xlned.com!newsfeed.xs4all.nl!newsfeed4a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.004 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; ';-)': 0.03; 'causing': 0.04; 'javascript,': 0.07; 'ugly': 0.07; 'app,': 0.09; 'cherrypy': 0.09; 'http': 0.09; 'occasionally': 0.09; 'subject:Cherrypy': 0.09; 'type,': 0.09; 'cc:addr:python-list': 0.11; 'anyway': 0.14; 'random': 0.14; '12:50': 0.16; 'begging': 0.16; 'fine.': 0.16; 'prevent': 0.16; 'wrote:': 0.18; 'bit': 0.19; 'trying': 0.19; 'server,': 0.19; '>>>': 0.22; 'cc:addr:python.org': 0.22; 'proxy': 0.24; 'sends': 0.24; "shouldn't": 0.24; 'question': 0.24; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; 'performing': 0.26; 'post': 0.26; 'header:In-Reply-To:1': 0.27; 'point': 0.28; 'function': 0.29; 'specifically': 0.29; 'rest': 0.29; 'skip:- 40': 0.29; 'tim': 0.29; 'dec': 0.30; 'matching': 0.30; "i'm": 0.30; 'url:mailman': 0.30; 'requests': 0.31; 'serve': 0.31; '(although': 0.31; 'chase': 0.31; 'thanks!': 0.32; 'run': 0.32; 'another': 0.32; 'url:python': 0.33; 'running': 0.33; 'implemented': 0.33; 'knowledge': 0.35; 'but': 0.35; 'there': 0.35; 'url:listinfo': 0.36; 'doing': 0.36; 'url:org': 0.36; 'application': 0.37; 'received:10': 0.37; 'actions': 0.38; 'question,': 0.38; 'pm,': 0.38; 'itself': 0.39; 'url:mail': 0.40; 'browser': 0.61; 'making': 0.63; 'header:Message-Id:1': 0.63; 'skip:n 10': 0.64; 'more': 0.64; 'charset:windows-1252': 0.65; 'difficulty': 0.68; 'request.': 0.70; 'received:12': 0.81; '2014,': 0.84; '4:26': 0.84; 'alaska': 0.84; 'batchelder': 0.84; 'etc,': 0.84; 'effects.': 0.91; 'trouble.': 0.91 X-Warning: RFC compliance checks disabled due to whitelist X-Warning: Reverse-Path DNS check skipped due to whitelist X-Warning: Maximum message size check skipped due to whitelist X-Warning: Realtime Block Lists skipped due to whitelist X-Warning: System filters skipped due to whitelist X-Warning: Domain filters skipped due to whitelist X-Warning: User filters skipped due to whitelist X-Warning: Anti-Spam check skipped due to whitelist X-Whitelist: 2147483645 X-Envelope-From: israel@ravnalaska.net X-Envelope-To: ned@nedbatchelder.com Content-Type: text/plain; charset=windows-1252 Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) Subject: Re: Cherrypy - prevent browser "prefetch"? From: Israel Brewster In-Reply-To: Date: Mon, 1 Dec 2014 13:14:46 -0900 Content-Transfer-Encoding: quoted-printable References: <6B74D6DD-A597-4BCF-8586-D0A56C9CDB77@ravnalaska.net> <20141201152608.09ca6f13@bigbox.christie.dr> To: Ned Batchelder X-Mailer: Apple Mail (2.1878.6) 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: 55 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1417472090 news.xs4all.nl 2866 [2001:888:2000:d::a6]:37442 X-Complaints-To: abuse@xs4all.nl X-Received-Bytes: 5987 X-Received-Body-CRC: 3120791245 Xref: csiph.com comp.lang.python:81782 On Dec 1, 2014, at 12:50 PM, Ned Batchelder = wrote: > 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. >>=20 >> All this to also say that performing non-idempotent actions on a GET >> request is just begging for trouble. ;-) >>=20 >=20 > 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. >=20 > 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. >=20 > The way to indicate to a browser that it shouldn't pre-fetch a URL is = to make it a POST request. Ok, that makes sense. The only difficulty I have with that answer is = that to the best of my knowledge the only way to make a HTML link do a = POST is to use the onclick function to run a javascript, while having = the "link" itself point to nothing. Just feels a bit ugly to me, but if = that's the Right Way=99 to do it, then that's fine. Thanks! >=20 > --=20 > Ned Batchelder, http://nedbatchelder.com >=20 > --=20 > https://mail.python.org/mailman/listinfo/python-list ----------------------------------------------- Israel Brewster Systems Analyst II Ravn Alaska 5245 Airport Industrial Rd Fairbanks, AK 99709 (907) 450-7293 -----------------------------------------------