Cache problems
sylvie369
Posts: 1,622
I have been working through MIke G's tutorial, and had gotten as far as making the LED turn on and off from a web page. It had been working fine, but this morning stopped working. After rechecking things, I thought to clear the browser cache, and that got it working again - exactly once. I can click once to turn the LED on, then click the off button and it turns off, and then nothing happens again until I clear the cache again. I've tried it several times, and this is now reliably how it works.
Obviously I'm not going to be able to work through the rest of the tutorial this way. Is there a way to get the browser to NOT cache the page, so it retrieves it fresh each time and the examples actually work? I'm using Firefox 3.6.24 currently, and ideally will be able to continue to do so.
Obviously I'm not going to be able to work through the rest of the tutorial this way. Is there a way to get the browser to NOT cache the page, so it retrieves it fresh each time and the examples actually work? I'm using Firefox 3.6.24 currently, and ideally will be able to continue to do so.
Comments
Also, cache is controlled in the response object.
Later: Checked, and yes, with this code loaded, I can turn the LED on once, and off once, and then I need to clear my cache to do it again. Clearing the cache does reliably get it to work again - exactly once.
The code is your program for blinking the LED, with a little additional code under the PRI methods (some in Dispatcher, and then two new methods below that). Other than that and of course the changes to the MAC, IP, Gateway, etc., it's just your stock code. I was attempting to set up a webpage by which I could turn on and off the p22 LED on one page, and on another, turn on and off p23. If you can see what I did wrong there, I'd appreciate advice on that as well - I expect to start a separate thread on that at some point.
Just checked - I get exactly the same behavior with your stock code (HTTPServer with LED, with only the MAC, IP etc. changed).
I'm at the GETing to the Server page of your tutorial. Again, I had that working just fine, reliably, but it no longer is (but see next paragraph).
This is probably important: I set the time on the RTC, and I'll bet that's related to the problem. It had been working quite reliably before I did that. I've taken a look at the code in Response, but it's way over my head. My best guess is that before I set the RTC, the time reported was late enough that the page was constantly expired, and therefore reloaded each time, but once I set the clock, that was no longer true, and the page is not expired (and therefore loads from the cache). How'd I do?
The PST output reports that everything is fine, and also reports the correct time from the RTC.
Oh, and re. telling FF not to cache a website, I can find the place where you can see a list of sites you've told it not to cache, but I can't find a way to tell it not to cache one. I imagine that the solution might be to put some kind of "NO CACHE" statement into the HTML of my page, but I don't want to do that until I've heard from someone who knows what he/she is doing.
Paul
index:
led:
ext:
Paul
Sorry, about that... there are a few things in the code base that are not explained in the tutorial.
Updated httpserv.spin in the Google repository.
I'll give this a shot, and get back here ASAP with how it goes.
(two minutes later)
Works great. Thanks. I'm sure I'll be back here with other questions. Thanks again for making this understandable.
(Later)
There does seem to be a little glitch still. Sometimes a page won't load until I click the reload button on the browser. When the page doesn't load, reload reliably brings it up, and everything works. It seems to happen with each of the three pages I have. They often load just fine the first time, but also often need that reload.