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
https://forums.phpfreaks.com/topic/84718-conditional-gets/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.