Jump to content

Conditional GETs


LoggedIn

Recommended Posts

Hello. I'm trying to make a script of mine cacheable because it's not going to change often and it is expected to be quite large. As well, as reduce load on my server.

 

Since dates aren't stored in the database the script uses, I'm using an ETag for the cache header information. I have the basics set up fine. The script currently uses the $_SEVER['IF_NONE_MATCH'] global to check if a single ETag matches.

 

The trouble is that the script doesn't obey the RFC 2616 specs very well. I wish to have it work as if the script was a static file. The problems is that the script doesn't do any checking for the headers; If-Match & If-Range which is required for conditional GETs.

 

While I could code the If-Match without difficultly, I haven't got a clue about getting If-Range working as it should. So does anyone know a library or a code snippet for PHP that'll handle the cache headers correctly?

 

mod_perl has an function called meets_conditions() that'll apparently handle all the cache information once it's set, which is exactly what I'm looking for. PHP doesn't offer something like this does it?

 

Huge thanks to any replies.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.