From: Nick Kew Date: Sun, 9 Oct 2005 14:31:40 +0000 (+0000) Subject: Sync module moves (dbd, filter, charset_lite) and dbd updates with trunk X-Git-Tag: 2.1.9~52 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8823ac16637b853d76f7279818fe1e88c603c1d9;p=thirdparty%2Fapache%2Fhttpd.git Sync module moves (dbd, filter, charset_lite) and dbd updates with trunk git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.2.x@307440 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/Apache.dsw b/Apache.dsw index c4ecec64236..c99e624567c 100644 --- a/Apache.dsw +++ b/Apache.dsw @@ -1044,7 +1044,7 @@ Package=<4> ############################################################################### -Project: "mod_charset_lite"=.\modules\experimental\mod_charset_lite.dsp - Package Owner=<4> +Project: "mod_charset_lite"=.\modules\filters\mod_charset_lite.dsp - Package Owner=<4> Package=<5> {{{ diff --git a/CHANGES b/CHANGES index a2e9e70caa7..603122c5fe3 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,14 @@ -*- coding: utf-8 -*- Changes with Apache 2.1.9 + *) Support dbd connection tied to conn_rec in mod_dbd [Nick Kew] + + *) Fix use of pools in mod_dbd [Brian J France, Nick Kew] + + *) Move mod_dbd to modules/database [Nick Kew] + + *) Move mod_filter and mod_charset_lite to modules/filters [Nick Kew] + *) mod_proxy_ajp: mod_proxy_ajp sends empty SSL attributes for non SSL connections. PR36883. [William Barker , Ruediger Pluem] diff --git a/modules/NWGNUmakefile b/modules/NWGNUmakefile index 57387949b23..1bcbf7db772 100644 --- a/modules/NWGNUmakefile +++ b/modules/NWGNUmakefile @@ -17,6 +17,7 @@ SUBDIRS = \ metadata \ proxy \ filters \ + database \ $(EOLIST) # If LDAPSDK has been defined then build the util_ldap module diff --git a/modules/README b/modules/README index eab7067e0d0..f4d5549dbe3 100644 --- a/modules/README +++ b/modules/README @@ -10,6 +10,9 @@ cache/ This directory houses modules that implement file and data caching capability. +database/ + The apache DBD framework manages connections to SQL backends efficiently. + dav/ This directory houses modules that implement WebDAV functionality. diff --git a/modules/database/Makefile.in b/modules/database/Makefile.in new file mode 100644 index 00000000000..7c5c149d852 --- /dev/null +++ b/modules/database/Makefile.in @@ -0,0 +1,3 @@ +# a modules Makefile has no explicit targets -- they will be defined by +# whatever modules are enabled. just grab special.mk to deal with this. +include $(top_srcdir)/build/special.mk diff --git a/modules/database/NWGNUmakefile b/modules/database/NWGNUmakefile new file mode 100644 index 00000000000..9715ddaecab --- /dev/null +++ b/modules/database/NWGNUmakefile @@ -0,0 +1,261 @@ +# +# Declare the sub-directories to be built here +# + +SUBDIRS = \ + $(EOLIST) + +# +# Get the 'head' of the build environment. This includes default targets and +# paths to tools +# + +include $(AP_WORK)\build\NWGNUhead.inc + +# +# build this level's files + +# +# Make sure all needed macro's are defined +# + +# +# These directories will be at the beginning of the include list, followed by +# INCDIRS +# +XINCDIRS += \ + $(AP_WORK)/include \ + $(NWOS) \ + $(AP_WORK)/modules/arch/netware \ + $(APR)/include \ + $(APRUTIL)/include \ + $(APR) \ + $(EOLIST) + +# +# These flags will come after CFLAGS +# +XCFLAGS += \ + -prefix pre_nw.h \ + $(EOLIST) + +# +# These defines will come after DEFINES +# +XDEFINES += \ + $(EOLIST) + +# +# These flags will be added to the link.opt file +# +XLFLAGS += \ + $(EOLIST) + +# +# These values will be appended to the correct variables based on the value of +# RELEASE +# +ifeq "$(RELEASE)" "debug" +XINCDIRS += \ + $(EOLIST) + +XCFLAGS += \ + $(EOLIST) + +XDEFINES += \ + $(EOLIST) + +XLFLAGS += \ + $(EOLIST) +endif + +ifeq "$(RELEASE)" "noopt" +XINCDIRS += \ + $(EOLIST) + +XCFLAGS += \ + $(EOLIST) + +XDEFINES += \ + $(EOLIST) + +XLFLAGS += \ + $(EOLIST) +endif + +ifeq "$(RELEASE)" "release" +XINCDIRS += \ + $(EOLIST) + +XCFLAGS += \ + $(EOLIST) + +XDEFINES += \ + $(EOLIST) + +XLFLAGS += \ + $(EOLIST) +endif + +# +# These are used by the link target if an NLM is being generated +# This is used by the link 'name' directive to name the nlm. If left blank +# TARGET_nlm (see below) will be used. +# +NLM_NAME = moddbd + +# +# This is used by the link '-desc ' directive. +# If left blank, NLM_NAME will be used. +# +NLM_DESCRIPTION = Apache $(VERSION_STR) DBD Module + +# +# This is used by the '-threadname' directive. If left blank, +# NLM_NAME Thread will be used. +# +NLM_THREAD_NAME = DBD Module + +# +# If this is specified, it will override VERSION value in +# $(AP_WORK)\build\NWGNUenvironment.inc +# +NLM_VERSION = + +# +# If this is specified, it will override the default of 64K +# +NLM_STACK_SIZE = 8192 + + +# +# If this is specified it will be used by the link '-entry' directive +# +NLM_ENTRY_SYM = _LibCPrelude + +# +# If this is specified it will be used by the link '-exit' directive +# +NLM_EXIT_SYM = _LibCPostlude + +# +# If this is specified it will be used by the link '-check' directive +# +NLM_CHECK_SYM = + +# +# If these are specified it will be used by the link '-flags' directive +# +NLM_FLAGS = AUTOUNLOAD, PSEUDOPREEMPTION + +# +# If this is specified it will be linked in with the XDCData option in the def +# file instead of the default of $(NWOS)/apache.xdc. XDCData can be disabled +# by setting APACHE_UNIPROC in the environment +# +XDCDATA = + +# +# If there is an NLM target, put it here +# +TARGET_nlm = \ + $(OBJDIR)/moddbd.nlm \ + $(EOLIST) + +# +# If there is an LIB target, put it here +# +TARGET_lib = \ + $(EOLIST) + +# +# These are the OBJ files needed to create the NLM target above. +# Paths must all use the '/' character +# +FILES_nlm_objs = \ + $(OBJDIR)/mod_dbd.o \ + $(EOLIST) + +# +# These are the LIB files needed to create the NLM target above. +# These will be added as a library command in the link.opt file. +# +FILES_nlm_libs = \ + libcpre.o \ + $(EOLIST) + +# +# These are the modules that the above NLM target depends on to load. +# These will be added as a module command in the link.opt file. +# +FILES_nlm_modules = \ + aprlib \ + libc \ + $(EOLIST) + +# +# If the nlm has a msg file, put it's path here +# +FILE_nlm_msg = + +# +# If the nlm has a hlp file put it's path here +# +FILE_nlm_hlp = + +# +# If this is specified, it will override $(NWOS)\copyright.txt. +# +FILE_nlm_copyright = + +# +# Any additional imports go here +# +FILES_nlm_Ximports = \ + @$(APR)/aprlib.imp \ + @$(NWOS)/httpd.imp \ + @libc.imp \ + $(EOLIST) + +# +# Any symbols exported to here +# +FILES_nlm_exports = \ + dbd_module \ + $(EOLIST) + +# +# These are the OBJ files needed to create the LIB target above. +# Paths must all use the '/' character +# +FILES_lib_objs = \ + $(EOLIST) + +# +# implement targets and dependancies (leave this section alone) +# + +libs :: $(OBJDIR) $(TARGET_lib) + +nlms :: libs $(TARGET_nlm) + +# +# Updated this target to create necessary directories and copy files to the +# correct place. (See $(AP_WORK)\build\NWGNUhead.inc for examples) +# +install :: nlms FORCE + copy $(OBJDIR)\*.nlm $(INSTALL)\Apache2\modules\*.* + +# +# Any specialized rules here +# + +# +# Include the 'tail' makefile that has targets that depend on variables defined +# in this makefile +# + +include $(AP_WORK)\build\NWGNUtail.inc + + + diff --git a/modules/database/config.m4 b/modules/database/config.m4 new file mode 100644 index 00000000000..ab2f941587a --- /dev/null +++ b/modules/database/config.m4 @@ -0,0 +1,6 @@ + +APACHE_MODPATH_INIT(database) + +APACHE_MODULE(dbd, Apache DBD Framework, , , most) + +APACHE_MODPATH_FINISH diff --git a/modules/experimental/mod_dbd.c b/modules/database/mod_dbd.c similarity index 90% rename from modules/experimental/mod_dbd.c rename to modules/database/mod_dbd.c index bdf78176b2e..fff0e4b2cb5 100644 --- a/modules/experimental/mod_dbd.c +++ b/modules/database/mod_dbd.c @@ -420,6 +420,29 @@ ap_dbd_t *ap_dbd_acquire(request_rec *r) } return req->conn; } +ap_dbd_t *ap_dbd_cacquire(conn_rec *c) +{ + svr_cfg *svr; + dbd_pool_rec *req = ap_get_module_config(c->conn_config, &dbd_module); + if (!req) { + req = apr_palloc(c->pool, sizeof(dbd_pool_rec)); + req->conn = ap_dbd_open(c->pool, c->base_server); + if (req->conn) { + svr = ap_get_module_config(c->base_server->module_config, &dbd_module); + ap_set_module_config(c->conn_config, &dbd_module, req); + if (svr->persist) { + req->dbpool = svr->dbpool; + apr_pool_cleanup_register(c->pool, req, dbd_release, + apr_pool_cleanup_null); + } + else { + apr_pool_cleanup_register(c->pool, req->conn, dbd_close, + apr_pool_cleanup_null); + } + } + } + return req->conn; +} #else ap_dbd_t *ap_dbd_acquire(request_rec *r) { @@ -428,7 +451,7 @@ ap_dbd_t *ap_dbd_acquire(request_rec *r) if (!ret) { svr = ap_get_module_config(r->server->module_config, &dbd_module); ret = ap_dbd_open(r->pool, r->server); - if ( ret ) { + if (ret) { ap_set_module_config(r->request_config, &dbd_module, ret); if (!svr->persist) { apr_pool_cleanup_register(r->pool, svr->conn, dbd_close, @@ -439,6 +462,24 @@ ap_dbd_t *ap_dbd_acquire(request_rec *r) } return ret; } +ap_dbd_t *ap_dbd_cacquire(conn_rec *c) +{ + svr_cfg *svr; + ap_dbd_t *ret = ap_get_module_config(c->conn_config, &dbd_module); + if (!ret) { + svr = ap_get_module_config(c->base_server->module_config, &dbd_module); + ret = ap_dbd_open(c->pool, c->base_server); + if (ret) { + ap_set_module_config(c->conn_config, &dbd_module, ret); + if (!svr->persist) { + apr_pool_cleanup_register(c->pool, svr->conn, dbd_close, + apr_pool_cleanup_null); + } + /* if persist then dbd_open registered cleanup on proc pool */ + } + } + return ret; +} #endif static void dbd_hooks(apr_pool_t *pool) @@ -449,6 +490,7 @@ static void dbd_hooks(apr_pool_t *pool) APR_REGISTER_OPTIONAL_FN(ap_dbd_open); APR_REGISTER_OPTIONAL_FN(ap_dbd_close); APR_REGISTER_OPTIONAL_FN(ap_dbd_acquire); + APR_REGISTER_OPTIONAL_FN(ap_dbd_cacquire); APR_REGISTER_OPTIONAL_FN(ap_dbd_prepare); apr_dbd_init(pool); } diff --git a/modules/experimental/mod_dbd.h b/modules/database/mod_dbd.h similarity index 87% rename from modules/experimental/mod_dbd.h rename to modules/database/mod_dbd.h index 252981367c7..f98df9948e1 100644 --- a/modules/experimental/mod_dbd.h +++ b/modules/database/mod_dbd.h @@ -58,6 +58,12 @@ AP_DECLARE(void) ap_dbd_close(server_rec*, ap_dbd_t*); */ AP_DECLARE(ap_dbd_t*) ap_dbd_acquire(request_rec*); +/* acquire a connection that will have the lifetime of a connection + * and MUST NOT be explicitly closed. Return NULL on error. + * This is the preferred function for most applications. + */ +AP_DECLARE(ap_dbd_t*) ap_dbd_cacquire(conn_rec*); + /* Prepare a statement for use by a client module */ AP_DECLARE(void) ap_dbd_prepare(server_rec*, const char*, const char*); @@ -65,6 +71,7 @@ AP_DECLARE(void) ap_dbd_prepare(server_rec*, const char*, const char*); APR_DECLARE_OPTIONAL_FN(ap_dbd_t*, ap_dbd_open, (apr_pool_t*, server_rec*)); APR_DECLARE_OPTIONAL_FN(void, ap_dbd_close, (server_rec*, ap_dbd_t*)); APR_DECLARE_OPTIONAL_FN(ap_dbd_t*, ap_dbd_acquire, (request_rec*)); +APR_DECLARE_OPTIONAL_FN(ap_dbd_t*, ap_dbd_cacquire, (conn_rec*)); APR_DECLARE_OPTIONAL_FN(void, ap_dbd_prepare, (server_rec*, const char*, const char*)); #endif diff --git a/modules/experimental/NWGNUmakefile b/modules/experimental/NWGNUmakefile index d6e1337a29f..78e453e9901 100644 --- a/modules/experimental/NWGNUmakefile +++ b/modules/experimental/NWGNUmakefile @@ -152,9 +152,7 @@ XDCDATA = # If there is an NLM target, put it here # TARGET_nlm = \ - $(OBJDIR)/charsetl.nlm \ $(OBJDIR)/example.nlm \ - $(OBJDIR)/mod_filter.nlm \ $(EOLIST) # diff --git a/modules/experimental/config.m4 b/modules/experimental/config.m4 index c5bfacd6dbf..317c48f2b68 100644 --- a/modules/experimental/config.m4 +++ b/modules/experimental/config.m4 @@ -1,17 +1,8 @@ APACHE_MODPATH_INIT(experimental) -if test "$ac_cv_ebcdic" = "yes"; then -# mod_charset_lite can be very useful on an ebcdic system, -# so include it by default - APACHE_MODULE(charset_lite, character set translation, , , yes) -else - APACHE_MODULE(charset_lite, character set translation, , , no) -fi - APACHE_MODULE(example, example and demo module, , , no) APACHE_MODULE(case_filter, example uppercase conversion filter, , , no) APACHE_MODULE(case_filter_in, example uppercase conversion input filter, , , no) -APACHE_MODULE(filter, smart filtering module, , , no) APACHE_MODPATH_FINISH diff --git a/modules/experimental/NWGNUcharsetl b/modules/filters/NWGNUcharsetl similarity index 100% rename from modules/experimental/NWGNUcharsetl rename to modules/filters/NWGNUcharsetl diff --git a/modules/filters/NWGNUmakefile b/modules/filters/NWGNUmakefile index c8509428eb6..33e48a25957 100644 --- a/modules/filters/NWGNUmakefile +++ b/modules/filters/NWGNUmakefile @@ -153,6 +153,8 @@ XDCDATA = # TARGET_nlm = \ $(OBJDIR)/extfiltr.nlm \ + $(OBJDIR)/charsetl.nlm \ + $(OBJDIR)/mod_filter.nlm \ $(EOLIST) # If the zlib libraries source exists then build the mod_deflate module diff --git a/modules/experimental/NWGNUmod_filter b/modules/filters/NWGNUmod_filter similarity index 100% rename from modules/experimental/NWGNUmod_filter rename to modules/filters/NWGNUmod_filter diff --git a/modules/filters/config.m4 b/modules/filters/config.m4 index a481e403700..c9c8f386c9e 100644 --- a/modules/filters/config.m4 +++ b/modules/filters/config.m4 @@ -6,6 +6,16 @@ APACHE_MODPATH_INIT(filters) APACHE_MODULE(ext_filter, external filter module, , , most) APACHE_MODULE(include, Server Side Includes, , , yes) +APACHE_MODULE(filter, Smart Filtering, , , yes) + +if test "$ac_cv_ebcdic" = "yes"; then +# mod_charset_lite can be very useful on an ebcdic system, +# so include it by default + APACHE_MODULE(charset_lite, character set translation, , , yes) +else + APACHE_MODULE(charset_lite, character set translation, , , no) +fi + APACHE_MODULE(deflate, Deflate transfer encoding support, , , most, [ AC_ARG_WITH(z, APACHE_HELP_STRING(--with-z=DIR,use a specific zlib library), diff --git a/modules/experimental/mod_charset_lite.c b/modules/filters/mod_charset_lite.c similarity index 100% rename from modules/experimental/mod_charset_lite.c rename to modules/filters/mod_charset_lite.c diff --git a/modules/experimental/mod_charset_lite.dsp b/modules/filters/mod_charset_lite.dsp similarity index 100% rename from modules/experimental/mod_charset_lite.dsp rename to modules/filters/mod_charset_lite.dsp diff --git a/modules/experimental/mod_charset_lite.exp b/modules/filters/mod_charset_lite.exp similarity index 100% rename from modules/experimental/mod_charset_lite.exp rename to modules/filters/mod_charset_lite.exp diff --git a/modules/experimental/mod_filter.c b/modules/filters/mod_filter.c similarity index 100% rename from modules/experimental/mod_filter.c rename to modules/filters/mod_filter.c