From 4bf14d2b359cb42bd9d4c0f96c944b803744ec63 Mon Sep 17 00:00:00 2001 From: Doug MacEachern Date: Mon, 19 Nov 2001 22:36:20 +0000 Subject: [PATCH] add new input filter mode AP_MODE_INIT: 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 | 7 ++++++- server/core.c | 14 ++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/include/util_filter.h b/include/util_filter.h index c8ea335ab9..7a45c7c6f7 100644 --- a/include/util_filter.h +++ b/include/util_filter.h @@ -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; /** diff --git a/server/core.c b/server/core.c index 2ba05b92f1..3b461c6f69 100644 --- a/server/core.c +++ b/server/core.c @@ -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)); -- 2.50.1