]> granicus.if.org Git - apache/commitdiff
Replaced some more ap_add_output_filter() calls with
authorBrian Pane <brianp@apache.org>
Sun, 27 Jan 2002 19:12:56 +0000 (19:12 +0000)
committerBrian Pane <brianp@apache.org>
Sun, 27 Jan 2002 19:12:56 +0000 (19:12 +0000)
ap_add_output_filter_handle() for efficiency

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@93051 13f79535-47bb-0310-9956-ffa450edef68

include/http_core.h
modules/http/http_core.c

index d4cfc38711f3a7790bc40265ac8d945381806081..d03469647fbecb932bfad3243483d4664dad6a23 100644 (file)
@@ -578,6 +578,10 @@ extern ap_filter_rec_t *ap_core_output_filter_handle;
 extern ap_filter_rec_t *ap_content_length_filter_handle;
 extern ap_filter_rec_t *ap_net_time_filter_handle;
 extern ap_filter_rec_t *ap_core_input_filter_handle;
+extern ap_filter_rec_t *ap_http_input_filter_handle;
+extern ap_filter_rec_t *ap_http_header_filter_handle;
+extern ap_filter_rec_t *ap_chunk_filter_handle;
+extern ap_filter_rec_t *ap_byterange_filter_handle;
 
 /**
  * This hook provdes a way for modules to provide metrics/statistics about
index b61877b0497e4f2ce32cd36d20b57f3c53dbf49a..64a58d39b08943b79d5da8146fdfac6daeca9b7a 100644 (file)
@@ -66,6 +66,7 @@
 #include "httpd.h"
 #include "http_config.h"
 #include "http_connection.h"
+#include "http_core.h"
 #include "http_protocol.h"     /* For index_of_response().  Grump. */
 #include "http_request.h"
 
 
 #include "mod_core.h"
 
+/* Handles for core filters */
+ap_filter_rec_t *ap_http_input_filter_handle;
+ap_filter_rec_t *ap_http_header_filter_handle;
+ap_filter_rec_t *ap_chunk_filter_handle;
+ap_filter_rec_t *ap_byterange_filter_handle;
+
 static const char *set_keep_alive_timeout(cmd_parms *cmd, void *dummy,
                                          const char *arg)
 {
@@ -261,8 +268,8 @@ static apr_port_t http_port(const request_rec *r)
     { return DEFAULT_HTTP_PORT; }
 static int ap_pre_http_connection(conn_rec *c)
 {
-    ap_add_input_filter("CORE_IN", NULL, NULL, c);
-    ap_add_output_filter("CORE", NULL, NULL, c);
+    ap_add_input_filter_handle(ap_core_input_filter_handle, NULL, NULL, c);
+    ap_add_output_filter_handle(ap_core_output_filter_handle, NULL, NULL, c);
     return OK;
 }
 static int ap_process_http_connection(conn_rec *c)
@@ -303,9 +310,12 @@ static int ap_process_http_connection(conn_rec *c)
 static void ap_http_insert_filter(request_rec *r)
 {
     if (!r->main) {
-        ap_add_output_filter("BYTERANGE", NULL, r, r->connection);
-        ap_add_output_filter("CONTENT_LENGTH", NULL, r, r->connection);
-        ap_add_output_filter("HTTP_HEADER", NULL, r, r->connection);
+        ap_add_output_filter_handle(ap_byterange_filter_handle,
+                                    NULL, r, r->connection);
+        ap_add_output_filter_handle(ap_content_length_filter_handle,
+                                    NULL, r, r->connection);
+        ap_add_output_filter_handle(ap_http_header_filter_handle,
+                                    NULL, r, r->connection);
     }
 }
 
@@ -319,12 +329,17 @@ static void register_hooks(apr_pool_t *p)
     ap_hook_http_method(http_method,NULL,NULL,APR_HOOK_REALLY_LAST);
     ap_hook_default_port(http_port,NULL,NULL,APR_HOOK_REALLY_LAST);
     ap_hook_insert_filter(ap_http_insert_filter, NULL, NULL, APR_HOOK_REALLY_LAST);
-    ap_register_input_filter("HTTP_IN", ap_http_filter, AP_FTYPE_CONNECTION);
-    ap_register_output_filter("HTTP_HEADER", ap_http_header_filter, 
-                              AP_FTYPE_HTTP_HEADER);
-    ap_register_output_filter("CHUNK", chunk_filter, AP_FTYPE_TRANSCODE);
-    ap_register_output_filter("BYTERANGE", ap_byterange_filter,
-                              AP_FTYPE_HTTP_HEADER);
+    ap_http_input_filter_handle =
+        ap_register_input_filter("HTTP_IN", ap_http_filter,
+                                 AP_FTYPE_CONNECTION);
+    ap_http_header_filter_handle =
+        ap_register_output_filter("HTTP_HEADER", ap_http_header_filter, 
+                                  AP_FTYPE_HTTP_HEADER);
+    ap_chunk_filter_handle =
+        ap_register_output_filter("CHUNK", chunk_filter, AP_FTYPE_TRANSCODE);
+    ap_byterange_filter_handle =
+        ap_register_output_filter("BYTERANGE", ap_byterange_filter,
+                                  AP_FTYPE_HTTP_HEADER);
 }
 
 module AP_MODULE_DECLARE_DATA http_module = {