本文整理汇总了C++中APR_BRIGADE_INSERT_TAIL函数的典型用法代码示例。如果您正苦于以下问题:C++ APR_BRIGADE_INSERT_TAIL函数的具体用法?C++ APR_BRIGADE_INSERT_TAIL怎么用?C++ APR_BRIGADE_INSERT_TAIL使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了APR_BRIGADE_INSERT_TAIL函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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. */
}
开发者ID:aholmes,项目名称:php-src,代码行数:26,代码来源:sapi_apache2.c
示例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;
}
开发者ID:CHINAANSHE,项目名称:apache,代码行数:37,代码来源:mod_ext_filter.c
示例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;
}
开发者ID:AzerTyQsdF,项目名称:osx,代码行数:26,代码来源:h2_conn_io.c
示例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;
}
开发者ID:AmesianX,项目名称:php-src,代码行数:32,代码来源:sapi_apache2.c
示例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);
}
开发者ID:stephan-hof,项目名称:mod_dechunk,代码行数:59,代码来源:mod_dechunk.c
示例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);
}
开发者ID:Garridon,项目名称:windowsrtdev,代码行数:17,代码来源:connection.c
示例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;
}
开发者ID:gitpan,项目名称:mod_perl,代码行数:9,代码来源:modperl_filter.c
示例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;
}
开发者ID:MichealYangGitHub,项目名称:C,代码行数:9,代码来源:h2_io.c
示例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;
}
开发者ID:sjnam,项目名称:mod-fortune,代码行数:56,代码来源:mod_fortune.c
示例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;
}
开发者ID:gitpan,项目名称:mod_perl,代码行数:10,代码来源:modperl_filter.c
示例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;
}
开发者ID:sjnam,项目名称:mod-fortune,代码行数:55,代码来源:mod_fortune.c
示例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);
}
开发者ID:JonathanFu,项目名称:OpenAM-1,代码行数:42,代码来源:agent.c
示例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
)
);
}
开发者ID:pdan93,项目名称:licenta_apache_module,代码行数:12,代码来源:mod_helloworld_out_filter_example.c
示例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);
}
开发者ID:gitpan,项目名称:mod_perl,代码行数:11,代码来源:modperl_filter.c
示例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;
}
开发者ID:NeedfulThings,项目名称:mod_h2,代码行数:11,代码来源:h2_io.c
示例16: mmap_handler
static int mmap_handler(request_rec *r, a_file *file)
{
#if APR_HAS_MMAP
conn_rec *c = r->connection;
apr_bucket *b;
apr_mmap_t *mm;
apr_bucket_brigade *bb = apr_brigade_create(r->pool, c->bucket_alloc);
apr_mmap_dup(&mm, file->mm, r->pool);
b = apr_bucket_mmap_create(mm, 0, (apr_size_t)file->finfo.size,
c->bucket_alloc);
APR_BRIGADE_INSERT_TAIL(bb, b);
b = apr_bucket_eos_create(c->bucket_alloc);
APR_BRIGADE_INSERT_TAIL(bb, b);
if (ap_pass_brigade(r->output_filters, bb) != APR_SUCCESS)
return AP_FILTER_ERROR;
#endif
return OK;
}
开发者ID:pexip,项目名称:os-apache2,代码行数:20,代码来源:mod_file_cache.c
示例17: urlReplaceFilterOutFilter
static apr_status_t urlReplaceFilterOutFilter(ap_filter_t *f,
apr_bucket_brigade *pbbIn)
{
request_rec *r = f->r;
conn_rec *c = r->connection;
apr_bucket *pbktIn;
apr_bucket_brigade *pbbOut;
pbbOut=apr_brigade_create(r->pool, c->bucket_alloc);
for (pbktIn = APR_BRIGADE_FIRST(pbbIn);
pbktIn != APR_BRIGADE_SENTINEL(pbbIn);
pbktIn = APR_BUCKET_NEXT(pbktIn))
{
const char *data;
apr_size_t len;
char *buf;
apr_size_t n;
apr_bucket *pbktOut;
if (APR_BUCKET_IS_EOS(pbktIn))
{
apr_bucket *pbktEOS=apr_bucket_eos_create(c->bucket_alloc);
APR_BRIGADE_INSERT_TAIL(pbbOut,pbktEOS);
continue;
}
/* read */
apr_bucket_read(pbktIn,&data,&len,APR_BLOCK_READ);
/* write */
buf = apr_bucket_alloc(len, c->bucket_alloc);
for (n=0 ; n < len ; ++n)
buf[n] = apr_toupper(data[n]);
pbktOut = apr_bucket_heap_create(buf, len, apr_bucket_free,
c->bucket_alloc);
APR_BRIGADE_INSERT_TAIL(pbbOut,pbktOut);
}
apr_brigade_cleanup(pbbIn);
return ap_pass_brigade(f->next,pbbOut);
}
开发者ID:yzsme,项目名称:apache-replace-module,代码行数:41,代码来源:urlreplacefilter.c
示例18: bucketeer_buffer
/* Bring the current buffer content into the output brigade, appropriately
* chunked.
*/
static apr_status_t bucketeer_buffer(h2_conn_io *io) {
const char *data = io->buffer;
apr_size_t remaining = io->buflen;
apr_bucket *b;
int bcount, i;
if (io->write_size > WRITE_SIZE_INITIAL
&& (io->cooldown_usecs > 0)
&& (apr_time_now() - io->last_write) >= io->cooldown_usecs) {
/* long time not written, reset write size */
io->write_size = WRITE_SIZE_INITIAL;
io->bytes_written = 0;
ap_log_cerror(APLOG_MARK, APLOG_TRACE2, 0, io->connection,
"h2_conn_io(%ld): timeout write size reset to %ld",
(long)io->connection->id, (long)io->write_size);
}
else if (io->write_size < WRITE_SIZE_MAX
&& io->bytes_written >= io->warmup_size) {
/* connection is hot, use max size */
io->write_size = WRITE_SIZE_MAX;
ap_log_cerror(APLOG_MARK, APLOG_TRACE2, 0, io->connection,
"h2_conn_io(%ld): threshold reached, write size now %ld",
(long)io->connection->id, (long)io->write_size);
}
bcount = (int)(remaining / io->write_size);
for (i = 0; i < bcount; ++i) {
b = apr_bucket_transient_create(data, io->write_size,
io->output->bucket_alloc);
APR_BRIGADE_INSERT_TAIL(io->output, b);
data += io->write_size;
remaining -= io->write_size;
}
if (remaining > 0) {
b = apr_bucket_transient_create(data, remaining,
io->output->bucket_alloc);
APR_BRIGADE_INSERT_TAIL(io->output, b);
}
return APR_SUCCESS;
}
开发者ID:NeedfulThings,项目名称:mod_h2,代码行数:44,代码来源:h2_conn_io.c
示例19: include_cgi
/*============================================================================
*============================================================================
* This is the beginning of the cgi filter code moved from mod_include. This
* is the code required to handle the "exec" SSI directive.
*============================================================================
*============================================================================*/
static apr_status_t include_cgi(include_ctx_t *ctx, ap_filter_t *f,
apr_bucket_brigade *bb, char *s)
{
request_rec *r = f->r;
request_rec *rr = ap_sub_req_lookup_uri(s, r, f->next);
int rr_status;
if (rr->status != HTTP_OK) {
ap_destroy_sub_req(rr);
return APR_EGENERAL;
}
/* No hardwired path info or query allowed */
if ((rr->path_info && rr->path_info[0]) || rr->args) {
ap_destroy_sub_req(rr);
return APR_EGENERAL;
}
if (rr->finfo.filetype != APR_REG) {
ap_destroy_sub_req(rr);
return APR_EGENERAL;
}
/* Script gets parameters of the *document*, for back compatibility */
rr->path_info = r->path_info; /* hard to get right; see mod_cgi.c */
rr->args = r->args;
/* Force sub_req to be treated as a CGI request, even if ordinary
* typing rules would have called it something else.
*/
ap_set_content_type(rr, CGI_MAGIC_TYPE);
/* Run it. */
rr_status = ap_run_sub_req(rr);
if (ap_is_HTTP_REDIRECT(rr_status)) {
const char *location = apr_table_get(rr->headers_out, "Location");
if (location) {
char *buffer;
location = ap_escape_html(rr->pool, location);
buffer = apr_pstrcat(ctx->pool, "<a href=\"", location, "\">",
location, "</a>", NULL);
APR_BRIGADE_INSERT_TAIL(bb, apr_bucket_pool_create(buffer,
strlen(buffer), ctx->pool,
f->c->bucket_alloc));
}
}
ap_destroy_sub_req(rr);
return APR_SUCCESS;
}
开发者ID:daisukeokaoss,项目名称:ExpandProjectIntoOneFile,代码行数:59,代码来源:mod_cgi.c
示例20: send_output_eos
MP_INLINE static apr_status_t send_output_eos(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_eos_create(ba);
APR_BRIGADE_INSERT_TAIL(bb, b);
((modperl_filter_ctx_t *)f->ctx)->sent_eos = 1;
MP_TRACE_f(MP_FUNC, MP_FILTER_NAME_FORMAT
"write out: EOS bucket in separate bb", MP_FILTER_NAME(f));
return ap_pass_brigade(f->next, bb);
}
开发者ID:gitpan,项目名称:mod_perl,代码行数:12,代码来源:modperl_filter.c
注:本文中的APR_BRIGADE_INSERT_TAIL函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论