Changes with Apache 2.0.18-dev
+ *) Create Files, and thus MMAPs, out of the request pool, not the
+ connection pool. This solves a small resource leak that had us
+ not closing files until a connection was closed. In order to do
+ this, at the end of the core_output_filter, we loop through the
+ brigade and convert any data we have into a single HEAP bucket
+ that we know will survive clearing the request_rec.
+ [Ryan Bloom, Justin Erenkrantz <jerenkrantz@ebuilt.com>,
+ Cliff Woolley]
+
*) Completely revamp configure so that it preserves the standard make
variables CPPFLAGS, CFLAGS, CXXFLAGS, LDFLAGS and LIBS by moving
the configure additions to EXTRA_* variables. Also, allow the user
return HTTP_METHOD_NOT_ALLOWED;
}
- if ((status = apr_file_open(&fd, r->filename, APR_READ | APR_BINARY, 0, r->connection->pool)) != APR_SUCCESS) {
+ if ((status = apr_file_open(&fd, r->filename, APR_READ | APR_BINARY, 0, r->pool)) != APR_SUCCESS) {
ap_log_rerror(APLOG_MARK, APLOG_ERR, status, r,
"file permissions deny server access: %s", r->filename);
return HTTP_FORBIDDEN;
if ((!fd && !more &&
(nbytes < AP_MIN_BYTES_TO_WRITE) && !APR_BUCKET_IS_FLUSH(e))
|| (APR_BUCKET_IS_EOS(e) && c->keepalive)) {
-
/* NEVER save an EOS in here. If we are saving a brigade with
* an EOS bucket, then we are doing keepalive connections, and
* we want to process to second request fully.
*/
if (APR_BUCKET_IS_EOS(e)) {
- apr_bucket_delete(e);
+ apr_bucket *bucket = NULL;
+ /* If we are in here, then this request is a keepalive. We
+ * need to be certain that any data in a bucket is valid
+ * after the request_pool is cleared.
+ */
+ if (ctx->b == NULL) {
+ ctx->b = apr_brigade_create(f->c->pool);
+ }
+
+ APR_BRIGADE_FOREACH(bucket, b) {
+ const char *str;
+ apr_size_t n;
+
+ rv = apr_bucket_read(bucket, &str, &n, APR_BLOCK_READ);
+ apr_brigade_write(ctx->b, NULL, NULL, str, n);
+ }
+ apr_brigade_destroy(b);
+ }
+ else {
+ ap_save_brigade(f, &ctx->b, &b);
}
- ap_save_brigade(f, &ctx->b, &b);
return APR_SUCCESS;
}