9 ms·
Chrome treats DELETE requests as GET and caches them
- KirinDave 14y agoAnd the update to fix this will be pushed in 3... 2... 1...
- eranation 14y agoWhy is this bad? for example if you have an Image you want to both DELETE and GET, and have cache control, once it's cached, the DELETE will return the bytes of the image without going to the server...
- binarycrusader 14y agoBecause the HTTP 1.1 specification says it should behave differently, and developers expect clients to comply with the specification.
- eranation 14y agoSorry, I was commenting on my own post and wanted to provide an example for "why this is bad" and not ask "why is this bad" apparently, HN also teaches me English (not my native language)
- daliusd 14y agoI think RFC covers this: From http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html Section "9.1.2 Idempotent Methods". "However, it is possible that a sequence of several requests is non- idempotent, even if all of the methods executed in that sequence are idempotent." As well section "9.7 DELETE". The last sentence: Responses to this method are not cacheable. The same in human language: there is no guarantee that you are deleting the same object because its ID matches. E.g. MD5 collisions are rare but they sometimes happen.
- eloisius 14y agoI'm not sure if you're trolling or not, so I'll assume naiveté and give you a thoughtful answer: Because the resource you tried to delete will not be deleted. To add insult to injury, from a UI perspective, it will still behave like it has been. This wrecks any ajax applications that cache GET requests. Furthermore, it's in direct violation of the HTTP spec: > If the request passes through a cache and the Request-URI identifies one or more currently cached entities, those entries SHOULD be treated as stale. Responses to this method are not cacheable. [http://www.ietf.org/rfc/rfc2616.txt http://www.ietf.org/rfc/rfc2616.txt]
- thrill 14y agoSHOULD is not MUST
- piotrSikora 14y agoWhy is he being downvoted? As per RFC2119 (http://www.ietf.org/rfc/rfc2119.txt http://www.ietf.org/rfc/rfc2119.txt): 3. SHOULD This word, or the adjective "RECOMMENDED", mean that there may exist valid reasons in particular circumstances to ignore a particular item, but the full implications must be understood and carefully weighed before choosing a different course.
- masklinn 14y agoBecause the problem goes beyond failing to invalidate the existing cache for the resource (which is a SHOULD), Chrome does not even make the request, which most definitely isn't acceptable under any circumstance, even after careful considerations. The spec even emphatically says that responses to a DELETE are not cacheable, how could you use an existing cached response as valid for a DELETE if you are not allowed to cache a delete in the first place?
- zcvosdfdgj 14y agoThen there is a PERIOD, and it says "Responses to this method are not cacheable." So caching DELETE is against the spec.
- darklajid 14y agoI wonder why three people answered your question, not understanding that you - submitted the link in the first place - tried to provide an explanation why this is a bad idea (i.e. wrong) and telling you that this behavior is, in fact, not according to the specs. Communication failure? Maybe it would help to clarify your statement a bit? Edit: Reading a third and forth time I'm becoming less certain that _I_ got your point and the others didn't (note to self: That shouldn't be the default assumption). Did you really ask why that is bad? Edit 2: Looking at your username and the issue comments I kind of assume that you are the commenter over at code.google.com, calling this 'severe'. So I'm back to my original assumption that you know perfectly fine why this is bad.
- biot 14y agoThe question "Why is this bad?" can be interpreted two ways: both as "Can someone please tell me why this is bad?" and "Why is this bad, you might be wondering? Let me tell you..." Ambiguities like this are sometimes amusing, such as when a reply saying "Love it!" can be read as both "[I] love it!" and the imperative command "[You must] love it!"
- eranation 14y agoYep, bad choice of English words from my side. not may native language... yep, I was trying to explain why it's bad, not asking why it is bad... :)
- eranation 14y agoYes, bad English from my end! Please read it as "Why this is Bad: ", and not "Why is this bad?"... Thanks for all the ones who corrected me!
- zaptheimpaler 14y agoSo to clarify, the problem is that browser serves the cached copy of the response from the GET request to the user, meaning that the user will not see the possibly different response returned by the server for the DELETE request correct? I feel like I'm missing something here.
- darklajid 14y agoNo, the browser doesn't actually send the DELETE in the first place..
- corford 14y agoJust to be clear (because I feel like I'm missing something here as well): the problem is if you allow a GET to be cached and then the client makes a DELETE request on that cached resource, Chrome applies the DELETE to the cached version and doesn't propagate the request to the server??
- eranation 14y agoFrom the logs it seems to me it doesn't do a DELETE and sends a "GET (from cache)" type of request
- eranation 14y agoBy the way credit goes to Sebastian from blueimp.net (who wrote the excellent jQuery File Upload) for discovering and opening the bug initially.
- pgambling 14y agoComment 4 on the bug report cracked me up: "Obviously, google doesn't believe in deleting data."
- btipling 14y agoNo it is not funny. The comments section on an issue is not a place for jokes or otherwise unhelpful comments. It is not twitter or a comments section on a blog. Everyone on that list gets pinged whenever there is an update. This is the place to fix the bug. People should not see every single input box as an invitation to demonstrate their wit.
- rimantas 14y agoIt's good that they are pinged. Maybe they be annoyed enough to fix it.
- bokchoi 14y agoRight, the best way to get a bug fixed is to annoy the people who might fix it for you.
- slurgfest 14y agoIt also 'pings' everyone who starred/subscribed to the issue out of interest - very not cool
- SquareWheel 14y agoIt's the reason I don't star issues any more. The number of "me too!" comments is out of hand.
- _delirium 14y agoThis is one reason I tend to cringe when I see direct links to bug reports on social-media sites (like this one). Tends to end up with "angry user" posts filling up the comment thread.
- jperras 14y agoNot surprising. The amount of aggressive caching that Chrome does to make the web "faster" is excessive, not to mention infuriating. Developing a web application and using Chrome is an exercise in anger management. And then there's the bug in the dev channel where multiple assignment was just plain broken (bug report: http://code.google.com/p/chromium/issues/detail?id=136380 http://code.google.com/p/chromium/issues/detail?id=136380) Example: var foo = function() { /* foo function */ }; var bar = function() { /* bar function */ }; var baz = function() { /* baz function */ }; var sup = function() { /* sup function */ }; foo.test = bar.test = baz.test = sup; console.log(foo.test); // shows bar, not sup
- jryans 14y agoI don't think your anger about multiple assignment is valid. I also use the Dev channel regularly, but I don't think it's fair to expect it to meet a high bar of quality. Typically issues are corrected within a few days.
- masklinn 14y ago> I don't think your anger about multiple assignment is valid. He didn't express any anger about it, he just noted that it was broken. The anger he expresses is about Chrome's insanely aggressive caching (and every web dev I know agrees with that, even IE's caching was less over-the-top than Chrome's). I'm taking his note on multiple assignment more as a supplementary piece of evidence re. Chrome's quality control: how can you break something as basic as multiple assignments and get that pushed to a build?
- wickedchicken 14y agoFrom the dev channel page[1]: "While this build does get tested, it is still subject to bugs, as we want people to see what's new as soon as possible" and "Remember, Dev channel browsers and Canary builds may still crash frequently." [1] http://www.chromium.org/getting-involved/dev-channel/ http://www.chromium.org/getting-involved/dev-channel/
- T-R 14y agoChrome's excessive caching is so broken for RESTful web services that I've just given up on letting it cache any requests from Javascript. It completely ignores Vary headers, too, so hitting the back button after an AJAX request to the same URL (but with a different content-type) as a visited page displays the AJAX response (e.g., JSON) instead of the page. Worse yet, it's been marked as WONTFIX. http://code.google.com/p/chromium/issues/detail?id=94369 http://code.google.com/p/chromium/issues/detail?id=94369
- why-el 14y agoDo you have issues when developing? I have spent hours diving in my code thinking something is up before realizing it's just Chrome caching thats ignoring my changes!
- Gigablah 14y agoYeah, I have issues with Chrome caching my JS template files as well... shift-refreshing the files themselves shows the changes, but it has no effect on ajax requests.
- pasbesoin 14y agoThat's another annoying part of it for me -- or was, the last time I was doing web development a year and something ago. Getting Chrome to flush some of its caches can difficult / require "extreme" measures. (Favicons were amongst the most egregious hangers on, in what I was doing. Not a "big" problem, but very annoying.)
- lucisferre 14y agoThe Chrome developer tools have an option to turn of the cache, I never use it without that enabled. Or any other browser for that matter.
- why-el 14y agoYep, that's what I ended up doing.
- recursive 14y agoI wasn't even aware that browsers could use request methods other than GET and POST.
- ajasmin 14y agohttp://stackoverflow.com/q/165779 http://stackoverflow.com/q/165779 You can use other request methods with XMLHttpRequest. Apparently HTML5 allowed forms with PUT and DELETE for a while but this was removed from the spec.
- eranation 14y agoApparently your votes have helped, see official comment http://code.google.com/p/chromium/issues/detail?id=136320#c8 http://code.google.com/p/chromium/issues/detail?id=136320#c8 Priority was bumped
- atesti 14y agoI can only see 1,2,9-14. What was written in comment 8 and why did they hide it?
- darkhorn 14y agoAahhhaaa that's why it behaves strange when you click the back button on ExtJS documentation! Instead of the previous page I see JavaScript codes. But yeah yeah Gogole knows what he is doing, for sure!
- eranation 14y agoUpdate - a fix patch was created
- eranation 14y agoUpdate: this was fixed!