mod_bucketeer.c revision 36ef8f77bffe75d1aa327882be1b5bdbe2ff567a
/* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* mod_bucketeer.c: split buckets whenever we find a control-char
*
* Written by Ian Holsman
*
*/
#include "httpd.h"
#include "http_config.h"
#include "http_log.h"
#include "apr_strings.h"
#include "apr_general.h"
#include "util_filter.h"
#include "apr_buckets.h"
#include "http_request.h"
#include "http_protocol.h"
static const char bucketeerFilterName[] = "BUCKETEER";
typedef struct bucketeer_filter_config_t
{
char bucketdelimiter;
char passdelimiter;
char flushdelimiter;
{
bucketeer_filter_config_t *c = apr_pcalloc(p, sizeof *c);
return c;
}
typedef struct bucketeer_ctx_t
{
{
apr_bucket *e;
request_rec *r = f->r;
/* If have a context, it means we've done this before successfully. */
if (!ctx) {
}
/* We're cool with filtering this. */
}
for (e = APR_BRIGADE_FIRST(bb);
e != APR_BRIGADE_SENTINEL(bb);
e = APR_BUCKET_NEXT(e))
{
const char *data;
if (APR_BUCKET_IS_EOS(e)) {
/* Okay, we've seen the EOS.
* Time to pass it along down the chain.
*/
}
if (APR_BUCKET_IS_FLUSH(e)) {
/*
* Ignore flush buckets for the moment..
* we decide what to stream
*/
continue;
}
if (APR_BUCKET_IS_METADATA(e)) {
/* metadata bucket */
apr_bucket_copy(e, &cpy);
continue;
}
/* read */
if (len > 0) {
lastpos = 0;
for (i = 0; i < len; i++) {
if (data[i] == c->flushdelimiter ||
data[i] == c->bucketdelimiter ||
data[i] == c->passdelimiter) {
apr_bucket *p;
if (i - lastpos > 0) {
i - lastpos),
i - lastpos,
f->r->pool,
f->c->bucket_alloc);
}
lastpos = i + 1;
if (data[i] == c->flushdelimiter) {
p = apr_bucket_flush_create(f->c->bucket_alloc);
}
if (data[i] == c->passdelimiter) {
if (rv) {
return rv;
}
}
}
}
/* XXX: really should append this to the next 'real' bucket */
if (lastpos < i) {
apr_bucket *p;
i - lastpos),
i - lastpos,
f->r->pool,
f->c->bucket_alloc);
lastpos = i;
}
}
}
return APR_SUCCESS;
}
static void register_hooks(apr_pool_t * p)
{
}
static const command_rec bucketeer_filter_cmds[] = {
{NULL}
};
NULL,
NULL,
NULL,
};