]> granicus.if.org Git - apache/commitdiff
minor tweaks, cleanup, comments.
authorGreg Stein <gstein@apache.org>
Thu, 9 Nov 2000 10:21:12 +0000 (10:21 +0000)
committerGreg Stein <gstein@apache.org>
Thu, 9 Nov 2000 10:21:12 +0000 (10:21 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@86882 13f79535-47bb-0310-9956-ffa450edef68

modules/http/http_protocol.c
server/util_filter.c

index 82a59d86249023e8b4f08020177eced5e945420c..3c07e94936721d40ce8738cc4a27d0be86f9d612 100644 (file)
@@ -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;
 
index 937db4177799659943e560dadb466035b773b4f9..64ad1c863e701e0188e8a7be004a5b2affcedc0a 100644 (file)
@@ -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, 
-                    &registered_input_filters);
+    register_filter(name, f, ftype, &registered_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, 
-                    &registered_output_filters);
+    register_filter(name, f, ftype, &registered_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);
 }
 
 /*