* ::HTTP_INTERNAL_SERVER_ERROR on all other errors
* @param r The request rec
* @param bucket The current bucket brigade
- * @param msg Optional error msg; if NULL defaults to "ap_pass_brigade returned"
- *
+ * @param fmt The format string. If NULL defaults to "ap_pass_brigade returned"
+ * @param ... The arguments to use to fill out the format string
* @remark Ownership of the brigade is retained by the caller. On return,
* the contents of the brigade are UNDEFINED, and the caller must
* either call apr_brigade_cleanup or apr_brigade_destroy on
*/
AP_DECLARE(apr_status_t) ap_pass_brigade_fchk(request_rec *r,
apr_bucket_brigade *bucket,
- const char *msg);
+ const char *fmt,
+ ...);
/**
* @param f the filter we are writing to
* @param bb The brigade to buffer into
* @param fmt The format string
- * @param ... The argumets to use to fill out the format string
+ * @param ... The arguments to use to fill out the format string
*/
AP_DECLARE_NONSTD(apr_status_t) ap_fprintf(ap_filter_t *f,
apr_bucket_brigade *bb,
APR_BRIGADE_INSERT_TAIL(out, e);
return ap_pass_brigade_fchk(r, out,
- apr_psprintf(r->pool,
- "cache_quick_handler(%s): ap_pass_brigade returned",
- cache->provider_name));
+ "cache_quick_handler(%s): ap_pass_brigade returned",
+ cache->provider_name);
}
/**
out = apr_brigade_create(r->pool, r->connection->bucket_alloc);
e = apr_bucket_eos_create(out->bucket_alloc);
APR_BRIGADE_INSERT_TAIL(out, e);
- return ap_pass_brigade_fchk(r, out,
- apr_psprintf(r->pool,
- "cache(%s): ap_pass_brigade returned",
- cache->provider_name));
+ return ap_pass_brigade_fchk(r, out, "cache(%s): ap_pass_brigade returned",
+ cache->provider_name);
}
/*
*/
AP_DECLARE(apr_status_t) ap_pass_brigade_fchk(request_rec *r,
apr_bucket_brigade *bb,
- const char *errmsg)
+ const char *fmt,
+ ...)
{
apr_status_t rv;
- if (!errmsg)
- errmsg = "ap_pass_brigade returned";
rv = ap_pass_brigade(r->output_filters, bb);
if (rv != APR_SUCCESS) {
if (rv != AP_FILTER_ERROR) {
- ap_log_rerror(APLOG_MARK, APLOG_DEBUG, rv, r,
- "%s %d", errmsg, rv);
+ if (!fmt)
+ ap_log_rerror(APLOG_MARK, APLOG_DEBUG, rv, r,
+ "ap_pass_brigade returned %d", rv);
+ else {
+ va_list ap;
+ const char *res;
+ va_start(ap, fmt);
+ res = apr_pvsprintf(r->pool, fmt, ap);
+ va_end(ap);
+ ap_log_rerror(APLOG_MARK, APLOG_DEBUG, rv, r, res, NULL);
+ }
return HTTP_INTERNAL_SERVER_ERROR;
}
return AP_FILTER_ERROR;