do a HTTP/1.1 age calculation */
| 230 | |
| 231 | /* do a HTTP/1.1 age calculation */ |
| 232 | CACHE_DECLARE(apr_int64_t) ap_cache_current_age(cache_info *info, |
| 233 | const apr_time_t age_value, |
| 234 | apr_time_t now) |
| 235 | { |
| 236 | apr_time_t apparent_age, corrected_received_age, response_delay, |
| 237 | corrected_initial_age, resident_time, current_age, |
| 238 | age_value_usec; |
| 239 | |
| 240 | age_value_usec = apr_time_from_sec(age_value); |
| 241 | |
| 242 | /* Perform an HTTP/1.1 age calculation. (RFC2616 13.2.3) */ |
| 243 | |
| 244 | apparent_age = MAX(0, info->response_time - info->date); |
| 245 | corrected_received_age = MAX(apparent_age, age_value_usec); |
| 246 | response_delay = info->response_time - info->request_time; |
| 247 | corrected_initial_age = corrected_received_age + response_delay; |
| 248 | resident_time = now - info->response_time; |
| 249 | current_age = corrected_initial_age + resident_time; |
| 250 | |
| 251 | if (current_age < 0) { |
| 252 | current_age = 0; |
| 253 | } |
| 254 | |
| 255 | return apr_time_sec(current_age); |
| 256 | } |
| 257 | |
| 258 | /** |
| 259 | * Try obtain a cache wide lock on the given cache key. |
no outgoing calls
no test coverage detected