<commit_before>#include "mod_perl.h"

/* helper funcs */

#define MP_FILTER_NAME_FORMAT "   %s\n\n\t"

#define MP_FILTER_NAME(f) \
    ((modperl_filter_ctx_t *)f->ctx)->handler->name

#define MP_FILTER_TYPE(filter) \
    ((modperl_filter_ctx_t *)filter->f->ctx)->handler->attrs & \
        MP_FILTER_CONNECTION_HANDLER  ? "connection" : "request"

#define MP_FILTER_MODE(filter) \
    (filter->mode == MP_INPUT_FILTER_MODE ? "input" : "output")

#define MP_FILTER_POOL(f) f->r ? f->r->pool : f->c->pool

/* this function is for tracing only, it's not optimized for performance */
static const char* next_filter_name(ap_filter_t *f)
{
    const char *name = f->frec->name;

    /* frec->name is always lowercased */ 
    if (ap_strcasecmp_match(name, MP_FILTER_CONNECTION_INPUT_NAME)  ||
        ap_strcasecmp_match(name, MP_FILTER_CONNECTION_OUTPUT_NAME) ||
        ap_strcasecmp_match(name, MP_FILTER_REQUEST_INPUT_NAME)     ||
        ap_strcasecmp_match(name, MP_FILTER_REQUEST_OUTPUT_NAME) ) {
        return ((modperl_filter_ctx_t *)f->ctx)->handler->name;
    }
    else {
        return name;
    }
}

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;
    return APR_SUCCESS;
}

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);
    return APR_SUCCESS;
}<commit_msg>use strcasecmp to compare strings ignoring case PR: Obtained from: Submitted by: Reviewed by:<commit_after>#include "mod_perl.h"

/* helper funcs */

#define MP_FILTER_NAME_FORMAT "   %s\n\n\t"

#define MP_FILTER_NAME(f) \
    ((modperl_filter_ctx_t *)f->ctx)->handler->name

#define MP_FILTER_TYPE(filter) \
    ((modperl_filter_ctx_t *)filter->f->ctx)->handler->attrs & \
        MP_FILTER_CONNECTION_HANDLER  ? "connection" : "request"

#define MP_FILTER_MODE(filter) \
    (filter->mode == MP_INPUT_FILTER_MODE ? "input" : "output")

#define MP_FILTER_POOL(f) f->r ? f->r->pool : f->c->pool

/* this function is for tracing only, it's not optimized for performance */
static const char* next_filter_name(ap_filter_t *f)
{
    const char *name = f->frec->name;

    /* frec->name is always lowercased */ 
    if (!strcasecmp(name, MP_FILTER_CONNECTION_INPUT_NAME)  ||
        !strcasecmp(name, MP_FILTER_CONNECTION_OUTPUT_NAME) ||
        !strcasecmp(name, MP_FILTER_REQUEST_INPUT_NAME)     ||
        !strcasecmp(name, MP_FILTER_REQUEST_OUTPUT_NAME) ) {
        return ((modperl_filter_ctx_t *)f->ctx)->handler->name;
    }
    else {
        return name;
    }
}

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;
    return APR_SUCCESS;
}

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);
    return APR_SUCCESS;
}
{'fraction_non_alphanumeric': 0.12857977790765635, 'fraction_numerical': 0.0005844535359438924, 'mean_word_length': 4.202127659574468, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 63, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4208125', 'n_tokens_mistral': 1297, 'n_tokens_neox': 1274, 'n_words': 215}