Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #81775
| Newsgroups | comp.lang.python |
|---|---|
| Date | 2014-12-01 12:41 -0800 |
| References | <mailman.16468.1417465731.18130.python-list@python.org> |
| Message-ID | <850a70bb-f065-42e7-8c3f-9f2d6e58eee4@googlegroups.com> (permalink) |
| Subject | Re: Cherrypy - prevent browser "prefetch"? |
| From | sohcahtoa82@gmail.com |
On Monday, December 1, 2014 12:29:04 PM UTC-8, 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. > > > For example, I have a URL on my Cherrypy app that updates some local caches. It is accessed at http://<server>/admin/updatecaches So if I start typing http://<server>/a, for example, safari may auto-fill the "dmin/updatecaches", and trigger a cache refresh on the server - even though I was just trying to get to the main admin page at /admin. Or, it might auto-fill "uth/logout" instead (http://<server>/auth/logout), and log me out of my session. While the former may be acceptable (after all, a cache update, even if not strictly needed, is at least non-harmfull), the latter could cause serious issues with usability. So how can cherrypy tell the difference between the "prefetch" and an actual request, and not respond to the prefetch? > > > > > > ----------------------------------------------- > > Israel Brewster > > Systems Analyst II > > Ravn Alaska > > 5245 Airport Industrial Rd > > Fairbanks, AK 99709 > > (907) 450-7293 > > ----------------------------------------------- That sounds like a seriously misbehaving client to me. Your browser should not be sending requests until the user actually chooses a URL to open. The only thing I would suggest is to check the HTTP request headers (cherrypy.request.headers) of a genuine request versus one made by the automatic URL completion. If there are different headers, such as maybe an "X-Prefetch: True" or something, you could check for that.
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Cherrypy - prevent browser "prefetch"? Israel Brewster <israel@ravnalaska.net> - 2014-12-01 11:28 -0900
Re: Cherrypy - prevent browser "prefetch"? sohcahtoa82@gmail.com - 2014-12-01 12:41 -0800
Re: Cherrypy - prevent browser "prefetch"? Nobody <nobody@nowhere.invalid> - 2014-12-02 21:05 +0000
Re: Cherrypy - prevent browser "prefetch"? John Gordon <gordon@panix.com> - 2014-12-02 21:41 +0000
Re: Cherrypy - prevent browser "prefetch"? Nobody <nobody@nowhere.invalid> - 2014-12-03 16:09 +0000
csiph-web