| 1325 | } |
| 1326 | |
| 1327 | static apr_status_t commit_entity(cache_handle_t *h, request_rec *r) |
| 1328 | { |
| 1329 | disk_cache_conf *conf = ap_get_module_config(r->server->module_config, |
| 1330 | &cache_disk_module); |
| 1331 | disk_cache_object_t *dobj = (disk_cache_object_t *) h->cache_obj->vobj; |
| 1332 | apr_status_t rv; |
| 1333 | |
| 1334 | /* write the headers to disk at the last possible moment */ |
| 1335 | rv = write_headers(h, r); |
| 1336 | |
| 1337 | /* move header and data tempfiles to the final destination */ |
| 1338 | if (APR_SUCCESS == rv) { |
| 1339 | rv = file_cache_el_final(conf, &dobj->hdrs, r); |
| 1340 | } |
| 1341 | if (APR_SUCCESS == rv) { |
| 1342 | rv = file_cache_el_final(conf, &dobj->vary, r); |
| 1343 | } |
| 1344 | if (APR_SUCCESS == rv) { |
| 1345 | if (!dobj->disk_info.header_only) { |
| 1346 | rv = file_cache_el_final(conf, &dobj->data, r); |
| 1347 | } |
| 1348 | else if (dobj->data.file) { |
| 1349 | rv = apr_file_remove(dobj->data.file, dobj->data.pool); |
| 1350 | } |
| 1351 | } |
| 1352 | |
| 1353 | /* remove the cached items completely on any failure */ |
| 1354 | if (APR_SUCCESS != rv) { |
| 1355 | remove_url(h, r); |
| 1356 | ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(00736) |
| 1357 | "commit_entity: URL '%s' not cached due to earlier disk error.", |
| 1358 | dobj->name); |
| 1359 | } |
| 1360 | else { |
| 1361 | ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(00737) |
| 1362 | "commit_entity: Headers and body for URL %s cached.", |
| 1363 | dobj->name); |
| 1364 | } |
| 1365 | |
| 1366 | apr_pool_destroy(dobj->data.pool); |
| 1367 | |
| 1368 | return APR_SUCCESS; |
| 1369 | } |
| 1370 | |
| 1371 | static apr_status_t invalidate_entity(cache_handle_t *h, request_rec *r) |
| 1372 | { |
no test coverage detected