Forum Moderators: coopster

Message Too Old, No Replies

PEAR cache_lite causes some style sheets not to load?

         

jamie

12:41 pm on Sep 8, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



hi,

i am sorry for the title, but i am not sure how else to describe the problem i am having.

i use PEAR's Cache_Lite class to catch my entire html output before sending to the browser.

i load two style sheets in the head of each cached page. here is the problem:

** when i refresh the page, the loading hangs for a bit, and then displays with just the 1st style sheet loaded. if i refresh the page, the second style sheet is loaded instead of the first.

only when i press Ctrl + F5 to download a new version of the page, does the page display with both style sheets correctly.

(f.y.i the page which is displayed is the cached version of the page every time).

** i have tested this with non-cached pages, and it only occures when the cache_lite class is used to display a cached version of the page.

i am at my wits end. this happens in both FF and IE browsers. does anyone have any ideas to point me towards?

much obliged!

coopster

10:38 pm on Sep 16, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



In situations like this I will have a look at the headers being sent back and compare the *bad* to the *good* and note differences. Have you tried that yet?

jamie

11:41 am on Sep 17, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



hi coopster,

i have just come to that conclusion myself (after lots of testing. so i came back to my post to resurrect it and see that you suggested exactly that ;)

thanks again for taking the time to answer this buried post.

here are the 'bad' headers:

Date: Sat, 17 Sep 2005 10:11:40 GMT
Server: Apache/1.3.26
P3P: policyref="http://www.example.com/w3c/p3p.xml"
Last-Modified: Sat, 17 Sep 2005 10:52:08 GMT
Etag: "859f19357c3b6b9bffadfe26fda8ea0b"
Content-Length: 13426
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: text/html; charset=iso-8859-1
200 OK

here are the 'good' headers

Date: Sat, 17 Sep 2005 10:15:30 GMT
Server: Apache/1.3.26
P3P: policyref="http://www.example.com/w3c/p3p.xml"
Last-Modified: Sat, 17 Sep 2005 10:15:20 GMT
Etag: "37002c-2a05-432becb8"
Accept-Ranges: bytes
Content-Length: 10757
Keep-Alive: timeout=5, max=87
Connection: Keep-Alive
Content-Type: text/html; charset=iso-8859-1
200 OK

the Accept-Ranges: bytes is the missing header. sure enough, if i manually send this header with my script, the style sheets are loaded correctly.

i have also identified why the page hangs in mid-load. it is because i am using the $Cache_Lite->lastModified(); function to fetch the timestamp for the last-modified time of page.

in the Cache_Lite docs they specifically say "This function can not be called statically." - i expect that is the reason why!

much appreciated

[edited by: coopster at 5:22 pm (utc) on Sep. 17, 2005]
[edit reason] generalized url upon request from jamie [/edit]