MCPcopy Index your code
hub / github.com/apache/httpd / write_headers

Function write_headers

modules/cache/mod_cache_disk.c:965–1135  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

963}
964
965static apr_status_t write_headers(cache_handle_t *h, request_rec *r)
966{
967 disk_cache_conf *conf = ap_get_module_config(r->server->module_config,
968 &cache_disk_module);
969 apr_status_t rv;
970 apr_size_t amt;
971 disk_cache_object_t *dobj = (disk_cache_object_t*) h->cache_obj->vobj;
972
973 disk_cache_info_t disk_info;
974 struct iovec iov[2];
975
976 memset(&disk_info, 0, sizeof(disk_cache_info_t));
977
978 if (dobj->headers_out) {
979 const char *tmp;
980
981 tmp = apr_table_get(dobj->headers_out, "Vary");
982
983 if (tmp) {
984 apr_array_header_t* varray;
985 apr_uint32_t format = VARY_FORMAT_VERSION;
986
987 /* If we were initially opened as a vary format, rollback
988 * that internal state for the moment so we can recreate the
989 * vary format hints in the appropriate directory.
990 */
991 if (dobj->prefix) {
992 dobj->hdrs.file = dobj->prefix;
993 dobj->prefix = NULL;
994 }
995
996 rv = mkdir_structure(conf, dobj->hdrs.file, r->pool);
997 if (rv == APR_SUCCESS) {
998 rv = apr_file_mktemp(&dobj->vary.tempfd, dobj->vary.tempfile,
999 APR_CREATE | APR_WRITE | APR_BINARY | APR_EXCL,
1000 dobj->vary.pool);
1001 }
1002
1003 if (rv != APR_SUCCESS) {
1004 ap_log_rerror(APLOG_MARK, APLOG_WARNING, rv, r, APLOGNO(00721)
1005 "could not create vary file %s",
1006 dobj->vary.tempfile);
1007 return rv;
1008 }
1009
1010 amt = sizeof(format);
1011 rv = apr_file_write_full(dobj->vary.tempfd, &format, amt, NULL);
1012 if (rv != APR_SUCCESS) {
1013 ap_log_rerror(APLOG_MARK, APLOG_WARNING, rv, r, APLOGNO(00722)
1014 "could not write to vary file %s",
1015 dobj->vary.tempfile);
1016 apr_file_close(dobj->vary.tempfd);
1017 apr_pool_destroy(dobj->vary.pool);
1018 return rv;
1019 }
1020
1021 amt = sizeof(h->cache_obj->info.expire);
1022 rv = apr_file_write_full(dobj->vary.tempfd,

Callers 1

commit_entityFunction · 0.85

Calls 8

ap_get_module_configFunction · 0.85
mkdir_structureFunction · 0.85
data_fileFunction · 0.85
header_fileFunction · 0.85
tokens_to_arrayFunction · 0.70
store_arrayFunction · 0.70
regen_keyFunction · 0.70
store_tableFunction · 0.70

Tested by

no test coverage detected