mod_bucketeer.c revision e2f3f3a981b845a0f26efacbe145659a63240944
6ae232055d4d8a97267517c5e50074c2c819941and/* Licensed to the Apache Software Foundation (ASF) under one or more
6ae232055d4d8a97267517c5e50074c2c819941and * contributor license agreements. See the NOTICE file distributed with
6ae232055d4d8a97267517c5e50074c2c819941and * this work for additional information regarding copyright ownership.
6ae232055d4d8a97267517c5e50074c2c819941and * The ASF licenses this file to You under the Apache License, Version 2.0
6ae232055d4d8a97267517c5e50074c2c819941and * (the "License"); you may not use this file except in compliance with
6ae232055d4d8a97267517c5e50074c2c819941and * the License. You may obtain a copy of the License at
6ae232055d4d8a97267517c5e50074c2c819941and * Unless required by applicable law or agreed to in writing, software
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen * distributed under the License is distributed on an "AS IS" BASIS,
2e545ce2450a9953665f701bb05350f0d3f26275nd * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen * See the License for the specific language governing permissions and
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen * limitations under the License.
af33a4994ae2ff15bc67d19ff1a7feb906745bf8rbowen * mod_bucketeer.c: split buckets whenever we find a control-char
6ae232055d4d8a97267517c5e50074c2c819941and * Written by Ian Holsman
6ae232055d4d8a97267517c5e50074c2c819941andstatic void *create_bucketeer_server_config(apr_pool_t *p, server_rec *s)
6ae232055d4d8a97267517c5e50074c2c819941and bucketeer_filter_config_t *c = apr_pcalloc(p, sizeof *c);
1f1b6bf13313fdd14a45e52e553d3ff28689b717coarstatic apr_status_t bucketeer_out_filter(ap_filter_t *f,
6ae232055d4d8a97267517c5e50074c2c819941and c = ap_get_module_config(r->server->module_config, &bucketeer_module);
6a3ab831a34f470b077294a173f24fcf1e5f0a3ctakashi /* If have a context, it means we've done this before successfully. */
6ae232055d4d8a97267517c5e50074c2c819941and if (!r->content_type || strncmp(r->content_type, "text/", 5)) {
6ae232055d4d8a97267517c5e50074c2c819941and /* We're cool with filtering this. */
6a3ab831a34f470b077294a173f24fcf1e5f0a3ctakashi ctx->bb = apr_brigade_create(f->r->pool, f->c->bucket_alloc);
6ae232055d4d8a97267517c5e50074c2c819941and const char *data;
6ae232055d4d8a97267517c5e50074c2c819941and /* Okay, we've seen the EOS.
6ae232055d4d8a97267517c5e50074c2c819941and * Time to pass it along down the chain.
6ae232055d4d8a97267517c5e50074c2c819941and * Ignore flush buckets for the moment..
6ae232055d4d8a97267517c5e50074c2c819941and * we decide what to stream
6ae232055d4d8a97267517c5e50074c2c819941and /* metadata bucket */
6ae232055d4d8a97267517c5e50074c2c819941and /* read */
6ae232055d4d8a97267517c5e50074c2c819941and if (len > 0) {
6ae232055d4d8a97267517c5e50074c2c819941and for (i = 0; i < len; i++) {
6a3ab831a34f470b077294a173f24fcf1e5f0a3ctakashi if (i - lastpos > 0) {
6ae232055d4d8a97267517c5e50074c2c819941and /* XXX: really should append this to the next 'real' bucket */