ASF Bugzilla – Attachment 12516 Details for
Bug 21492
Bad file size in disk cache for large css files
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Proposed Patch
httpd-2.0.50-incomplete_cache.diff (text/plain), 2.86 KB, created by
Rüdiger Plüm
on 2004-08-24 08:54:48 UTC
(
hide
)
Description:
Proposed Patch
Filename:
MIME Type:
Creator:
Rüdiger Plüm
Created:
2004-08-24 08:54:48 UTC
Size:
2.86 KB
patch
obsolete
>diff -ru httpd-2.0.50.orig/modules/experimental/mod_disk_cache.c httpd-2.0.50/modules/experimental/mod_disk_cache.c >--- httpd-2.0.50.orig/modules/experimental/mod_disk_cache.c 2004-02-09 21:53:16.000000000 +0100 >+++ httpd-2.0.50/modules/experimental/mod_disk_cache.c 2004-08-18 22:28:46.000000000 +0200 >@@ -116,7 +116,8 @@ > *p = '\0'; > > rv = apr_dir_make(file, >- APR_UREAD|APR_UWRITE|APR_UEXECUTE, pool); >+ APR_UREAD|APR_UWRITE|APR_UEXECUTE| >+ APR_GREAD|APR_GWRITE|APR_GEXECUTE, pool); > if (rv != APR_SUCCESS && !APR_STATUS_IS_EEXIST(rv)) { > /* XXX */ > } >@@ -135,6 +136,24 @@ > /* move the data over */ > if (dobj->fd) { > apr_file_flush(dobj->fd); >+ /* Check if connection has been aborted. Do not rename the temporary >+ * file in this case but simply delete it. Reason: Aborted connections >+ * may lead to incomplete data files which MUST not be cached as >+ * they deliver incomplete content in future requests. >+ */ >+ if (r->connection->aborted) { >+ apr_file_close(dobj->fd); >+ dobj->fd = NULL; >+ rv = apr_file_remove(dobj->tempfile, r->pool); >+ if (rv != APR_SUCCESS) { >+ /* XXX log */ >+ } >+ ap_log_error(APLOG_MARK, APLOG_INFO, 0, r->server, >+ "cache_disk: Discarding body for URL %s " >+ "because connection has been aborted.", >+ h->cache_obj->key); >+ return APR_INCOMPLETE; >+ } > if (!dobj->datafile) { > dobj->datafile = data_file(r->pool, conf->dirlevels, conf->dirlength, > conf->cache_root, h->cache_obj->key); >@@ -631,7 +650,7 @@ > if (!dobj->fd) { > rv = apr_file_open(&dobj->fd, dobj->tempfile, > APR_WRITE | APR_CREATE | APR_BINARY| APR_TRUNCATE | APR_BUFFERED, >- APR_UREAD | APR_UWRITE, r->pool); >+ APR_OS_DEFAULT, r->pool); > if (rv != APR_SUCCESS) { > return rv; > } >@@ -643,9 +662,10 @@ > apr_file_write(dobj->fd, str, &length); > } > if (APR_BUCKET_IS_EOS(APR_BRIGADE_LAST(b))) { >- file_cache_el_final(h, r); /* Link to the perm file, and close the descriptor */ >- ap_log_error(APLOG_MARK, APLOG_INFO, 0, r->server, >- "disk_cache: Cached body for URL %s", dobj->name); >+ if (file_cache_el_final(h, r) == APR_SUCCESS) { /* Link to the perm file, and close the descriptor */ >+ ap_log_error(APLOG_MARK, APLOG_INFO, 0, r->server, >+ "disk_cache: Cached body for URL %s", dobj->name); >+ } > } > > return APR_SUCCESS;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 21492
:
7239
| 12516 |
12847