From c8d300bd441bdd99b26a02d74efc765a71b715d3 Mon Sep 17 00:00:00 2001 From: Greg Stein Date: Wed, 24 Jan 2001 02:14:23 +0000 Subject: [PATCH] Begin mod_core.h for CORE-private information. Ideally, AP_CORE_DECLARE function decl's and CORE_PRIVATE header info should all move into this header. Start with moving the filter function declarations. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@87808 13f79535-47bb-0310-9956-ffa450edef68 --- include/http_protocol.h | 11 ----- modules/http/http_core.c | 13 ++--- modules/http/http_protocol.c | 16 ++++--- modules/http/http_request.c | 29 +++++++++--- modules/http/mod_core.h | 92 ++++++++++++++++++++++++++++++++++++ 5 files changed, 130 insertions(+), 31 deletions(-) create mode 100644 modules/http/mod_core.h diff --git a/include/http_protocol.h b/include/http_protocol.h index 9347ecaee9..578e03d170 100644 --- a/include/http_protocol.h +++ b/include/http_protocol.h @@ -62,8 +62,6 @@ #include "apr_hooks.h" #include "apr_portable.h" #include "apr_mmap.h" -#include "util_filter.h" -#include "apr_buckets.h" #ifdef __cplusplus extern "C" { @@ -103,12 +101,6 @@ AP_DECLARE(void) ap_basic_http_header(request_rec *r, char *buf); */ AP_DECLARE(void) ap_send_http_header(request_rec *l); -AP_CORE_DECLARE_NONSTD(apr_status_t) ap_byterange_filter(ap_filter_t *f, apr_bucket_brigade *b); -AP_CORE_DECLARE_NONSTD(apr_status_t) ap_http_header_filter(ap_filter_t *f, apr_bucket_brigade *b); -AP_CORE_DECLARE_NONSTD(apr_status_t) ap_content_length_filter(ap_filter_t *, - apr_bucket_brigade *); -AP_CORE_DECLARE_NONSTD(apr_status_t) ap_old_write_filter(ap_filter_t *f, apr_bucket_brigade *b); - /* Send the response to special method requests */ AP_DECLARE(int) ap_send_http_trace(request_rec *r); @@ -519,9 +511,6 @@ AP_DECLARE(int) ap_method_number_of(const char *method); */ AP_DECLARE(const char *) ap_method_name_of(int methnum); -apr_status_t ap_http_filter(ap_filter_t *f, apr_bucket_brigade *b, ap_input_mode_t mode); -apr_status_t ap_dechunk_filter(ap_filter_t *f, apr_bucket_brigade *b, ap_input_mode_t mode); - /* Hooks */ /* diff --git a/modules/http/http_core.c b/modules/http/http_core.c index 4578b4b9b5..4545cb4761 100644 --- a/modules/http/http_core.c +++ b/modules/http/http_core.c @@ -62,9 +62,10 @@ #include "apr_fnmatch.h" #include "apr_thread_proc.h" /* for RLIMIT stuff */ -#if APR_HAVE_SYS_UIO_H -#include /* for iovec */ -#endif +#define APR_WANT_IOVEC +#define APR_WANT_STRFUNC +#define APR_WANT_MEMFUNC +#include "apr_want.h" #define CORE_PRIVATE #include "ap_config.h" @@ -84,15 +85,15 @@ #include "util_ebcdic.h" #include "mpm.h" +#include "mod_core.h" + #ifdef HAVE_SYS_SOCKET_H #include #endif #ifdef HAVE_ARPA_INET_H #include #endif -#ifdef HAVE_STRINGS_H -#include -#endif + /* LimitXMLRequestBody handling */ #define AP_LIMIT_UNSET ((long) -1) diff --git a/modules/http/http_protocol.c b/modules/http/http_protocol.c index 8d2ee07bf0..9357eed87d 100644 --- a/modules/http/http_protocol.c +++ b/modules/http/http_protocol.c @@ -65,16 +65,18 @@ #include "apr.h" #include "apr_strings.h" +#include "apr_buckets.h" + +#define APR_WANT_STDIO /* for sscanf */ +#define APR_WANT_STRFUNC +#define APR_WANT_MEMFUNC +#include "apr_want.h" -#if APR_HAVE_STDIO_H -#include /* for EOF, sscanf() */ -#endif #if APR_HAVE_STDARG_H #include #endif #define CORE_PRIVATE -#include "apr_buckets.h" #include "util_filter.h" #include "ap_config.h" #include "httpd.h" @@ -91,12 +93,12 @@ #include "util_ebcdic.h" #include "mpm_status.h" +#include "mod_core.h" + #ifdef HAVE_UNISTD_H #include #endif -#ifdef HAVE_STRINGS_H -#include -#endif + APR_HOOK_STRUCT( APR_HOOK_LINK(post_read_request) diff --git a/modules/http/http_request.c b/modules/http/http_request.c index f8a69f8409..28807e59db 100644 --- a/modules/http/http_request.c +++ b/modules/http/http_request.c @@ -66,6 +66,10 @@ * */ +#include "apr_strings.h" +#include "apr_file_io.h" +#include "apr_fnmatch.h" + #define CORE_PRIVATE #include "ap_config.h" #include "httpd.h" @@ -77,9 +81,9 @@ #include "http_main.h" #include "util_filter.h" #include "util_charset.h" -#include "apr_strings.h" -#include "apr_file_io.h" -#include "apr_fnmatch.h" + +#include "mod_core.h" + #ifdef APR_HAVE_STDARG_H #include #endif @@ -1358,15 +1362,26 @@ static void process_request_internal(request_rec *r) static void check_pipeline_flush(request_rec *r) { + /* ### if would be nice if we could PEEK without a brigade. that would + ### allow us to defer creation of the brigade to when we actually + ### need to send a FLUSH. */ apr_bucket_brigade *bb = apr_brigade_create(r->pool); + + /* Flush the filter contents if: + * + * 1) the connection will be closed + * 2) there isn't a request ready to be read + */ + /* ### shouldn't this read from the connection input filters? */ if (!r->connection->keepalive || ap_get_brigade(r->input_filters, bb, AP_MODE_PEEK) != APR_SUCCESS) { apr_bucket *e = apr_bucket_create_flush(); - /* We just send directly to the connection based filters, because at - * this point, we know that we have seen all of the data, so we just - * want to flush the buckets if something hasn't been sent to the - * network yet. + /* We just send directly to the connection based filters. At + * this point, we know that we have seen all of the data + * (request finalization sent an EOS bucket, which empties all + * of the request filters). We just want to flush the buckets + * if something hasn't been sent to the network yet. */ APR_BRIGADE_INSERT_HEAD(bb, e); ap_pass_brigade(r->connection->output_filters, bb); diff --git a/modules/http/mod_core.h b/modules/http/mod_core.h new file mode 100644 index 0000000000..91c35e081b --- /dev/null +++ b/modules/http/mod_core.h @@ -0,0 +1,92 @@ +/* ==================================================================== + * The Apache Software License, Version 1.1 + * + * Copyright (c) 2000 The Apache Software Foundation. All rights + * reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. The end-user documentation included with the redistribution, + * if any, must include the following acknowledgment: + * "This product includes software developed by the + * Apache Software Foundation (http://www.apache.org/)." + * Alternately, this acknowledgment may appear in the software itself, + * if and wherever such third-party acknowledgments normally appear. + * + * 4. The names "Apache" and "Apache Software Foundation" must + * not be used to endorse or promote products derived from this + * software without prior written permission. For written + * permission, please contact apache@apache.org. + * + * 5. Products derived from this software may not be called "Apache", + * nor may "Apache" appear in their name, without prior written + * permission of the Apache Software Foundation. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * ==================================================================== + * + * This software consists of voluntary contributions made by many + * individuals on behalf of the Apache Software Foundation. For more + * information on the Apache Software Foundation, please see + * . + */ + +#ifndef MOD_CORE_H +#define MOD_CORE_H + +#include "apr.h" +#include "apr_buckets.h" + +#include "httpd.h" +#include "util_filter.h" + + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @package mod_core private header file + */ + +/* + * These (output) filters are internal to the mod_core operation. + */ +AP_CORE_DECLARE_NONSTD(apr_status_t) ap_byterange_filter(ap_filter_t *f, apr_bucket_brigade *b); +AP_CORE_DECLARE_NONSTD(apr_status_t) ap_http_header_filter(ap_filter_t *f, apr_bucket_brigade *b); +AP_CORE_DECLARE_NONSTD(apr_status_t) ap_content_length_filter(ap_filter_t *, + apr_bucket_brigade *); +AP_CORE_DECLARE_NONSTD(apr_status_t) ap_old_write_filter(ap_filter_t *f, apr_bucket_brigade *b); + +/* + * These (input) filters are internal to the mod_core operation. + */ +apr_status_t ap_http_filter(ap_filter_t *f, apr_bucket_brigade *b, ap_input_mode_t mode); +apr_status_t ap_dechunk_filter(ap_filter_t *f, apr_bucket_brigade *b, ap_input_mode_t mode); + +#ifdef __cplusplus +} +#endif + +#endif /* !MOD_CORE_H */ -- 2.50.1