📄 eapi.patch
字号:
## _____ _ ____ ___ ## | ____| / \ | _ \_ _|## | _| / _ \ | |_) | | ## | |__ / ___ \| __/| | ## |____/_/ \_\_| |___| Extended API for Apache## ____________________________________________________________________________## ## Annotated patch file: eapi.patch## Copyright (c) 1998-2000 Ralf S. Engelschall, All Rights Reserved. ## Created on: 25-Feb-2000#### This file assembles changes to existing Apache source files## between the original Apache and the patched variant. It can be## automatically applied to a vanilla Apache source tree with the## 'patch' tool to upgrade those files. Each patch snippet is## annotated with a short description.#### This file contains all patches to the Apache source## tree which add the Extended API (EAPI) support.##+---------------------------------------------------------------------------| Add the EAPI and EAPI_MM configuration entries which triggers the EAPI| patches and configured the shared memory support via the MM library.+---------------------------------------------------------------------------Index: src/Configuration.tmpl--- src/Configuration.tmpl 1999/08/17 11:21:38 1.1.1.5+++ src/Configuration.tmpl 2000/01/22 14:14:42 1.20@@ -68,6 +115,24 @@ #TARGET= ################################################################+# Extended API (EAPI) support:+#+# EAPI:+# The EAPI rule enables more module hooks, a generic low-level hook+# mechanism, a generic context mechanism and shared memory based pools. +#+# EAPI_MM:+# Set the EAPI_MM variable to either the directory of a MM Shared Memory+# Library source tree or the installation tree of MM. Alternatively you can+# also use the value 'SYSTEM' which then indicates that MM is installed+# under various system locations. When the MM library files cannot be found+# the EAPI still can be built, but without shared memory pool support, of+# course.++Rule EAPI=no+#EAPI_MM=SYSTEM++################################################################ # Dynamic Shared Object (DSO) support # # There is experimental support for compiling the Apache core and+---------------------------------------------------------------------------| Patch in implementation of the EAPI rule.+---------------------------------------------------------------------------Index: src/Configure--- src/Configure 2000/02/24 13:55:25 1.1.1.10+++ src/Configure 2000/02/24 13:58:16 1.12@@ -1727,6 +1727,72 @@ fi ####################################################################+## Extended API (EAPI) support:+##+if [ "x$RULE_EAPI" = "x" ]; then+ RULE_EAPI=`./helpers/CutRule EAPI $file`+fi+if [ "x$RULE_EAPI" = "xyes" ]; then+ echo " + enabling Extended API (EAPI)"+ CFLAGS="$CFLAGS -DEAPI"+ # some vendor compilers are too restrictive+ # for our ap_hook and ap_ctx sources.+ case "$OS:$CC" in+ *IRIX-32*:*/cc|*IRIX-32*:cc )+ CFLAGS="$CFLAGS -woff 1048,1110,1164"+ ;;+ esac+ # MM Shared Memory Library support for EAPI+ if [ "x$EAPI_MM" = "x" ]; then+ EAPI_MM=`egrep '^EAPI_MM=' $file | tail -1 | awk -F= '{print $2}'`+ fi+ if [ "x$EAPI_MM" != "x" ]; then+ case $EAPI_MM in+ SYSTEM|/* ) ;;+ * ) for p in . .. ../..; do+ if [ -d "$p/$EAPI_MM" ]; then+ EAPI_MM="`echo $p/$EAPI_MM | sed -e 's;/\./;/;g'`" + break+ fi+ done+ ;;+ esac+ if [ "x$EAPI_MM" = "xSYSTEM" ]; then+ echo " using MM library for EAPI: (system-wide)"+ CFLAGS="$CFLAGS -DEAPI_MM"+ __INCLUDES="`mm-config --cflags`"+ if [ "x$__INCLUDES" != "x-I/usr/include" ]; then+ INCLUDES="$INCLUDES $__INCLUDES"+ fi+ LDFLAGS="$LDFLAGS `mm-config --ldflags`"+ LIBS="$LIBS `mm-config --libs`"+ else+ if [ -f "$EAPI_MM/.libs/libmm.a" -a -f "$EAPI_MM/mm.h" ]; then+ echo " using MM library: $EAPI_MM (source-tree only)"+ case $EAPI_MM in+ /* ) ;;+ * ) EAPI_MM="\$(SRCDIR)/$EAPI_MM" ;;+ esac+ CFLAGS="$CFLAGS -DEAPI_MM"+ INCLUDES="$INCLUDES -I$EAPI_MM"+ LDFLAGS="$LDFLAGS -L$EAPI_MM/.libs"+ LIBS="$LIBS -lmm"+ elif [ -f "$EAPI_MM/bin/mm-config" ]; then+ echo " using MM library: $EAPI_MM (installed)"+ CFLAGS="$CFLAGS -DEAPI_MM"+ INCLUDES="$INCLUDES `$EAPI_MM/bin/mm-config --cflags`"+ LDFLAGS="$LDFLAGS `$EAPI_MM/bin/mm-config --ldflags`"+ LIBS="$LIBS `$EAPI_MM/bin/mm-config --libs`"+ else+ echo "Configure:Error: Cannot find MM library under $EAPI_MM" 1>&2+ exit 1+ fi+ fi+ fi+fi+++#################################################################### ## Add in the Expat library if needed/wanted. ## if [ -d ./lib/expat-lite/ ]; then+---------------------------------------------------------------------------| Add the build support for the ap_hook.c and ap_ctx.c sources (Unix)+---------------------------------------------------------------------------Index: src/ap/Makefile.tmpl--- src/ap/Makefile.tmpl 1999/08/17 11:21:40 1.1.1.5+++ src/ap/Makefile.tmpl 1999/08/17 11:42:12 1.5@@ -6,7 +6,8 @@ LIB=libap.a OBJS=ap_cpystrn.o ap_execve.o ap_fnmatch.o ap_getpass.o ap_md5c.o ap_signal.o \- ap_slack.o ap_snprintf.o ap_sha1.o ap_checkpass.o ap_base64.o+ ap_slack.o ap_snprintf.o ap_sha1.o ap_checkpass.o ap_base64.o \+ ap_hook.o ap_ctx.o ap_mm.o .c.o: $(CC) -c $(INCLUDES) $(CFLAGS) $<+---------------------------------------------------------------------------| Add the build support for the ap_hook.c and ap_ctx.c sources (Win32)+---------------------------------------------------------------------------Index: src/ap/ap.mak--- src/ap/ap.mak 1999/08/17 11:21:40 1.1.1.5+++ src/ap/ap.mak 1999/08/17 11:42:12 1.5@@ -47,6 +47,9 @@ -@erase "$(INTDIR)\ap_cpystrn.obj" -@erase "$(INTDIR)\ap_fnmatch.obj" -@erase "$(INTDIR)\ap_md5c.obj"+ -@erase "$(INTDIR)\ap_hook.obj"+ -@erase "$(INTDIR)\ap_ctx.obj"+ -@erase "$(INTDIR)\ap_mm.obj" -@erase "$(INTDIR)\ap_signal.obj" -@erase "$(INTDIR)\ap_slack.obj" -@erase "$(INTDIR)\ap_snprintf.obj"@@ -105,6 +108,9 @@ "$(INTDIR)\ap_cpystrn.obj" \ "$(INTDIR)\ap_fnmatch.obj" \ "$(INTDIR)\ap_md5c.obj" \+ "$(INTDIR)\ap_hook.obj" \+ "$(INTDIR)\ap_ctx.obj" \+ "$(INTDIR)\ap_mm.obj" \ "$(INTDIR)\ap_signal.obj" \ "$(INTDIR)\ap_slack.obj" \ "$(INTDIR)\ap_snprintf.obj" \@@ -139,6 +145,9 @@ -@erase "$(INTDIR)\ap_cpystrn.obj" -@erase "$(INTDIR)\ap_fnmatch.obj" -@erase "$(INTDIR)\ap_md5c.obj"+ -@erase "$(INTDIR)\ap_hook.obj"+ -@erase "$(INTDIR)\ap_ctx.obj"+ -@erase "$(INTDIR)\ap_mm.obj" -@erase "$(INTDIR)\ap_signal.obj" -@erase "$(INTDIR)\ap_slack.obj" -@erase "$(INTDIR)\ap_snprintf.obj"@@ -197,6 +206,9 @@ "$(INTDIR)\ap_cpystrn.obj" \ "$(INTDIR)\ap_fnmatch.obj" \ "$(INTDIR)\ap_md5c.obj" \+ "$(INTDIR)\ap_hook.obj" \+ "$(INTDIR)\ap_ctx.obj" \+ "$(INTDIR)\ap_mm.obj" \ "$(INTDIR)\ap_signal.obj" \ "$(INTDIR)\ap_slack.obj" \ "$(INTDIR)\ap_snprintf.obj" \+---------------------------------------------------------------------------| Replace the MODULE_MAGIC_COOKIE to allow us to distinguish between| EAPI-aware modules and standard modules.+---------------------------------------------------------------------------Index: src/include/ap_mmn.h--- src/include/ap_mmn.h 2000/02/24 13:55:30 1.1.1.6+++ src/include/ap_mmn.h 2000/02/24 13:58:16 1.6@@ -229,7 +229,23 @@ * 19990320.7 - add ap_strcasestr() */ +/* + * Under Extended API situations we replace the magic cookie "AP13" with+ * "EAPI" to let us distinguish between the EAPI module structure (which+ * contain additional pointers at the end) and standard module structures+ * (which lack at least NULL's for the pointers at the end). This is+ * important because standard ("AP13") modules would dump core when we+ * dispatch over the additional hooks because NULL's are missing at the end of+ * the module structure. See also the code in mod_so for details on loading+ * (we accept both "AP13" and "EAPI").+ */+#ifdef EAPI+#define MODULE_MAGIC_COOKIE_AP13 0x41503133UL /* "AP13" */+#define MODULE_MAGIC_COOKIE_EAPI 0x45415049UL /* "EAPI" */+#define MODULE_MAGIC_COOKIE MODULE_MAGIC_COOKIE_EAPI +#else #define MODULE_MAGIC_COOKIE 0x41503133UL /* "AP13" */+#endif #ifndef MODULE_MAGIC_NUMBER_MAJOR #define MODULE_MAGIC_NUMBER_MAJOR 19990320+---------------------------------------------------------------------------| Add the additional prototypes and defines for the | shared memory pools.+---------------------------------------------------------------------------Index: src/include/alloc.h--- src/include/alloc.h 1999/08/17 11:21:45 1.1.1.6+++ src/include/alloc.h 1999/08/17 11:42:12 1.5@@ -93,6 +93,15 @@ pool * ap_init_alloc(void); /* Set up everything */ API_EXPORT(pool *) ap_make_sub_pool(pool *); /* All pools are subpools of permanent_pool */+#if defined(EAPI)+typedef enum { AP_POOL_RD, AP_POOL_RW } ap_pool_lock_mode;+int ap_shared_pool_possible(void);+void ap_init_alloc_shared(int);+void ap_kill_alloc_shared(void);+API_EXPORT(pool *) ap_make_shared_sub_pool(pool *);+API_EXPORT(int) ap_acquire_pool(pool *, ap_pool_lock_mode);+API_EXPORT(int) ap_release_pool(pool *);+#endif API_EXPORT(void) ap_destroy_pool(pool *); /* pools have nested lifetimes -- sub_pools are destroyed when the+---------------------------------------------------------------------------| Add the additional context variable `ctx' for BUFF structures.+---------------------------------------------------------------------------Index: src/include/buff.h--- src/include/buff.h 1999/01/10 10:46:41 1.1.1.3+++ src/include/buff.h 1999/07/28 13:09:13 1.7@@ -124,6 +124,10 @@ /* transport handle, for RPC binding handle or some such */ void *t_handle; +#ifdef EAPI+ ap_ctx *ctx;+#endif /* EAPI */+ #ifdef B_SFIO Sfio_t *sf_in; Sfio_t *sf_out;@@ -175,6 +179,10 @@ /* Internal routines */ API_EXPORT(int) ap_bflsbuf(int c, BUFF *fb); API_EXPORT(int) ap_bfilbuf(BUFF *fb);++#ifdef EAPI+#define ap_bpeekc(fb) ( ((fb)->incnt == 0) ? EOF : *((fb)->inptr) )+#endif #ifndef CHARSET_EBCDIC +---------------------------------------------------------------------------| Add the four additional Apache API module hooks.+---------------------------------------------------------------------------Index: src/include/http_config.h--- src/include/http_config.h 1999/08/17 11:21:46 1.1.1.6+++ src/include/http_config.h 1999/08/17 11:42:12 1.8@@ -275,6 +275,65 @@ void (*child_exit) (server_rec *, pool *); #endif int (*post_read_request) (request_rec *);++#ifdef EAPI+ /*+ * ANSI C guarantees us that we can at least _extend_ the module structure+ * with additional hooks without the need to change all existing modules.+ * Because: ``If there are fewer initializers in the list than members of+ * the structure, the trailing members are initialized with 0.'' (The C+ * Programming Language, 2nd Ed., A8.7 Initialization). So we just+ * have to put our additional hooks here:+ *+ * add_module: + * Called from within ap_add_module() right after the module structure+ * was linked into the Apache internal module list. It is mainly+ * intended to be used to define configuration defines (<IfDefine>)+ * which have to be available directly after a LoadModule/AddModule.+ * Actually this is the earliest possible hook a module can use.+ *+ * remove_module: + * Called from within ap_remove_module() right before the module+ * structure is kicked out from the Apache internal module list.+ * Actually this is last possible hook a module can use and exists for+ * consistency with the add_module hook.+ *+ * rewrite_command:+ * Called right after a configuration directive line was read and+ * before it is processed. It is mainly intended to be used for+ * rewriting directives in order to provide backward compatibility to+ * old directive variants.+ *+ * new_connection:+ * Called from within the internal new_connection() function, right+ * after the conn_rec structure for the new established connection was+ * created and before Apache starts processing the request with+ * ap_read_request(). It is mainly intended to be used to setup/run+ * connection dependent things like sending start headers for+ * on-the-fly compression, etc.+ *+ * close_connection:+ * Called from within the Apache dispatching loop just before any+ * ap_bclose() is performed on the socket connection, but a long time+ * before any pool cleanups are done for the connection (which can be+ * too late for some applications). It is mainly intended to be used+ * to close/finalize connection dependent things like sending end+ * headers for on-the-fly compression, etc.+ */+#ifdef ULTRIX_BRAIN_DEATH+ void (*add_module) ();+ void (*remove_module) ();+ char *(*rewrite_command) ();+ void (*new_connection) ();+ void (*close_connection) ();+#else+ void (*add_module) (struct module_struct *);+ void (*remove_module) (struct module_struct *);+ char *(*rewrite_command) (cmd_parms *, void *config, const char *);+ void (*new_connection) (conn_rec *);+ void (*close_connection) (conn_rec *);+#endif+#endif /* EAPI */ } module; /* Initializer for the first few module slots, which are only+---------------------------------------------------------------------------| Add the additional variable `ap_global_ctx' for holding| global module context.+---------------------------------------------------------------------------Index: src/include/http_conf_globals.h--- src/include/http_conf_globals.h 2000/01/21 18:06:25 1.1.1.6+++ src/include/http_conf_globals.h 2000/01/21 19:51:10 1.7@@ -91,6 +91,9 @@ extern int ap_listenbacklog; extern int ap_dump_settings; extern API_VAR_EXPORT int ap_extended_status;+#ifdef EAPI+extern API_VAR_EXPORT ap_ctx *ap_global_ctx;+#endif /* EAPI */ extern char *ap_pid_fname; extern char *ap_scoreboard_fname;+---------------------------------------------------------------------------| Export the ap_set_callback_and_alarm() function because this| first is a useful thing and second we need it because all| other API/timeout functions deal with a request_rec while| some modules need a generic timeout mechanism.+---------------------------------------------------------------------------Index: src/include/http_main.h--- src/include/http_main.h 1999/01/10 10:46:43 1.1.1.3+++ src/include/http_main.h 1999/01/10 11:07:22 1.3@@ -124,7 +124,11 @@ API_EXPORT(void) ap_sync_scoreboard_image(void); int ap_update_child_status(int child_num, int status, request_rec *r); void ap_time_process_request(int child_num, int status);+#ifdef EAPI+API_EXPORT(unsigned int) ap_set_callback_and_alarm(void (*fn) (int), int x);+#else unsigned int ap_set_callback_and_alarm(void (*fn) (int), int x);+#endif API_EXPORT(int) ap_check_alarm(void); #ifndef NO_OTHER_CHILD+---------------------------------------------------------------------------| First add support for the HTTPS protocol scheme via hooks,| second add the additional context variable `ctx' for the| conn_rec, server_rec and request_rec structures. And third| add a prototype for the additional ap_add_config_define()| function.+---------------------------------------------------------------------------Index: src/include/httpd.h--- src/include/httpd.h 2000/02/24 13:55:31 1.1.1.10+++ src/include/httpd.h 2000/02/24 13:58:16 1.19@@ -69,7 +69,19 @@ /* Headers in which EVERYONE has an interest... */ #include "ap_config.h"+#ifdef EAPI+#include "ap_mm.h"+#endif #include "alloc.h"+/*+ * Include the Extended API headers.+ * Don't move the position. It has to be after alloc.h because it uses the+ * pool stuff but before buff.h because the buffer stuff uses the EAPI, too. + */+#ifdef EAPI+#include "ap_hook.h"+#include "ap_ctx.h"+#endif /* EAPI */ #include "buff.h" #include "ap.h" @@ -140,8 +152,13 @@ #define DEFAULT_HTTP_PORT 80 #define DEFAULT_HTTPS_PORT 443 #define ap_is_default_port(port,r) ((port) == ap_default_port(r))+#ifdef EAPI+#define ap_http_method(r) (ap_ctx_get((r)->ctx, "ap::http::method") != NULL ? ((char *)ap_ctx_get((r)->ctx, "ap::http::method")) : "http")+#define ap_default_port(r) (ap_ctx_get((r)->ctx, "ap::default::port") != NULL ? atoi((char *)ap_ctx_get((r)->ctx, "ap::default::port")) : DEFAULT_HTTP_PORT)+#else /* EAPI */ #define ap_http_method(r) "http" #define ap_default_port(r) DEFAULT_HTTP_PORT+#endif /* EAPI */ /* --------- Default user name and group name running standalone ---------- */ /* --- These may be specified as numbers by placing a # before a number --- */@@ -353,6 +370,19 @@ #define SCOREBOARD_MAINTENANCE_INTERVAL 1000000 #endif +/*+ * Unix only:+ * Path to Shared Memory Files + */+#ifdef EAPI+#ifndef EAPI_MM_CORE_PATH+#define EAPI_MM_CORE_PATH "logs/mm"+#endif+#ifndef EAPI_MM_CORE_MAXSIZE+#define EAPI_MM_CORE_MAXSIZE 1024*1024*1 /* max. 1MB */+#endif+#endif+ /* Number of requests to try to handle in a single process. If <= 0, * the children don't die off. That's the default here, since I'm still * interested in finding and stanching leaks.@@ -438,6 +468,9 @@ API_EXPORT(const char *) ap_get_server_version(void); API_EXPORT(void) ap_add_version_component(const char *component); API_EXPORT(const char *) ap_get_server_built(void);+#ifdef EAPI+API_EXPORT(void) ap_add_config_define(const char *define);+#endif /* EAPI */ /* Numeric release version identifier: MMNNFFRBB: major minor fix final beta * Always increases along the same track as the source branch.@@ -819,6 +852,10 @@ * record to improve 64bit alignment the next time we need to break * binary compatibility for some other reason. */++#ifdef EAPI+ ap_ctx *ctx;+#endif /* EAPI */ }; @@ -867,6 +904,9 @@ char *local_host; /* used for ap_get_server_name when * UseCanonicalName is set to DNS * (ignores setting of HostnameLookups) */+#ifdef EAPI+ ap_ctx *ctx;+#endif /* EAPI */ }; /* Per-vhost config... */@@ -939,6 +979,10 @@ int limit_req_line; /* limit on size of the HTTP request line */ int limit_req_fieldsize; /* limit on size of any request header field */ int limit_req_fields; /* limit on number of request header fields */++#ifdef EAPI+ ap_ctx *ctx;+#endif /* EAPI */ }; /* These are more like real hosts than virtual hosts */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -