1
0
mirror of https://github.com/apache/httpd.git synced 2025-08-07 04:02:58 +03:00

Add a way to remove output filters. This is used by http_header_filter to

remove itself once it has actually sent the headers.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@86690 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Ryan Bloom
2000-10-21 17:22:28 +00:00
parent 6b22f05745
commit 1c795234e1
3 changed files with 28 additions and 5 deletions

View File

@@ -360,6 +360,8 @@ AP_DECLARE(void) ap_add_input_filter(const char *name, void *ctx, request_rec *r
AP_DECLARE(void) ap_add_output_filter(const char *name, void *ctx,
request_rec *r, conn_rec *c);
AP_DECLARE(void) ap_remove_output_filter(ap_filter_t *f);
/* The next two filters are for abstraction purposes only. They could be
* done away with, but that would require that we break modules if we ever
* want to change our filter registration method. The basic idea, is that

View File

@@ -2228,11 +2228,6 @@ AP_CORE_DECLARE(int) ap_http_header_filter(ap_filter_t *f, ap_bucket_brigade *b)
char *date = NULL;
request_rec *r = f->r;
if ((int)f->ctx != 0) {
return ap_pass_brigade(f->next, b);
}
(int)f->ctx++;
if (r->assbackwards) {
if (!r->main)
ap_bsetopt(r->connection->client, BO_BYTECT, &zero);
@@ -2325,6 +2320,7 @@ AP_CORE_DECLARE(int) ap_http_header_filter(ap_filter_t *f, ap_bucket_brigade *b)
if (r->chunked) {
ap_bsetflag(r->connection->client, B_CHUNK, 1);
}
ap_remove_output_filter(f);
return ap_pass_brigade(f->next, b);
}

View File

@@ -155,6 +155,31 @@ AP_DECLARE(void) ap_add_input_filter(const char *name, void *ctx,
}
}
AP_DECLARE(void) ap_remove_output_filter(ap_filter_t *f)
{
ap_filter_t *curr;
curr = f->r ? f->r->output_filters : f->c->output_filters;
if (curr == f) {
if (f->r) {
f->r->output_filters = f->r->output_filters->next;
}
else {
f->c->output_filters = f->c->output_filters->next;
}
return;
}
while (curr->next != f) {
if (curr == NULL) {
return;
}
curr = curr->next;
}
curr->next = f->next ? f->next : NULL;
}
AP_DECLARE(void) ap_add_output_filter(const char *name, void *ctx,
request_rec *r, conn_rec *c)
{