]> granicus.if.org Git - apache/commitdiff
add new input filter mode AP_MODE_INIT:
authorDoug MacEachern <dougm@apache.org>
Mon, 19 Nov 2001 22:36:20 +0000 (22:36 +0000)
committerDoug MacEachern <dougm@apache.org>
Mon, 19 Nov 2001 22:36:20 +0000 (22:36 +0000)
allows filters such as mod_ssl to initialize a client connection
(ie handshake) before reading request data from the client.
PR:
Obtained from:
Submitted by:   dougm
Reviewed by: wrowe

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

include/util_filter.h
server/core.c

index c8ea335ab99a243214a5e1ed246e2d970133ccb0..7a45c7c6f7e17d87476e8541f0a9ef7a6f24c82a 100644 (file)
@@ -97,7 +97,12 @@ typedef enum {
      *  ::APR_EOF otherwise.  The filter must not return any buckets of
      *  data.  Data returned on a subsequent call, when mode is
      *  ::AP_MODE_BLOCKING or ::AP_MODE_NONBLOCKING. */
-    AP_MODE_PEEK
+    AP_MODE_PEEK,
+    /*
+     * the filter should initialize the connection if needed,
+     * NNTP or FTP over SSL for example.
+     */
+    AP_MODE_INIT
 } ap_input_mode_t;
 
 /**
index 2ba05b92f13339ad8a7c2d457f332c2d6bca5381..3b461c6f6911c039d323876418b931c5a6abf1ef 100644 (file)
@@ -2790,6 +2790,20 @@ static int core_input_filter(ap_filter_t *f, apr_bucket_brigade *b, ap_input_mod
     apr_size_t len;
     int keptalive = f->c->keepalive == 1;
 
+    if (mode == AP_MODE_INIT) {
+        /*
+         * this mode is for filters that might need to 'initialize'
+         * a connection before reading request data from a client.
+         * NNTP over SSL for example needs to handshake before the 
+         * server sends the welcome message.
+         * such filters would have changed the mode before this point
+         * is reached.  however, protocol modules such as NNTP should
+         * not need to know anything about SSL.  given the example, if
+         * SSL is not in the filter chain, AP_MODE_INIT is a noop.
+         */
+        return APR_SUCCESS;
+    }
+
     if (!ctx)
     {
         ctx = apr_pcalloc(f->c->pool, sizeof(*ctx));