您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ APR_BUCKET_NEXT函数代码示例

51自学网 2021-06-01 19:35:36
  C++
这篇教程C++ APR_BUCKET_NEXT函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中APR_BUCKET_NEXT函数的典型用法代码示例。如果您正苦于以下问题:C++ APR_BUCKET_NEXT函数的具体用法?C++ APR_BUCKET_NEXT怎么用?C++ APR_BUCKET_NEXT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了APR_BUCKET_NEXT函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: test_truncfile

/* Regression test for PR 34708, where a file bucket will keep * duplicating itself on being read() when EOF is reached * prematurely. */static void test_truncfile(abts_case *tc, void *data){    apr_bucket_alloc_t *ba = apr_bucket_alloc_create(p);    apr_bucket_brigade *bb = apr_brigade_create(p, ba);    apr_file_t *f = make_test_file(tc, "testfile.txt", "hello");    apr_bucket *e;    const char *buf;    apr_size_t len;    apr_brigade_insert_file(bb, f, 0, 5, p);    apr_file_trunc(f, 0);    e = APR_BRIGADE_FIRST(bb);    ABTS_ASSERT(tc, "single bucket in brigade",                APR_BUCKET_NEXT(e) == APR_BRIGADE_SENTINEL(bb));    apr_bucket_file_enable_mmap(e, 0);    ABTS_ASSERT(tc, "read gave APR_EOF",                apr_bucket_read(e, &buf, &len, APR_BLOCK_READ) == APR_EOF);    ABTS_ASSERT(tc, "read length 0", len == 0);        ABTS_ASSERT(tc, "still a single bucket in brigade",                APR_BUCKET_NEXT(e) == APR_BRIGADE_SENTINEL(bb));    apr_file_close(f);    apr_brigade_destroy(bb);    apr_bucket_alloc_destroy(ba);}
开发者ID:QsBBQ,项目名称:masspinger,代码行数:35,


示例2: find_policy_file_request

/** * Searches the input request for a flash socket policy request. This request, * unfortunately, does not follow the HTTP protocol and cannot be handled * via a special HTTP handler. Instead, it is a short xml string followed by * a null character: * * '<policy-file-request/>/0' * * A peek into the incoming data checks the first character of the stream to * see if it is '<' (as opposed to typically something else for HTTP). If it * is not, then this function returns and HTTP input is read normally. If it * is, then the remaining bytes in the policy-file-request are read and * checked. If a match is found, then the filter state will be updated to * inform the output filter to send a cross-domain policy as a response. If * no match is found, HTTP traffic will proceed as usual. * * @param f the input filter. * @param state the filter state. * * @return APR_SUCCESS on success, some other status on failure. */static apr_status_t find_policy_file_request(   ap_filter_t* f, filter_state* state){   apr_status_t rval = APR_SUCCESS;   // create a temp buffer for speculative reads   apr_bucket_brigade* tmp = apr_brigade_create(f->c->pool, f->c->bucket_alloc);   // FIXME: not sure how blocking mode works ... can it return fewer than   // the number of specified bytes?   // peek at the first PFR_LENGTH bytes   rval = ap_get_brigade(      f->next, tmp, AP_MODE_SPECULATIVE, APR_BLOCK_READ, PFR_LENGTH);   if(rval == APR_SUCCESS)   {      // quickly check the first bucket for the beginning of a pfr      const char* data;      apr_size_t length;      apr_bucket* b = APR_BRIGADE_FIRST(tmp);      rval = apr_bucket_read(b, &data, &length, APR_BLOCK_READ);      if(rval == APR_SUCCESS && length > 0 && data[0] == '<')      {         // possible policy file request, fill local buffer         char pfr[PFR_LENGTH];         char* ptr = pfr;         memcpy(ptr, data, length);         ptr += length;         memset(ptr, '/0', PFR_LENGTH - length);         b = APR_BUCKET_NEXT(b);         while(rval == APR_SUCCESS && b != APR_BRIGADE_SENTINEL(tmp))         {            rval = apr_bucket_read(b, &data, &length, APR_BLOCK_READ);            if(rval == APR_SUCCESS)            {               memcpy(ptr, data, length);               ptr += length;               b = APR_BUCKET_NEXT(b);            }         }         if(rval == APR_SUCCESS)         {            // see if pfr is a policy file request: '<policy-file-request/>/0'            if((ptr - pfr == PFR_LENGTH) && (pfr[PFR_LENGTH - 1] == '/0') &&               (strncmp(pfr, "<policy-file-request/>", PFR_LENGTH -1) == 0))            {               // pfr found               state->found = 1;            }         }      }   }   return rval;}
开发者ID:0anasm,项目名称:titanium_mobile,代码行数:77,


示例3: APU_DECLARE

APU_DECLARE(apr_status_t) apr_brigade_to_iovec(apr_bucket_brigade *b,                                                struct iovec *vec, int *nvec){    int left = *nvec;    apr_bucket *e;    struct iovec *orig;    apr_size_t iov_len;    apr_status_t rv;    orig = vec;    for (e = APR_BRIGADE_FIRST(b);         e != APR_BRIGADE_SENTINEL(b);         e = APR_BUCKET_NEXT(e))    {        if (left-- == 0)            break;        rv = apr_bucket_read(e, (const char **)&vec->iov_base, &iov_len,                             APR_NONBLOCK_READ);        if (rv != APR_SUCCESS)            return rv;        vec->iov_len = iov_len; /* set indirectly in case size differs */        ++vec;    }    *nvec = vec - orig;    return APR_SUCCESS;}
开发者ID:AbrahamJewowich,项目名称:FreeSWITCH,代码行数:29,


示例4: h2_util_bl_print

apr_size_t h2_util_bl_print(char *buffer, apr_size_t bmax,                             const char *tag, const char *sep,                             h2_blist *bl){    apr_size_t off = 0;    const char *sp = "";    apr_bucket *b;        if (bl) {        memset(buffer, 0, bmax--);        off += apr_snprintf(buffer+off, bmax-off, "%s(", tag);        for (b = H2_BLIST_FIRST(bl);              bmax && (b != H2_BLIST_SENTINEL(bl));             b = APR_BUCKET_NEXT(b)) {                        off += h2_util_bucket_print(buffer+off, bmax-off, b, sp);            sp = " ";        }        off += apr_snprintf(buffer+off, bmax-off, ")%s", sep);    }    else {        off += apr_snprintf(buffer+off, bmax-off, "%s(null)%s", tag, sep);    }    return off;}
开发者ID:yewang15215,项目名称:mod_h2,代码行数:25,


示例5: modperl_brigade_dump

void modperl_brigade_dump(apr_bucket_brigade *bb, apr_file_t *file){    apr_bucket *bucket;    int i = 0;#ifndef WIN32    if (file == NULL) {        file = modperl_global_get_server_rec()->error_log;    }    apr_file_printf(file, "dump of brigade 0x%lx/n", (unsigned long)bb);    for (bucket = APR_BRIGADE_FIRST(bb);         bucket != APR_BRIGADE_SENTINEL(bb);         bucket = APR_BUCKET_NEXT(bucket))    {        apr_file_printf(file,                        "   %d: bucket=%s(0x%lx), length=%ld, data=0x%lx/n",                        i, bucket->type->name,                        (unsigned long)bucket,                        (long)bucket->length,                        (unsigned long)bucket->data);        /* apr_file_printf(file, "       : %s/n", (char *)bucket->data); */        i++;    }#endif}
开发者ID:gitpan,项目名称:mod_perl,代码行数:27,


示例6: read_msg

static int read_msg(request_rec *r, msg_t **msg){    conn_rec *c = r->connection;    apr_bucket_brigade *bb = apr_brigade_create(r->pool, c->bucket_alloc);    char *dbuf = apr_palloc(r->pool, MAX_MSG_SIZE);    int dbpos = 0;    int seen_eos = 0;    do {        apr_status_t rv;        apr_bucket *bucket;        rv = ap_get_brigade(r->input_filters, bb, AP_MODE_READBYTES,                            APR_BLOCK_READ, HUGE_STRING_LEN);        if (rv != APR_SUCCESS) {            ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,                          "reading request entity data");            return HTTP_INTERNAL_SERVER_ERROR;        }        for (bucket = APR_BRIGADE_FIRST(bb);                bucket != APR_BRIGADE_SENTINEL(bb);                bucket = APR_BUCKET_NEXT(bucket))        {            const char *data;            apr_size_t len;            if (APR_BUCKET_IS_EOS(bucket)) {                seen_eos = 1;                break;            }            /* We can't do much with this. */            if (APR_BUCKET_IS_FLUSH(bucket))                continue;            /* read */            apr_bucket_read(bucket, &data, &len, APR_BLOCK_READ);            if (dbpos < MAX_MSG_SIZE) {                int cursize = (dbpos + len) > MAX_MSG_SIZE ?                              (MAX_MSG_SIZE - dbpos) : len;                memcpy(dbuf + dbpos, data, cursize);                dbpos += cursize;            }        }        apr_brigade_cleanup(bb);    } while (!seen_eos);    (*msg) = apr_pcalloc(r->pool, sizeof(msg_t));    (*msg)->data = dbuf;    (*msg)->data[dbpos] = '/0';    (*msg)->size = dbpos;    return OK;}
开发者ID:pascience,项目名称:limbo-machine,代码行数:60,


示例7: ironbee_dbg_input_filter

/** * @internal * * Just logs data that comes from the primary input filter. * * Anything this filter sees should be what Apache sees. */static int ironbee_dbg_input_filter(ap_filter_t *f, apr_bucket_brigade *bb,                                ap_input_mode_t mode, apr_read_type_e block,                                apr_off_t readbytes){    conn_rec *c = f->c;    apr_bucket *b;    apr_status_t rc;#if 0    ap_filter_t *xf = f;    do {        ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, c->base_server,                     "DBGFILTER: type=%d mode=%d block=%d readbytes=%d %s", xf->frec->ftype, mode, block, (int)readbytes, xf->frec->name);    } while((xf = xf->next) != NULL);#endif        rc = ap_get_brigade(f->next, bb, mode, block, readbytes);    if (rc == APR_SUCCESS) {        /* Process data. */        for (b = APR_BRIGADE_FIRST(bb); b != APR_BRIGADE_SENTINEL(bb); b = APR_BUCKET_NEXT(b)) {            ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, c->base_server,                         IB_PRODUCT_NAME ": DBG bucket f=%s, b=%s len=%d",                         f->frec->name, b->type->name, (int)b->length);        }    }    return APR_SUCCESS;}
开发者ID:igalic,项目名称:ironbee,代码行数:36,


示例8: APR_BRIGADE_FIRST

static triger_bucket_t *get_data_at_head(ap_filter_t * f,					 apr_bucket_brigade * bb){    const char *data;    apr_bucket *b = APR_BRIGADE_FIRST(bb);    apr_size_t len = 0;    triger_module_ctx_t *ctx = f->ctx;    triger_bucket_t *rv = ctx->triger_bucket;    rv->len = 0;    rv->data = NULL;    rv->b = NULL;    rv->body_end_tag_pos = rv->body_start_tag_pos =	rv->html_start_tag_pos = rv->head_start_tag_pos =	rv->body_start_tag_pos = -1;    while (APR_BUCKET_IS_METADATA(b) && b != APR_BRIGADE_SENTINEL(bb))	b = APR_BUCKET_NEXT(b);    if (APR_BUCKET_IS_METADATA(b) || b == APR_BRIGADE_SENTINEL(bb))	return rv;    apr_bucket_read(b, &data, &len, APR_BLOCK_READ);    rv->len = len;    rv->data = data;    rv->b = b;    return rv;}
开发者ID:dreamsxin,项目名称:mod_triger,代码行数:29,


示例9: dumpio_input_filter

static int dumpio_input_filter (ap_filter_t *f, apr_bucket_brigade *bb,    ap_input_mode_t mode, apr_read_type_e block, apr_off_t readbytes){    apr_bucket *b;    apr_status_t ret;    conn_rec *c = f->c;    ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, c->base_server,	"mod_dumpio: %s [%s-%s] %" APR_OFF_T_FMT " readbytes",         f->frec->name,	 whichmode(mode),         ((block) == APR_BLOCK_READ) ? "blocking" : "nonblocking",         readbytes) ;    ret = ap_get_brigade(f->next, bb, mode, block, readbytes);    if (ret == APR_SUCCESS) {        for (b = APR_BRIGADE_FIRST(bb); b != APR_BRIGADE_SENTINEL(bb); b = APR_BUCKET_NEXT(b)) {          dumpit(f, b);        }    } else {        ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, c->base_server,	"mod_dumpio: %s - %d", f->frec->name, ret) ;    }    return APR_SUCCESS ;}
开发者ID:kheradmand,项目名称:Break,代码行数:28,


示例10: APU_DECLARE

APU_DECLARE(apr_status_t) apr_brigade_to_iovec(apr_bucket_brigade *b,                                                struct iovec *vec, int *nvec){    int left = *nvec;    apr_bucket *e;    struct iovec *orig;    apr_size_t iov_len;    const char *iov_base;    apr_status_t rv;    orig = vec;    for (e = APR_BRIGADE_FIRST(b);         e != APR_BRIGADE_SENTINEL(b);         e = APR_BUCKET_NEXT(e))    {        if (left-- == 0)            break;        rv = apr_bucket_read(e, &iov_base, &iov_len, APR_NONBLOCK_READ);        if (rv != APR_SUCCESS)            return rv;        /* Set indirectly since types differ: */        vec->iov_len = iov_len;        vec->iov_base = (void *)iov_base;        ++vec;    }    *nvec = (int)(vec - orig);    return APR_SUCCESS;}
开发者ID:0jpq0,项目名称:kbengine,代码行数:31,


示例11: cache_remove_lock

/** * Remove the cache lock, if present. * * First, try to close the file handle, whose delete-on-close should * kill the file. Otherwise, just delete the file by name. * * If no lock name has yet been calculated, do the calculation of the * lock name first before trying to delete the file. * * If an optional bucket brigade is passed, the lock will only be * removed if the bucket brigade contains an EOS bucket. */apr_status_t cache_remove_lock(cache_server_conf *conf,        cache_request_rec *cache, request_rec *r, apr_bucket_brigade *bb){    void *dummy;    const char *lockname;    if (!conf || !conf->lock || !conf->lockpath) {        /* no locks configured, leave */        return APR_SUCCESS;    }    if (bb) {        apr_bucket *e;        int eos_found = 0;        for (e = APR_BRIGADE_FIRST(bb);             e != APR_BRIGADE_SENTINEL(bb);             e = APR_BUCKET_NEXT(e))        {            if (APR_BUCKET_IS_EOS(e)) {                eos_found = 1;                break;            }        }        if (!eos_found) {            /* no eos found in brigade, don't delete anything just yet,             * we are not done.             */            return APR_SUCCESS;        }    }    apr_pool_userdata_get(&dummy, CACHE_LOCKFILE_KEY, r->pool);    if (dummy) {        return apr_file_close((apr_file_t *)dummy);    }    apr_pool_userdata_get(&dummy, CACHE_LOCKNAME_KEY, r->pool);    lockname = (const char *)dummy;    if (!lockname) {        char dir[5];        /* create the key if it doesn't exist */        if (!cache->key) {            cache_generate_key(r, r->pool, &cache->key);        }        /* create a hashed filename from the key, and save it for later */        lockname = ap_cache_generate_name(r->pool, 0, 0, cache->key);        /* lock files represent discrete just-went-stale URLs "in flight", so         * we support a simple two level directory structure, more is overkill.         */        dir[0] = '/';        dir[1] = lockname[0];        dir[2] = '/';        dir[3] = lockname[1];        dir[4] = 0;        lockname = apr_pstrcat(r->pool, conf->lockpath, dir, "/", lockname, NULL);    }    return apr_file_remove(lockname, r->pool);}
开发者ID:SBKarr,项目名称:apache-httpd-serenity,代码行数:71,


示例12: mod_sslhaf_in_filter

/** * This input filter will basically sniff on a connection and analyse * the packets when it detects SSL. */static apr_status_t mod_sslhaf_in_filter(ap_filter_t *f,                                         apr_bucket_brigade *bb,                                         ap_input_mode_t mode,                                         apr_read_type_e block,                                         apr_off_t readbytes){    sslhaf_cfg_t *cfg = ap_get_module_config(f->c->conn_config,        &sslhaf_module);    apr_status_t status;    apr_bucket *bucket;    // Return straight away if there's no configuration    if (cfg == NULL) {        return ap_get_brigade(f->next, bb, mode, block, readbytes);    }    // Sanity check first    if (cfg->state == SSLHAF_STATE_GOAWAY) {        return ap_get_brigade(f->next, bb, mode, block, readbytes);    }    // Get brigade    status = ap_get_brigade(f->next, bb, mode, block, readbytes);    if (status != APR_SUCCESS) {        // Do not log, since we're passing the status anyway        cfg->state = SSLHAF_STATE_GOAWAY;        return status;    }    // Loop through the buckets    for(bucket = APR_BRIGADE_FIRST(bb);        bucket != APR_BRIGADE_SENTINEL(bb);        bucket = APR_BUCKET_NEXT(bucket))    {        const char *buf = NULL;        apr_size_t buflen = 0;        if (!(APR_BUCKET_IS_METADATA(bucket))) {            // Get bucket data            status = apr_bucket_read(bucket, &buf, &buflen, APR_BLOCK_READ);            if (status != APR_SUCCESS) {                ap_log_error(APLOG_MARK, APLOG_ERR, status, f->c->base_server,                    "mod_sslhaf [%s]: Error while reading input bucket",                    SSLHAF_AP_CONN_REMOTE_IP(f->c));                return status;            }            // Look into the bucket            if (sslhaf_decode_buffer(cfg,                    (const unsigned char *)buf, buflen) <= 0) {                cfg->state = SSLHAF_STATE_GOAWAY;            }        }    }    return APR_SUCCESS;}
开发者ID:Ath103,项目名称:sslhaf,代码行数:62,


示例13: last_not_included

static apr_status_t last_not_included(apr_bucket_brigade *bb,                                       apr_size_t maxlen,                                       int same_alloc,                                      int *pfile_buckets_allowed,                                      apr_bucket **pend){    apr_bucket *b;    apr_status_t status = APR_SUCCESS;    int files_allowed = pfile_buckets_allowed? *pfile_buckets_allowed : 0;        if (maxlen > 0) {        /* Find the bucket, up to which we reach maxlen/mem bytes */        for (b = APR_BRIGADE_FIRST(bb);              (b != APR_BRIGADE_SENTINEL(bb));             b = APR_BUCKET_NEXT(b)) {                        if (APR_BUCKET_IS_METADATA(b)) {                /* included */            }            else {                if (maxlen == 0) {                    *pend = b;                    return status;                }                                if (b->length == ((apr_size_t)-1)) {                    const char *ign;                    apr_size_t ilen;                    status = apr_bucket_read(b, &ign, &ilen, APR_BLOCK_READ);                    if (status != APR_SUCCESS) {                        return status;                    }                }                                if (same_alloc && APR_BUCKET_IS_FILE(b)) {                    /* we like it move it, always */                }                else if (files_allowed > 0 && APR_BUCKET_IS_FILE(b)) {                    /* this has no memory footprint really unless                     * it is read, disregard it in length count,                     * unless we do not move the file buckets */                    --files_allowed;                }                else if (maxlen < b->length) {                    apr_bucket_split(b, maxlen);                    maxlen = 0;                }                else {                    maxlen -= b->length;                }            }        }    }    *pend = APR_BRIGADE_SENTINEL(bb);    return status;}
开发者ID:stevedien,项目名称:mod_h2,代码行数:56,


示例14: tmpfile_filter

static apr_status_t tmpfile_filter(ap_filter_t *f, apr_bucket_brigade *bbout,	ap_input_mode_t mode, apr_read_type_e block, apr_off_t nbytes) {  apr_bucket_brigade* bbin = apr_brigade_create(f->r->pool,	     f->r->connection->bucket_alloc);  apr_file_t* tmpfile ;  char* tmpname = apr_pstrdup(f->r->pool, "/tmp/mod-upload.XXXXXX") ;  if ( f->ctx ) {    APR_BRIGADE_INSERT_TAIL(bbout, apr_bucket_eos_create(bbout->bucket_alloc)) ;    return APR_SUCCESS ;  }  if ( apr_file_mktemp(&tmpfile, tmpname, KEEPONCLOSE, f->r->pool) != APR_SUCCESS ) {	            // error    ap_remove_input_filter(f) ;  }  apr_pool_cleanup_register(f->r->pool, tmpfile,		(void*)apr_file_close, apr_pool_cleanup_null) ;  for ( ; ; ) {    apr_bucket* b ;    const char* ptr = 0 ;    apr_size_t bytes ;#ifdef DEBUG    ap_log_rerror(APLOG_MARK,APLOG_DEBUG,0, f->r, "get_brigade") ;#endif    ap_get_brigade(f->next, bbin, AP_MODE_READBYTES, APR_BLOCK_READ, BUFLEN) ;    for ( b = APR_BRIGADE_FIRST(bbin) ;	b != APR_BRIGADE_SENTINEL(bbin) && ! f->ctx ;	b = APR_BUCKET_NEXT(b) ) {      if ( APR_BUCKET_IS_EOS(b) ) {	f->ctx = f ;	// just using it as a flag; any nonzero will do	apr_file_flush(tmpfile) ;	apr_brigade_puts(bbout, ap_filter_flush, f, tmpname) ;	APR_BRIGADE_INSERT_TAIL(bbout,		apr_bucket_eos_create(bbout->bucket_alloc) ) ;      } else if ( apr_bucket_read(b, &ptr, &bytes, APR_BLOCK_READ)		== APR_SUCCESS ) {#ifdef DEBUG  ap_log_rerror(APLOG_MARK,APLOG_DEBUG,0, f->r, "	%d bytes in bucket", bytes) ;#endif	apr_file_write(tmpfile, ptr, &bytes) ;      }    }    if ( f->ctx )      break ;    else      apr_brigade_cleanup(bbin) ;  }  apr_brigade_destroy(bbin) ;  return APR_SUCCESS ;}
开发者ID:OpenMandrivaAssociation,项目名称:apache-mod_upload,代码行数:55,


示例15: test_insertfile

static void test_insertfile(abts_case *tc, void *ctx){    apr_bucket_alloc_t *ba = apr_bucket_alloc_create(p);    apr_bucket_brigade *bb;    const apr_off_t bignum = (APR_INT64_C(2) << 32) + 424242;    apr_off_t count;    apr_file_t *f;    apr_bucket *e;    ABTS_ASSERT(tc, "open test file",                apr_file_open(&f, TIF_FNAME,                              APR_FOPEN_WRITE | APR_FOPEN_TRUNCATE                            | APR_FOPEN_CREATE | APR_FOPEN_SPARSE,                              APR_OS_DEFAULT, p) == APR_SUCCESS);    if (apr_file_trunc(f, bignum)) {        apr_file_close(f);        apr_file_remove(TIF_FNAME, p);        ABTS_NOT_IMPL(tc, "Skipped: could not create large file");        return;    }        bb = apr_brigade_create(p, ba);    e = apr_brigade_insert_file(bb, f, 0, bignum, p);        ABTS_ASSERT(tc, "inserted file was not at end of brigade",                e == APR_BRIGADE_LAST(bb));    /* check that the total size of inserted buckets is equal to the     * total size of the file. */    count = 0;    for (e = APR_BRIGADE_FIRST(bb);         e != APR_BRIGADE_SENTINEL(bb);         e = APR_BUCKET_NEXT(e)) {        ABTS_ASSERT(tc, "bucket size sane", e->length != (apr_size_t)-1);        count += e->length;    }    ABTS_ASSERT(tc, "total size of buckets incorrect", count == bignum);    apr_brigade_destroy(bb);    /* Truncate the file to zero size before close() so that we don't     * actually write out the large file if we are on a non-sparse file     * system - like Mac OS X's HFS.  Otherwise, pity the poor user who     * has to wait for the 8GB file to be written to disk.     */    apr_file_trunc(f, 0);    apr_file_close(f);    apr_bucket_alloc_destroy(ba);    apr_file_remove(TIF_FNAME, p);}
开发者ID:QsBBQ,项目名称:masspinger,代码行数:55,


示例16: brigade_dump

static void brigade_dump(request_rec *r, apr_bucket_brigade *bb){    apr_bucket *e;    int i = 0;    for (e = APR_BRIGADE_FIRST(bb);         e != APR_BRIGADE_SENTINEL(bb); e = APR_BUCKET_NEXT(e), i++) {        ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(03193)                      "brigade: [%d] %s", i, e->type->name);    }}
开发者ID:SBKarr,项目名称:apache-httpd-serenity,代码行数:12,


示例17: h2_util_has_flush_or_eos

int h2_util_has_flush_or_eos(apr_bucket_brigade *bb) {    apr_bucket *b;    for (b = APR_BRIGADE_FIRST(bb);         b != APR_BRIGADE_SENTINEL(bb);         b = APR_BUCKET_NEXT(b))    {        if (APR_BUCKET_IS_EOS(b) || APR_BUCKET_IS_FLUSH(b)) {            return 1;        }    }    return 0;}
开发者ID:stevedien,项目名称:mod_h2,代码行数:12,


示例18: test_simple

static void test_simple(abts_case *tc, void *data){    apr_bucket_alloc_t *ba;    apr_bucket_brigade *bb;    apr_bucket *fb, *tb;        ba = apr_bucket_alloc_create(p);    bb = apr_brigade_create(p, ba);        fb = APR_BRIGADE_FIRST(bb);    ABTS_ASSERT(tc, "first bucket of empty brigade is sentinel",                fb == APR_BRIGADE_SENTINEL(bb));    fb = apr_bucket_flush_create(ba);    APR_BRIGADE_INSERT_HEAD(bb, fb);    ABTS_ASSERT(tc, "first bucket of brigade is flush",                APR_BRIGADE_FIRST(bb) == fb);    ABTS_ASSERT(tc, "bucket after flush is sentinel",                APR_BUCKET_NEXT(fb) == APR_BRIGADE_SENTINEL(bb));    tb = apr_bucket_transient_create("aaa", 3, ba);    APR_BUCKET_INSERT_BEFORE(fb, tb);    ABTS_ASSERT(tc, "bucket before flush now transient",                APR_BUCKET_PREV(fb) == tb);    ABTS_ASSERT(tc, "bucket after transient is flush",                APR_BUCKET_NEXT(tb) == fb);    ABTS_ASSERT(tc, "bucket before transient is sentinel",                APR_BUCKET_PREV(tb) == APR_BRIGADE_SENTINEL(bb));    apr_brigade_cleanup(bb);    ABTS_ASSERT(tc, "cleaned up brigade was empty", APR_BRIGADE_EMPTY(bb));    apr_brigade_destroy(bb);    apr_bucket_alloc_destroy(ba);}
开发者ID:QsBBQ,项目名称:masspinger,代码行数:39,


示例19: h2_util_bb_has_data

int h2_util_bb_has_data(apr_bucket_brigade *bb){    apr_bucket *b;    for (b = APR_BRIGADE_FIRST(bb);         b != APR_BRIGADE_SENTINEL(bb);         b = APR_BUCKET_NEXT(b))    {        if (!APR_BUCKET_IS_METADATA(b)) {            return 1;        }    }    return 0;}
开发者ID:stevedien,项目名称:mod_h2,代码行数:13,


示例20: count_buckets

static int count_buckets(apr_bucket_brigade *bb){    apr_bucket *e;    int count = 0;    for (e = APR_BRIGADE_FIRST(bb);          e != APR_BRIGADE_SENTINEL(bb);         e = APR_BUCKET_NEXT(e)) {        count++;    }        return count;}
开发者ID:QsBBQ,项目名称:masspinger,代码行数:13,


示例21: CaseFilterOutFilter

static apr_status_t CaseFilterOutFilter(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);        }    /* Q: is there any advantage to passing a brigade for each bucket?     * A: obviously, it can cut down server resource consumption, if this     * experimental module was fed a file of 4MB, it would be using 8MB for     * the 'read' buckets and the 'write' buckets.     *     * Note it is more efficient to consume (destroy) each bucket as it's     * processed above than to do a single cleanup down here.  In any case,     * don't let our caller pass the same buckets to us, twice;     */    apr_brigade_cleanup(pbbIn);    return ap_pass_brigade(f->next,pbbOut);    }
开发者ID:CHINAANSHE,项目名称:apache,代码行数:51,


示例22: jxr_send_brigade

apr_status_t jxr_send_brigade(jaxer_connection * ac, apr_bucket_brigade * bb){	apr_bucket *bucket;	apr_status_t rv;		compat_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, ac->request, "mod_jaxer: sending a brigade (sock=%d)", ac->sock);	for (bucket = APR_BRIGADE_FIRST(bb);		 bucket != APR_BRIGADE_SENTINEL(bb);		 bucket = APR_BUCKET_NEXT(bucket))	{		char *write_buf;		apr_size_t write_buf_len;				if (APR_BUCKET_IS_EOS(bucket))			break;		if (APR_BUCKET_IS_FLUSH(bucket))			continue;		if ((rv =			 apr_bucket_read(bucket, (const char **)&write_buf, &write_buf_len,							 APR_BLOCK_READ)) != APR_SUCCESS) {			compat_log_rerror(APLOG_MARK, APLOG_WARNING, rv, ac->request,						 "mod_jaxer: can't read request from bucket");			return rv;		}		{			int type = jxr_msg_get_type(write_buf);			apr_size_t pos; // not used			apr_size_t len = jxr_msg_get_length(write_buf, &pos);			compat_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, ac->request, "mod_jaxer: sending a brigade (type=%s len=%d)", sBlockType[type], len);		}		/* Write the buffer to jaxer server */		if(0 > jxr_socket_sendfull(ac, write_buf, (int) write_buf_len))		{					compat_log_rerror(APLOG_MARK, APLOG_WARNING, APR_FROM_OS_ERROR(rv), ac->request,					"mod_jaxer: can't write to socket");			return apr_get_os_error();		}	}	compat_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, ac->request, "mod_jaxer: sent a brigade (sock=%d)", ac->sock);	return APR_SUCCESS;}
开发者ID:absynce,项目名称:Jaxer,代码行数:48,


示例23: h2_beam_get_buffered

apr_off_t h2_beam_get_buffered(h2_bucket_beam *beam){    apr_bucket *b;    apr_off_t l = 0;    h2_beam_lock bl;        if (enter_yellow(beam, &bl) == APR_SUCCESS) {        for (b = H2_BLIST_FIRST(&beam->red);             b != H2_BLIST_SENTINEL(&beam->red);            b = APR_BUCKET_NEXT(b)) {            /* should all have determinate length */            l += b->length;        }        leave_yellow(beam, &bl);    }    return l;}
开发者ID:yewang15215,项目名称:mod_h2,代码行数:17,


示例24: cdn_html_filter

static int cdn_html_filter(ap_filter_t * f, apr_bucket_brigade * bb){  apr_bucket *b;  const char *buf = 0;  apr_size_t bytes = 0;  /* now do HTML filtering if necessary, and pass the brigade onward */  saxctxt *ctxt = check_html_filter_init(f);  if (!ctxt)    return ap_pass_brigade(f->next, bb);  for(b = APR_BRIGADE_FIRST(bb); b != APR_BRIGADE_SENTINEL(bb); b = APR_BUCKET_NEXT(b)) {    if(APR_BUCKET_IS_EOS(b) || APR_BUCKET_IS_FLUSH(b)) {      consume_buffer(ctxt, buf, 0, 1);      APR_BUCKET_REMOVE(b);      APR_BRIGADE_INSERT_TAIL(ctxt->bb, b);      ap_pass_brigade(ctxt->f->next, ctxt->bb);      return APR_SUCCESS;    }    if(apr_bucket_read(b, &buf, &bytes, APR_BLOCK_READ) == APR_SUCCESS && buf) {      if(ctxt->parser == NULL) {        /*         * for now, always output utf-8; we could incorporate         * mod_proxy_html's output transcoding with little problem if         * necessary         */        ap_set_content_type(f->r, "text/html;charset=utf-8");        if(!initialize_parser(f, ctxt, &buf, bytes)) {          apr_status_t rv = ap_pass_brigade(ctxt->f->next, bb);          ap_remove_output_filter(f);          return rv;        } else          ap_fputs(f->next, ctxt->bb, ctxt->cfg->doctype);      }      consume_buffer(ctxt, buf, bytes, 0);    }  }  /*ap_fflush(ctxt->f->next, ctxt->bb) ; */      /* uncomment for debug */  apr_brigade_cleanup(bb);  return APR_SUCCESS;}
开发者ID:carriercomm,项目名称:mod_cdn,代码行数:46,


示例25: AP_DECLARE

AP_DECLARE(apr_status_t) ap_save_brigade(ap_filter_t *f,                                         apr_bucket_brigade **saveto,                                         apr_bucket_brigade **b, apr_pool_t *p){    apr_bucket *e;    apr_status_t rv, srv = APR_SUCCESS;    /* If have never stored any data in the filter, then we had better     * create an empty bucket brigade so that we can concat.     */    if (!(*saveto)) {        *saveto = apr_brigade_create(p, f->c->bucket_alloc);    }    for (e = APR_BRIGADE_FIRST(*b);         e != APR_BRIGADE_SENTINEL(*b);         e = APR_BUCKET_NEXT(e))    {        rv = apr_bucket_setaside(e, p);        /* If the bucket type does not implement setaside, then         * (hopefully) morph it into a bucket type which does, and set         * *that* aside... */        if (rv == APR_ENOTIMPL) {            const char *s;            apr_size_t n;            rv = apr_bucket_read(e, &s, &n, APR_BLOCK_READ);            if (rv == APR_SUCCESS) {                rv = apr_bucket_setaside(e, p);            }        }        if (rv != APR_SUCCESS) {            srv = rv;            /* Return an error but still save the brigade if             * ->setaside() is really not implemented. */            if (rv != APR_ENOTIMPL) {                return rv;            }        }    }    APR_BRIGADE_CONCAT(*saveto, *b);    return srv;}
开发者ID:MHMDhub,项目名称:ModSecurity,代码行数:45,


示例26: getsfunc_BRIGADE

static int getsfunc_BRIGADE(char *buf, int len, void *arg){    apr_bucket_brigade *bb = (apr_bucket_brigade *)arg;    const char *dst_end = buf + len - 1; /* leave room for terminating null */    char *dst = buf;    apr_bucket *e = APR_BRIGADE_FIRST(bb);    apr_status_t rv;    int done = 0;    while ((dst < dst_end) && !done && e != APR_BRIGADE_SENTINEL(bb)           && !APR_BUCKET_IS_EOS(e)) {        const char *bucket_data;        apr_size_t bucket_data_len;        const char *src;        const char *src_end;        apr_bucket * next;        rv = apr_bucket_read(e, &bucket_data, &bucket_data_len,                             APR_BLOCK_READ);        if (rv != APR_SUCCESS || (bucket_data_len == 0)) {            *dst = '/0';            return APR_STATUS_IS_TIMEUP(rv) ? -1 : 0;        }        src = bucket_data;        src_end = bucket_data + bucket_data_len;        while ((src < src_end) && (dst < dst_end) && !done) {            if (*src == '/n') {                done = 1;            }            else if (*src != '/r') {                *dst++ = *src;            }            src++;        }        if (src < src_end) {            apr_bucket_split(e, src - bucket_data);        }        next = APR_BUCKET_NEXT(e);        apr_bucket_delete(e);        e = next;    }    *dst = 0;    return done;}
开发者ID:MichealYangGitHub,项目名称:C,代码行数:45,


示例27: discard_script_output

static void discard_script_output(apr_bucket_brigade *bb){    apr_bucket *e;    const char *buf;    apr_size_t len;    apr_status_t rv;    e = APR_BRIGADE_FIRST(bb);    while (e != APR_BRIGADE_SENTINEL(bb)) {        if (APR_BUCKET_IS_EOS(e)) {            break;        }        rv = apr_bucket_read(e, &buf, &len, APR_BLOCK_READ);        if (rv != APR_SUCCESS) {            break;        }        e = APR_BUCKET_NEXT(e);    }}
开发者ID:dallison,项目名称:aikido3,代码行数:18,


示例28: ironbee_output_filter

/** * @internal * * "Sniffs" the output (response) data from the connection stream. */static int ironbee_output_filter (ap_filter_t *f, apr_bucket_brigade *bb){    apr_bucket *b;#if 0    conn_rec *c = f->c;    ironbee_conn_context *ctx = f->ctx;    ib_conn_t *iconn = ctx->iconn;    ib_core_cfg_t *corecfg;    int buffering = 0;    /* Configure. */    ib_context_module_config(iconn->ctx, ib_core_module(), (void *)&corecfg);    if (corecfg != NULL) {        buffering = (int)corecfg->buffer_res;    }#endif    for (b = APR_BRIGADE_FIRST(bb); b != APR_BRIGADE_SENTINEL(bb); b = APR_BUCKET_NEXT(b)) {#if 0        /// @todo Should this be done?  Maybe only for proxy?        if (APR_BUCKET_IS_EOS(b)) {            /// @todo Do we need to do this? Maybe only for proxy.            apr_bucket *flush = apr_bucket_flush_create(f->c->bucket_alloc);            APR_BUCKET_INSERT_BEFORE(b, flush);        }        if (buffering) {            /// @todo setaside into our own pool to destroy later???            apr_bucket_setaside(b, c->pool);            process_bucket(f, b);            APR_BUCKET_REMOVE(b);        }        else {#endif            process_bucket(f, b);#if 0        }#endif    }    return ap_pass_brigade(f->next, bb);}
开发者ID:igalic,项目名称:ironbee,代码行数:48,



注:本文中的APR_BUCKET_NEXT函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ APR_HDR_FIELD函数代码示例
C++ APR_BUCKET_IS_EOS函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。