Changes with Apache 2.0.43
+ *) Fix a core dump in mod_cache when it attemtped to store uncopyable
+ buckets. This happened, for instance, when a file to be cached
+ contained SSI tags to execute a CGI script (passed as a pipe
+ bucket). [Paul J. Reder]
+
*) Ensure that output already available is flushed to the network
when the content-length filter realizes that no new output will
be available for a while. This helps some streaming CGIs as
}
APR_BRIGADE_FOREACH(e, in) {
apr_bucket *copy;
- apr_bucket_copy(e, ©);
+ rv = apr_bucket_copy(e, ©);
+ if (rv == APR_ENOTIMPL) {
+ const char *str;
+ apr_size_t len;
+
+ /* This takes care of uncopyable buckets. */
+ rv = apr_bucket_read(e, &str, &len, APR_BLOCK_READ);
+ if ((rv == APR_SUCCESS) &&
+ (cache->saved_size + len <=
+ conf->max_streaming_buffer_size)) {
+ rv = apr_bucket_copy(e, ©);
+ }
+
+ if ((rv != APR_SUCCESS) ||
+ (cache->saved_size + len >
+ conf->max_streaming_buffer_size)){
+ ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
+ "cache: not caching streamed response for "
+ "%s because length %s", url,
+ "> CacheMaxStreamingBuffer");
+
+ if (cache->saved_brigade != NULL) {
+ apr_brigade_destroy(cache->saved_brigade);
+ cache->saved_brigade = NULL;
+ cache->saved_size = 0;
+ }
+ ap_remove_output_filter(f);
+ return ap_pass_brigade(f->next, in);
+ }
+ }
APR_BRIGADE_INSERT_TAIL(cache->saved_brigade, copy);
}
cache->saved_size += size;
&cache_module);
val = (apr_off_t)strtol(arg, &err, 10);
if (*err != 0) {
- return "CacheMaxStreamingBuffer value must be a percentage";
+ return "CacheMaxStreamingBuffer value must be a number";
}
conf->max_streaming_buffer_size = val;
return NULL;
obj->count+=len;
}
}
- /* This should not happen, but if it does, we are in BIG trouble
+ /* This should not fail, but if it does, we are in BIG trouble
* cause we just stomped all over the heap.
*/
- AP_DEBUG_ASSERT(obj->count >= mobj->m_len);
+ AP_DEBUG_ASSERT(obj->count <= mobj->m_len);
}
return APR_SUCCESS;
}