per RFC 2616, 13.8.
PR 15866
Trunk Patch: http://svn.apache.org/viewvc?rev=818492&view=rev
http://svn.apache.org/viewvc?rev=821763&view=rev
2.2.x Patch: http://people.apache.org/~poirier/PR15866-22x.patch
+1: poirier, rpluem, rjung, jim
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.2.x@892260
13f79535-47bb-0310-9956-
ffa450edef68
for the default values of 1024 for LdapCacheEntries/LdapOpCacheEntries.
PR 46749. [Stefan Fritsch]
+ *) mod_disk_cache, mod_mem_cache: don't cache incomplete responses,
+ per RFC 2616, 13.8. PR15866. [Dan Poirier]
+
*) mod_rewrite: Make sure that a hostname:port isn't fully qualified if
the request is a CONNECT request. PR 47928
[Bill Zajac <billz consultla.com>]
PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
[ start all new proposals below, under PATCHES PROPOSED. ]
- * mod_disk_cache, mod_mem_cache: don't cache incomplete responses,
- per RFC 2616, 13.8.
- PR 15866
- Trunk Patch: http://svn.apache.org/viewvc?rev=818492&view=rev
- http://svn.apache.org/viewvc?rev=821763&view=rev
- 2.2.x Patch: http://people.apache.org/~poirier/PR15866-22x.patch
- +1: poirier, rpluem, rjung, jim
-
* mod_filter: dispatch correctly where dispatch string doesn't exist
PR 48054
Trunk patch: n/a (trunk upgraded to use ap_expr for condition testing)
* sanity checks.
*/
if (APR_BUCKET_IS_EOS(APR_BRIGADE_LAST(bb))) {
+ const char *cl_header = apr_table_get(r->headers_out, "Content-Length");
+
if (r->connection->aborted || r->no_cache) {
ap_log_error(APLOG_MARK, APLOG_INFO, 0, r->server,
"disk_cache: Discarding body for URL %s "
file_cache_errorcleanup(dobj, r);
return APR_EGENERAL;
}
+ if (cl_header) {
+ apr_size_t cl = apr_atoi64(cl_header);
+ if ((errno == 0) && (dobj->file_size != cl)) {
+ ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
+ "disk_cache: URL %s didn't receive complete response, not caching",
+ h->cache_obj->key);
+ /* Remove the intermediate cache file and return non-APR_SUCCESS */
+ file_cache_errorcleanup(dobj, r);
+ return APR_EGENERAL;
+ }
+ }
/* All checks were fine. Move tempfile to final destination */
/* Link to the perm file, and close the descriptor */
apr_size_t len;
if (APR_BUCKET_IS_EOS(e)) {
+ const char *cl_header = apr_table_get(r->headers_out, "Content-Length");
+ if (cl_header) {
+ apr_size_t cl = apr_atoi64(cl_header);
+ if ((errno == 0) && (obj->count != cl)) {
+ ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
+ "mem_cache: URL %s didn't receive complete response, not caching",
+ h->cache_obj->key);
+ return APR_EGENERAL;
+ }
+ }
if (mobj->m_len > obj->count) {
/* Caching a streamed response. Reallocate a buffer of the
* correct size and copy the streamed response into that