| 2082 | } |
| 2083 | |
| 2084 | static apr_status_t buffer_output(request_rec *r, |
| 2085 | const char *str, apr_size_t len) |
| 2086 | { |
| 2087 | conn_rec *c = r->connection; |
| 2088 | ap_filter_t *f; |
| 2089 | old_write_filter_ctx *ctx; |
| 2090 | |
| 2091 | if (len == 0) |
| 2092 | return APR_SUCCESS; |
| 2093 | |
| 2094 | f = insert_old_write_filter(r); |
| 2095 | ctx = f->ctx; |
| 2096 | |
| 2097 | /* if the first filter is not our buffering filter, then we have to |
| 2098 | * deliver the content through the normal filter chain |
| 2099 | */ |
| 2100 | if (f != r->output_filters) { |
| 2101 | apr_status_t rv; |
| 2102 | apr_bucket *b = apr_bucket_transient_create(str, len, c->bucket_alloc); |
| 2103 | APR_BRIGADE_INSERT_TAIL(ctx->tmpbb, b); |
| 2104 | |
| 2105 | rv = ap_pass_brigade(r->output_filters, ctx->tmpbb); |
| 2106 | apr_brigade_cleanup(ctx->tmpbb); |
| 2107 | return rv; |
| 2108 | } |
| 2109 | |
| 2110 | if (ctx->bb == NULL) { |
| 2111 | ctx->bb = apr_brigade_create(r->pool, c->bucket_alloc); |
| 2112 | } |
| 2113 | |
| 2114 | return ap_fwrite(f->next, ctx->bb, str, len); |
| 2115 | } |
| 2116 | |
| 2117 | AP_DECLARE(int) ap_rputc(int c, request_rec *r) |
| 2118 | { |
no test coverage detected