...

View Full Version : conditional Get implementation



autotech
07-18-2009, 10:29 PM
1) Project Details: (be as specific as possible): I have deflate compression set up through my Apache server, but I'm unfamiliar with setting up the "conditional GET". Need someone to do the task or walk me through it.

2) Payment Amount: Not sure. Seems to be a small job. $50?

3) Payment method/ details (Paypal, check? Timeline?): Paypal

4) Additional Info (about project or potential bidders): Would like someone very familair with the task.

it career
07-20-2009, 08:46 AM
1) Project Details: (be as specific as possible): I have deflate compression set up through my Apache server, but I'm unfamiliar with setting up the "conditional GET". Need someone to do the task or walk me through it.

2) Payment Amount: Not sure. Seems to be a small job. $50?

3) Payment method/ details (Paypal, check? Timeline?): Paypal

4) Additional Info (about project or potential bidders): Would like someone very familair with the task.
Here is the code for conditionalGet.


function doConditionalGet($timestamp) {
// A PHP implementation of conditional get, see
// http://fishbowl.pastiche.org/archives/001132.html
$last_modified = substr(date('r', $timestamp), 0, -5).'GMT';
$etag = '"'.md5($last_modified).'"';
// Send the headers
header("Last-Modified: $last_modified");
header("ETag: $etag");
// See if the client has provided the required headers
$if_modified_since = isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) ?
stripslashes($_SERVER['HTTP_IF_MODIFIED_SINCE']) :
false;
$if_none_match = isset($_SERVER['HTTP_IF_NONE_MATCH']) ?
stripslashes($_SERVER['HTTP_IF_NONE_MATCH']) :
false;
if (!$if_modified_since && !$if_none_match) {
return;
}
// At least one of the headers is there - check them
if ($if_none_match && $if_none_match != $etag) {
return; // etag is there but doesn't match
}
if ($if_modified_since && $if_modified_since != $last_modified) {
return; // if-modified-since is there but doesn't match
}
// Nothing has changed since their last request - serve a 304 and exit
header('HTTP/1.0 304 Not Modified');
exit;
}



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum