本文整理汇总了C++中APR_BRIGADE_INSERT_TAIL函数的典型用法代码示例。如果您正苦于以下问题:C++ APR_BRIGADE_INSERT_TAIL函数的具体用法?C++ APR_BRIGADE_INSERT_TAIL怎么用?C++ APR_BRIGADE_INSERT_TAIL使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了APR_BRIGADE_INSERT_TAIL函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: php_apache_sapi_ub_write
static int
php_apache_sapi_ub_write(const char *str, uint str_length TSRMLS_DC)
{
apr_bucket *b;
apr_bucket_brigade *bb;
apr_bucket_alloc_t *ba;
ap_filter_t *f; /* remaining output filters */
php_struct *ctx;
ctx = SG(server_context);
f = ctx->f;
if (str_length == 0) return 0;
ba = f->c->bucket_alloc;
bb = apr_brigade_create(ctx->r->pool, ba);
b = apr_bucket_transient_create(str, str_length, ba);
APR_BRIGADE_INSERT_TAIL(bb, b);
if (ap_pass_brigade(f->next, bb) != APR_SUCCESS || ctx->r->connection->aborted) {
php_handle_aborted_connection();
}
return str_length; /* we always consume all the data passed to us. */
}
示例2: drain_available_output
/* drain_available_output():
*
* if any data is available from the filter, read it and append it
* to the the bucket brigade
*/
static apr_status_t drain_available_output(ap_filter_t *f,
apr_bucket_brigade *bb)
{
request_rec *r = f->r;
conn_rec *c = r->connection;
ef_ctx_t *ctx = f->ctx;
apr_size_t len;
char buf[4096];
apr_status_t rv;
apr_bucket *b;
while (1) {
int lvl = APLOG_TRACE5;
len = sizeof(buf);
rv = apr_file_read(ctx->proc->out, buf, &len);
if (rv && !APR_STATUS_IS_EAGAIN(rv))
lvl = APLOG_DEBUG;
ap_log_rerror(APLOG_MARK, lvl, rv, r, APLOGNO(01460)
"apr_file_read(child output), len %" APR_SIZE_T_FMT,
!rv ? len : -1);
if (rv != APR_SUCCESS) {
return rv;
}
b = apr_bucket_heap_create(buf, len, NULL, c->bucket_alloc);
APR_BRIGADE_INSERT_TAIL(bb, b);
return APR_SUCCESS;
}
/* we should never get here; if we do, a bogus error message would be
* the least of our problems
*/
return APR_ANONYMOUS;
}
示例3: h2_conn_io_flush_int
static apr_status_t h2_conn_io_flush_int(h2_conn_io *io, int force)
{
if (io->unflushed || force) {
if (io->buflen > 0) {
/* something in the buffer, put it in the output brigade */
ap_log_cerror(APLOG_MARK, APLOG_TRACE1, 0, io->connection,
"h2_conn_io: flush, flushing %ld bytes", (long)io->buflen);
bucketeer_buffer(io);
io->buflen = 0;
}
if (force) {
APR_BRIGADE_INSERT_TAIL(io->output,
apr_bucket_flush_create(io->output->bucket_alloc));
}
ap_log_cerror(APLOG_MARK, APLOG_TRACE2, 0, io->connection,
"h2_conn_io: flush");
/* Send it out */
io->unflushed = 0;
return pass_out(io->output, io);
/* no more access after this, as we might have flushed an EOC bucket
* that de-allocated us all. */
}
return APR_SUCCESS;
}
示例4: php_input_filter
static int php_input_filter(ap_filter_t *f, apr_bucket_brigade *bb,
ap_input_mode_t mode, apr_read_type_e block, apr_off_t readbytes)
{
php_struct *ctx;
apr_status_t rv;
if (f->r->proxyreq) {
return ap_get_brigade(f->next, bb, mode, block, readbytes);
}
ctx = SG(server_context);
if (ctx == NULL) {
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, f->r,
"php failed to get server context");
return HTTP_INTERNAL_SERVER_ERROR;
}
if ((rv = ap_get_brigade(f->next, bb, mode, block, readbytes)) != APR_SUCCESS) {
return rv;
}
if (!ctx->post_data) {
ctx->post_data = apr_brigade_create(f->r->pool, f->c->bucket_alloc);
}
if ((rv = ap_save_brigade(f, &ctx->post_data, &bb, f->r->pool)) != APR_SUCCESS) {
return rv;
}
apr_brigade_cleanup(bb);
APR_BRIGADE_INSERT_TAIL(bb, apr_bucket_eos_create(bb->bucket_alloc));
return APR_SUCCESS;
}
示例5: read_complete_body
static apr_status_t
read_complete_body(request_rec *r, apr_bucket_brigade *kept_body)
{
apr_bucket_brigade *tmp_bb;
apr_bucket *t_bucket1, *t_bucket2;
unsigned short eos_seen = 0;
apr_status_t status;
tmp_bb = apr_brigade_create(r->pool, r->connection->bucket_alloc);
while (!eos_seen) {
status = ap_get_brigade(
r->input_filters,
tmp_bb,
AP_MODE_READBYTES,
APR_BLOCK_READ,
HUGE_STRING_LEN);
/* This means the filter discovered an error.
* Furthermore input-filter already handeld the error and sends
* something to the output chain.
* For example ap_http_filter does this if LimitRequestBody is reached
*/
if (status == AP_FILTER_ERROR) {
apr_brigade_destroy(tmp_bb);
return AP_FILTER_ERROR;
}
/* Cool no need to search for the eos bucket */
if (APR_STATUS_IS_EOF(status)) {
apr_brigade_destroy(tmp_bb);
return APR_SUCCESS;
}
if (status != APR_SUCCESS) {
apr_brigade_destroy(tmp_bb);
return status;
}
ITER_BRIGADE(t_bucket1, tmp_bb) {
apr_bucket_copy(t_bucket1, &t_bucket2);
/* If SSL is used TRANSIENT buckets are returned.
* However we need this bucket for a longer period than
* this function call, hence 'setaside' the bucket.
*/
if APR_BUCKET_IS_TRANSIENT(t_bucket2) {
apr_bucket_setaside(t_bucket2, r->pool);
}
APR_BRIGADE_INSERT_TAIL(kept_body, t_bucket2);
if (!eos_seen && APR_BUCKET_IS_EOS(t_bucket1)) {
eos_seen = 1;
}
}
apr_brigade_cleanup(tmp_bb);
}
示例6: AP_CORE_DECLARE
AP_CORE_DECLARE(void) ap_flush_conn(conn_rec *c)
{
apr_bucket_brigade *bb;
apr_bucket *b;
bb = apr_brigade_create(c->pool, c->bucket_alloc);
/* FLUSH bucket */
b = apr_bucket_flush_create(c->bucket_alloc);
APR_BRIGADE_INSERT_TAIL(bb, b);
/* End Of Connection bucket */
b = ap_bucket_eoc_create(c->bucket_alloc);
APR_BRIGADE_INSERT_TAIL(bb, b);
ap_pass_brigade(c->output_filters, bb);
}
示例7: send_input_flush
MP_INLINE static apr_status_t send_input_flush(modperl_filter_t *filter)
{
apr_bucket_alloc_t *ba = filter->f->c->bucket_alloc;
apr_bucket *b = apr_bucket_flush_create(ba);
APR_BRIGADE_INSERT_TAIL(filter->bb_out, b);
MP_TRACE_f(MP_FUNC, MP_FILTER_NAME_FORMAT
"write out: FLUSH bucket", MP_FILTER_NAME(filter->f));
return APR_SUCCESS;
}
示例8: h2_io_in_close
apr_status_t h2_io_in_close(h2_io *io)
{
if (io->bbin) {
APR_BRIGADE_INSERT_TAIL(io->bbin,
apr_bucket_eos_create(io->bbin->bucket_alloc));
}
io->eos_in = 1;
return APR_SUCCESS;
}
示例9: process_fortune_connection
static int process_fortune_connection(conn_rec *c)
{
apr_status_t rv;
apr_procattr_t *pattr;
apr_pool_t *p = c->pool;
apr_bucket *b;
apr_bucket_brigade *bb;
const char *err_msg = "200 OK\n";
fortune_conf_t *fconf =
ap_get_module_config(c->base_server->module_config,
&fortune_module);
if (!fconf->enabled) {
return DECLINED;
}
bb = apr_brigade_create(p, c->bucket_alloc);
/* prepare process attribute */
if ((rv = apr_procattr_create(&pattr, c->pool)) != APR_SUCCESS) {
goto error;
}
if ((rv =
apr_procattr_io_set(pattr, APR_NO_PIPE, APR_FULL_BLOCK, APR_NO_PIPE))
!= APR_SUCCESS) {
goto error;
}
/* default value: APR_PROGRAM */
if ((rv =
apr_procattr_cmdtype_set(pattr, APR_PROGRAM_ENV)) != APR_SUCCESS) {
goto error;
}
/* run the program and read the output from the pipe */
if ((rv = fortune_process(c, pattr, bb)) != APR_SUCCESS) {
apr_brigade_cleanup(bb);
}
error:
if (rv != APR_SUCCESS) {
err_msg = "500 ERROR\n";
}
b = apr_bucket_pool_create(err_msg, strlen(err_msg), p, c->bucket_alloc);
APR_BRIGADE_INSERT_HEAD(bb, b);
b = apr_bucket_flush_create(c->bucket_alloc);
APR_BRIGADE_INSERT_TAIL(bb, b);
rv = ap_pass_brigade(c->output_filters, bb);
return OK;
}
示例10: send_input_eos
MP_INLINE static apr_status_t send_input_eos(modperl_filter_t *filter)
{
apr_bucket_alloc_t *ba = filter->f->c->bucket_alloc;
apr_bucket *b = apr_bucket_eos_create(ba);
APR_BRIGADE_INSERT_TAIL(filter->bb_out, b);
((modperl_filter_ctx_t *)filter->f->ctx)->sent_eos = 1;
MP_TRACE_f(MP_FUNC, MP_FILTER_NAME_FORMAT
"write out: EOS bucket", MP_FILTER_NAME(filter->f));
return APR_SUCCESS;
}
示例11: fortune_process
static apr_status_t fortune_process(conn_rec *c,
apr_procattr_t *pattr,
apr_bucket_brigade *bb)
{
apr_status_t rv;
int argc = 0;
const char *argv[APP_MAX_ARGC];
apr_proc_t proc;
apr_bucket *b;
apr_pool_t *p = c->pool;
fortune_conf_t *fconf = ap_get_module_config(c->base_server->module_config,
&fortune_module);
argv[argc++] = fconf->progname;
argv[argc++] = NULL; /* @argvs should be null-terminated */
if ((rv = apr_proc_create(&proc, fconf->progname,
(const char *const *) argv,
NULL, (apr_procattr_t *) pattr,
p)) != APR_SUCCESS) {
return rv;
}
while (TRUE) {
char buf[BUFSIZE] = { 0, };
/* read the command's output through the pipe */
rv = apr_file_gets(buf, sizeof(buf), proc.out);
if (APR_STATUS_IS_EOF(rv)) {
break;
}
b = apr_bucket_pool_create(apr_pstrdup(p, buf),
strlen(buf), p, c->bucket_alloc);
APR_BRIGADE_INSERT_TAIL(bb, b);
}
apr_file_close(proc.out);
{
int st;
apr_exit_why_e why;
rv = apr_proc_wait(&proc, &st, &why, APR_WAIT);
if (APR_STATUS_IS_CHILD_DONE(rv)) {
ap_log_cerror(APLOG_MARK, APLOG_INFO, 0, c,
"child done: why = %d, exit status = %d", why, st);
}
else {
ap_log_cerror(APLOG_MARK, APLOG_INFO, 0, c, "child notdone");
return APR_EGENERAL;
}
}
return APR_SUCCESS;
}
示例12: amagent_post_filter
static apr_status_t amagent_post_filter(ap_filter_t *f, apr_bucket_brigade *bucket_out,
ap_input_mode_t emode, apr_read_type_e eblock, apr_off_t nbytes) {
request_rec *r = f->r;
conn_rec *c = r->connection;
apr_bucket *bucket;
apr_size_t sz;
char *clean;
const char *data = apr_table_get(r->notes, amagent_post_filter_name);
do {
if (data == NULL) break;
sz = strlen(data);
clean = base64_decode(data, &sz);
if (clean == NULL) break;
apr_table_unset(r->notes, amagent_post_filter_name);
LOG_R(APLOG_DEBUG, r, "amagent_post_filter(): reposting %ld bytes", sz);
bucket = apr_bucket_heap_create((const char *) clean, sz, NULL, c->bucket_alloc);
if (bucket == NULL) {
free(clean);
return APR_EGENERAL;
}
APR_BRIGADE_INSERT_TAIL(bucket_out, bucket);
free(clean);
bucket = apr_bucket_eos_create(c->bucket_alloc);
if (bucket == NULL) {
return APR_EGENERAL;
}
APR_BRIGADE_INSERT_TAIL(bucket_out, bucket);
ap_remove_input_filter(f);
return APR_SUCCESS;
} while (0);
apr_table_unset(r->notes, amagent_post_filter_name);
ap_remove_input_filter(f);
return ap_get_brigade(f->next, bucket_out, emode, eblock, nbytes);
}
示例13: write_brigade
//-------
void write_brigade(apr_bucket_brigade *bb_out,request_rec *r,char *data){
APR_BRIGADE_INSERT_TAIL(
bb_out,
apr_bucket_pool_create(
data,
strlen(data),
r->pool,
r->connection->bucket_alloc
)
);
}
示例14: send_output_flush
MP_INLINE static apr_status_t send_output_flush(ap_filter_t *f)
{
apr_bucket_alloc_t *ba = f->c->bucket_alloc;
apr_bucket_brigade *bb = apr_brigade_create(MP_FILTER_POOL(f),
ba);
apr_bucket *b = apr_bucket_flush_create(ba);
APR_BRIGADE_INSERT_TAIL(bb, b);
MP_TRACE_f(MP_FUNC, MP_FILTER_NAME_FORMAT
"write out: FLUSH bucket in separate bb", MP_FILTER_NAME(f));
return ap_pass_brigade(f, bb);
}
示例15: h2_io_out_close
apr_status_t h2_io_out_close(h2_io *io)
{
if (io->rst_error) {
return APR_ECONNABORTED;
}
if (!io->eos_out && !h2_util_has_eos(io->bbout, 0)) {
APR_BRIGADE_INSERT_TAIL(io->bbout,
apr_bucket_eos_create(io->bbout->bucket_alloc));
}
return APR_SUCCESS;
}