From 2356e5c17cb288430cac4914984dbd7da3900f54 Mon Sep 17 00:00:00 2001 From: Greg Stein Date: Thu, 9 Nov 2000 10:21:12 +0000 Subject: [PATCH] minor tweaks, cleanup, comments. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@86882 13f79535-47bb-0310-9956-ffa450edef68 --- modules/http/http_protocol.c | 23 ++++++++++++++--------- server/util_filter.c | 17 +++++++++++------ 2 files changed, 25 insertions(+), 15 deletions(-) diff --git a/modules/http/http_protocol.c b/modules/http/http_protocol.c index 82a59d8624..3c07e94936 100644 --- a/modules/http/http_protocol.c +++ b/modules/http/http_protocol.c @@ -201,7 +201,6 @@ AP_CORE_DECLARE_NONSTD(apr_status_t) ap_byterange_filter( apr_off_t range_end; char *current; const char *bound_head; - const char *ct = make_content_type(r, r->content_type); if (!ctx) { int num_ranges = ap_set_byterange(r); @@ -210,9 +209,12 @@ AP_CORE_DECLARE_NONSTD(apr_status_t) ap_byterange_filter( ap_remove_output_filter(f); return ap_pass_brigade(f->next, bb); } + ctx = f->ctx = apr_pcalloc(r->pool, sizeof(*ctx)); - ctx->num_ranges = ap_set_byterange(r); - + ctx->num_ranges = num_ranges; + + /* create a brigade in case we never call ap_save_brigade() */ + ctx->bb = ap_brigade_create(r->pool); } /* We can't actually deal with byte-ranges until we have the whole brigade @@ -224,16 +226,18 @@ AP_CORE_DECLARE_NONSTD(apr_status_t) ap_byterange_filter( return APR_SUCCESS; } - /* compute this once (it is an invariant) and store it away */ - bound_head = apr_pstrcat(r->pool, CRLF "--", r->boundary, - CRLF "Content-type: ", ct, - CRLF "Content-range: bytes ", - NULL); + /* compute this once (it is an invariant) */ + bound_head = apr_pstrcat(r->pool, + CRLF "--", r->boundary, + CRLF "Content-type: ", + make_content_type(r, r->content_type), + CRLF "Content-range: bytes ", + NULL); /* concat the passed brigade with our saved brigade */ AP_BRIGADE_CONCAT(ctx->bb, bb); bb = ctx->bb; - ctx->bb = NULL; /* ### strictly necessary? */ + ctx->bb = NULL; /* ### strictly necessary? call brigade_destroy? */ /* this brigade holds what we will be sending */ bsend = ap_brigade_create(r->pool); @@ -2319,6 +2323,7 @@ static int ap_set_byterange(request_rec *r) apr_off_t range_end; int num_ranges; + /* ### this test for r->clength is probably a Bad Thing. need to fix */ if (!r->clength || r->assbackwards) return 0; diff --git a/server/util_filter.c b/server/util_filter.c index 937db41777..64ad1c863e 100644 --- a/server/util_filter.c +++ b/server/util_filter.c @@ -53,6 +53,7 @@ */ #include "httpd.h" +#include "http_log.h" #include "util_filter.h" /* ### make this visible for direct manipulation? @@ -108,8 +109,7 @@ AP_DECLARE(void) ap_register_input_filter(const char *name, { ap_filter_func f; f.in_func = filter_func; - register_filter(name, f, ftype, - ®istered_input_filters); + register_filter(name, f, ftype, ®istered_input_filters); } AP_DECLARE(void) ap_register_output_filter(const char *name, @@ -118,8 +118,7 @@ AP_DECLARE(void) ap_register_output_filter(const char *name, { ap_filter_func f; f.out_func = filter_func; - register_filter(name, f, ftype, - ®istered_output_filters); + register_filter(name, f, ftype, ®istered_output_filters); } AP_DECLARE(void) ap_add_input_filter(const char *name, void *ctx, @@ -150,9 +149,12 @@ AP_DECLARE(void) ap_add_input_filter(const char *name, void *ctx, fscan->next = f; } - break; + return; } } + + ap_log_error(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, 0, NULL, + "an unknown input filter was not added: %s", name); } AP_DECLARE(void) ap_remove_output_filter(ap_filter_t *f) @@ -208,9 +210,12 @@ AP_DECLARE(void) ap_add_output_filter(const char *name, void *ctx, fscan->next = f; } - break; + return; } } + + ap_log_error(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, 0, NULL, + "an unknown output filter was not added: %s", name); } /* -- 2.50.1