diff options
author | hongbotian <hongbo.tianhongbo@huawei.com> | 2015-11-30 01:45:08 -0500 |
---|---|---|
committer | hongbotian <hongbo.tianhongbo@huawei.com> | 2015-11-30 01:45:08 -0500 |
commit | e8ec7aa8e38a93f5b034ac74cebce5de23710317 (patch) | |
tree | aa031937bf856c1f8d6ad7877b8d2cb0224da5ef /rubbos/app/httpd-2.0.64/include | |
parent | cc40af334e619bb549038238507407866f774f8f (diff) |
upload http
JIRA: BOTTLENECK-10
Change-Id: I7598427ff904df438ce77c2819ee48ac75ffa8da
Signed-off-by: hongbotian <hongbo.tianhongbo@huawei.com>
Diffstat (limited to 'rubbos/app/httpd-2.0.64/include')
35 files changed, 8857 insertions, 0 deletions
diff --git a/rubbos/app/httpd-2.0.64/include/.indent.pro b/rubbos/app/httpd-2.0.64/include/.indent.pro new file mode 100644 index 00000000..a9fbe9f9 --- /dev/null +++ b/rubbos/app/httpd-2.0.64/include/.indent.pro @@ -0,0 +1,54 @@ +-i4 -npsl -di0 -br -nce -d0 -cli0 -npcs -nfc1 +-TBUFF +-TFILE +-TTRANS +-TUINT4 +-T_trans +-Tallow_options_t +-Tapache_sfio +-Tarray_header +-Tbool_int +-Tbuf_area +-Tbuff_struct +-Tbuffy +-Tcmd_how +-Tcmd_parms +-Tcommand_rec +-Tcommand_struct +-Tconn_rec +-Tcore_dir_config +-Tcore_server_config +-Tdir_maker_func +-Tevent +-Tglobals_s +-Thandler_func +-Thandler_rec +-Tjoblist_s +-Tlisten_rec +-Tmerger_func +-Tmode_t +-Tmodule +-Tmodule_struct +-Tmutex +-Tn_long +-Tother_child_rec +-Toverrides_t +-Tparent_score +-Tpid_t +-Tpiped_log +-Tpool +-Trequest_rec +-Trequire_line +-Trlim_t +-Tscoreboard +-Tsemaphore +-Tserver_addr_rec +-Tserver_rec +-Tserver_rec_chain +-Tshort_score +-Ttable +-Ttable_entry +-Tthread +-Tu_wide_int +-Tvtime_t +-Twide_int diff --git a/rubbos/app/httpd-2.0.64/include/ap_compat.h b/rubbos/app/httpd-2.0.64/include/ap_compat.h new file mode 100644 index 00000000..4985bc4d --- /dev/null +++ b/rubbos/app/httpd-2.0.64/include/ap_compat.h @@ -0,0 +1,28 @@ +/* Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef AP_COMPAT_H +#define AP_COMPAT_H + +/* Drag in apu (and therefore apr) renamed symbols */ +#include "apu_compat.h" + +/* redefine 1.3.x symbols to the new symbol names */ + +#define MODULE_VAR_EXPORT AP_MODULE_DECLARE_DATA +#define ap_send_http_header(r) ; + +#endif /* AP_COMPAT_H */ diff --git a/rubbos/app/httpd-2.0.64/include/ap_config.h b/rubbos/app/httpd-2.0.64/include/ap_config.h new file mode 100644 index 00000000..9d8db24b --- /dev/null +++ b/rubbos/app/httpd-2.0.64/include/ap_config.h @@ -0,0 +1,256 @@ +/* Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef AP_CONFIG_H +#define AP_CONFIG_H + +#include "apr.h" +#include "apr_hooks.h" +#include "apr_optional_hooks.h" + +/** + * @file ap_config.h + * @brief Symbol export macros and hook functions + */ + +/* Although this file doesn't declare any hooks, declare the hook group here */ +/** @defgroup hooks Apache Hooks */ + +#ifdef DOXYGEN +/* define these just so doxygen documents them */ + +/** + * AP_DECLARE_STATIC is defined when including Apache's Core headers, + * to provide static linkage when the dynamic library may be unavailable. + * + * @see AP_DECLARE_EXPORT + * + * AP_DECLARE_STATIC and AP_DECLARE_EXPORT are left undefined when + * including Apache's Core headers, to import and link the symbols from the + * dynamic Apache Core library and assure appropriate indirection and calling + * conventions at compile time. + */ +# define AP_DECLARE_STATIC +/** + * AP_DECLARE_EXPORT is defined when building the Apache Core dynamic + * library, so that all public symbols are exported. + * + * @see AP_DECLARE_STATIC + */ +# define AP_DECLARE_EXPORT + +#endif /* def DOXYGEN */ + +#if !defined(WIN32) +/** + * Apache Core dso functions are declared with AP_DECLARE(), so they may + * use the most appropriate calling convention. Hook functions and other + * Core functions with variable arguments must use AP_DECLARE_NONSTD(). + * @code + * AP_DECLARE(rettype) ap_func(args) + * @endcode + */ +#define AP_DECLARE(type) type + +/** + * Apache Core dso variable argument and hook functions are declared with + * AP_DECLARE_NONSTD(), as they must use the C language calling convention. + * @see AP_DECLARE + * @code + * AP_DECLARE_NONSTD(rettype) ap_func(args [...]) + * @endcode + */ +#define AP_DECLARE_NONSTD(type) type + +/** + * Apache Core dso variables are declared with AP_MODULE_DECLARE_DATA. + * This assures the appropriate indirection is invoked at compile time. + * + * @note AP_DECLARE_DATA extern type apr_variable; syntax is required for + * declarations within headers to properly import the variable. + * @code + * AP_DECLARE_DATA type apr_variable + * @endcode + */ +#define AP_DECLARE_DATA + +#elif defined(AP_DECLARE_STATIC) +#define AP_DECLARE(type) type __stdcall +#define AP_DECLARE_NONSTD(type) type +#define AP_DECLARE_DATA +#elif defined(AP_DECLARE_EXPORT) +#define AP_DECLARE(type) __declspec(dllexport) type __stdcall +#define AP_DECLARE_NONSTD(type) __declspec(dllexport) type +#define AP_DECLARE_DATA __declspec(dllexport) +#else +#define AP_DECLARE(type) __declspec(dllimport) type __stdcall +#define AP_DECLARE_NONSTD(type) __declspec(dllimport) type +#define AP_DECLARE_DATA __declspec(dllimport) +#endif + +#if !defined(WIN32) || defined(AP_MODULE_DECLARE_STATIC) +/** + * Declare a dso module's exported module structure as AP_MODULE_DECLARE_DATA. + * + * Unless AP_MODULE_DECLARE_STATIC is defined at compile time, symbols + * declared with AP_MODULE_DECLARE_DATA are always exported. + * @code + * module AP_MODULE_DECLARE_DATA mod_tag + * @endcode + */ +#if defined(WIN32) +#define AP_MODULE_DECLARE(type) type __stdcall +#else +#define AP_MODULE_DECLARE(type) type +#endif +#define AP_MODULE_DECLARE_NONSTD(type) type +#define AP_MODULE_DECLARE_DATA +#else +/** + * AP_MODULE_DECLARE_EXPORT is a no-op. Unless contradicted by the + * AP_MODULE_DECLARE_STATIC compile-time symbol, it is assumed and defined. + * + * The old SHARED_MODULE compile-time symbol is now the default behavior, + * so it is no longer referenced anywhere with Apache 2.0. + */ +#define AP_MODULE_DECLARE_EXPORT +#define AP_MODULE_DECLARE(type) __declspec(dllexport) type __stdcall +#define AP_MODULE_DECLARE_NONSTD(type) __declspec(dllexport) type +#define AP_MODULE_DECLARE_DATA __declspec(dllexport) +#endif + +/** + * Declare a hook function + * @param ret The return type of the hook + * @param name The hook's name (as a literal) + * @param args The arguments the hook function takes, in brackets. + */ +#define AP_DECLARE_HOOK(ret,name,args) \ + APR_DECLARE_EXTERNAL_HOOK(ap,AP,ret,name,args) + +/** @internal */ +#define AP_IMPLEMENT_HOOK_BASE(name) \ + APR_IMPLEMENT_EXTERNAL_HOOK_BASE(ap,AP,name) + +/** + * Implement an Apache core hook that has no return code, and + * therefore runs all of the registered functions. The implementation + * is called ap_run_<i>name</i>. + * + * @param name The name of the hook + * @param args_decl The declaration of the arguments for the hook, for example + * "(int x,void *y)" + * @param args_use The arguments for the hook as used in a call, for example + * "(x,y)" + * @note If IMPLEMENTing a hook that is not linked into the Apache core, + * (e.g. within a dso) see APR_IMPLEMENT_EXTERNAL_HOOK_VOID. + */ +#define AP_IMPLEMENT_HOOK_VOID(name,args_decl,args_use) \ + APR_IMPLEMENT_EXTERNAL_HOOK_VOID(ap,AP,name,args_decl,args_use) + +/** + * Implement an Apache core hook that runs until one of the functions + * returns something other than ok or decline. That return value is + * then returned from the hook runner. If the hooks run to completion, + * then ok is returned. Note that if no hook runs it would probably be + * more correct to return decline, but this currently does not do + * so. The implementation is called ap_run_<i>name</i>. + * + * @param ret The return type of the hook (and the hook runner) + * @param name The name of the hook + * @param args_decl The declaration of the arguments for the hook, for example + * "(int x,void *y)" + * @param args_use The arguments for the hook as used in a call, for example + * "(x,y)" + * @param ok The "ok" return value + * @param decline The "decline" return value + * @return ok, decline or an error. + * @note If IMPLEMENTing a hook that is not linked into the Apache core, + * (e.g. within a dso) see APR_IMPLEMENT_EXTERNAL_HOOK_RUN_ALL. + */ +#define AP_IMPLEMENT_HOOK_RUN_ALL(ret,name,args_decl,args_use,ok,decline) \ + APR_IMPLEMENT_EXTERNAL_HOOK_RUN_ALL(ap,AP,ret,name,args_decl, \ + args_use,ok,decline) + +/** + * Implement a hook that runs until a function returns something other than + * decline. If all functions return decline, the hook runner returns decline. + * The implementation is called ap_run_<i>name</i>. + * + * @param ret The return type of the hook (and the hook runner) + * @param name The name of the hook + * @param args_decl The declaration of the arguments for the hook, for example + * "(int x,void *y)" + * @param args_use The arguments for the hook as used in a call, for example + * "(x,y)" + * @param decline The "decline" return value + * @return decline or an error. + * @note If IMPLEMENTing a hook that is not linked into the Apache core + * (e.g. within a dso) see APR_IMPLEMENT_EXTERNAL_HOOK_RUN_FIRST. + */ +#define AP_IMPLEMENT_HOOK_RUN_FIRST(ret,name,args_decl,args_use,decline) \ + APR_IMPLEMENT_EXTERNAL_HOOK_RUN_FIRST(ap,AP,ret,name,args_decl, \ + args_use,decline) + +/* Note that the other optional hook implementations are straightforward but + * have not yet been needed + */ + +/** + * Implement an optional hook. This is exactly the same as a standard hook + * implementation, except the hook is optional. + * @see AP_IMPLEMENT_HOOK_RUN_ALL + */ +#define AP_IMPLEMENT_OPTIONAL_HOOK_RUN_ALL(ret,name,args_decl,args_use,ok, \ + decline) \ + APR_IMPLEMENT_OPTIONAL_HOOK_RUN_ALL(ap,AP,ret,name,args_decl, \ + args_use,ok,decline) + +/** + * Hook an optional hook. Unlike static hooks, this uses a macro instead of a + * function. + */ +#define AP_OPTIONAL_HOOK(name,fn,pre,succ,order) \ + APR_OPTIONAL_HOOK(ap,name,fn,pre,succ,order) + +#include "os.h" +#if !defined(WIN32) && !defined(NETWARE) +#include "ap_config_auto.h" +#include "ap_config_layout.h" +#endif +#if defined(NETWARE) +#define AP_NONBLOCK_WHEN_MULTI_LISTEN 1 +#endif + +/* TODO - We need to put OS detection back to make all the following work */ + +#if defined(SUNOS4) || defined(IRIX) || defined(NEXT) || defined(AUX3) \ + || defined (UW) || defined(LYNXOS) || defined(TPF) +/* These systems don't do well with any lingering close code; I don't know + * why -- manoj */ +#define NO_LINGCLOSE +#endif + +/* If APR has OTHER_CHILD logic, use reliable piped logs. */ +#if APR_HAS_OTHER_CHILD +#define AP_HAVE_RELIABLE_PIPED_LOGS TRUE +#endif + +#if APR_CHARSET_EBCDIC && !defined(APACHE_XLATE) +#define APACHE_XLATE +#endif + +#endif /* AP_CONFIG_H */ diff --git a/rubbos/app/httpd-2.0.64/include/ap_config_auto.h b/rubbos/app/httpd-2.0.64/include/ap_config_auto.h new file mode 100644 index 00000000..701a99e1 --- /dev/null +++ b/rubbos/app/httpd-2.0.64/include/ap_config_auto.h @@ -0,0 +1,250 @@ +/* include/ap_config_auto.h. Generated from ap_config_auto.h.in by configure. */ +/* include/ap_config_auto.h.in. Generated from configure.in by autoheader. */ +/* Define this if struct tm has a field tm_gmtoff */ +#define HAVE_GMTOFF 1 + +/* Define if building universal (internal helper macro) */ +/* #undef AC_APPLE_UNIVERSAL_BUILD */ + +/* Location of the source for the current MPM */ +#define APACHE_MPM_DIR "server/mpm/worker" + +/* SuExec root directory */ +/* #undef AP_DOC_ROOT */ + +/* Allow modules to run hook after a fatal exception */ +/* #undef AP_ENABLE_EXCEPTION_HOOK */ + +/* Allow IPv4 connections on IPv6 listening sockets */ +#define AP_ENABLE_V4_MAPPED 1 + +/* Minimum allowed GID */ +/* #undef AP_GID_MIN */ + +/* User allowed to call SuExec */ +/* #undef AP_HTTPD_USER */ + +/* SuExec log file */ +/* #undef AP_LOG_EXEC */ + +/* Listening sockets are non-blocking when there are more than 1 */ +#define AP_NONBLOCK_WHEN_MULTI_LISTEN 1 + +/* safe shell path for SuExec */ +/* #undef AP_SAFE_PATH */ + +/* Signal used to gracefully restart */ +#define AP_SIG_GRACEFUL SIGUSR1 + +/* Signal used to gracefully restart (without SIG prefix) */ +#define AP_SIG_GRACEFUL_SHORT USR1 + +/* Signal used to gracefully restart (as a quoted string) */ +#define AP_SIG_GRACEFUL_STRING "SIGUSR1" + +/* umask for suexec'd process */ +/* #undef AP_SUEXEC_UMASK */ + +/* Location of the MIME types config file, relative to the Apache root + directory */ +#define AP_TYPES_CONFIG_FILE "conf/mime.types" + +/* Minimum allowed UID */ +/* #undef AP_UID_MIN */ + +/* byte order is unknown due to cross-compilation */ +/* #undef AP_UNKNOWN_BYTE_ORDER */ + +/* User subdirectory */ +/* #undef AP_USERDIR_SUFFIX */ + +/* Using autoconf to configure Apache */ +#define AP_USING_AUTOCONF 1 + +/* Define to 1 if you have the `bindprocessor' function. */ +/* #undef HAVE_BINDPROCESSOR */ + +/* Define to 1 if you have the <bstring.h> header file. */ +/* #undef HAVE_BSTRING_H */ + +/* Define to 1 if you have the `getgrnam' function. */ +#define HAVE_GETGRNAM 1 + +/* Define to 1 if you have the `getpwnam' function. */ +#define HAVE_GETPWNAM 1 + +/* Define to 1 if you have the <grp.h> header file. */ +#define HAVE_GRP_H 1 + +/* Define to 1 if you have the `initgroups' function. */ +#define HAVE_INITGROUPS 1 + +/* Define to 1 if you have the <inttypes.h> header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the `killpg' function. */ +#define HAVE_KILLPG 1 + +/* Define to 1 if you have the <limits.h> header file. */ +#define HAVE_LIMITS_H 1 + +/* Define to 1 if you have the <memory.h> header file. */ +#define HAVE_MEMORY_H 1 + +/* Define to 1 if you have the `prctl' function. */ +#define HAVE_PRCTL 1 + +/* Define to 1 if you have the `pthread_kill' function. */ +#define HAVE_PTHREAD_KILL 1 + +/* Define to 1 if you have the <pwd.h> header file. */ +#define HAVE_PWD_H 1 + +/* Define to 1 if you have the `setsid' function. */ +#define HAVE_SETSID 1 + +/* Define to 1 if you have the `SSL_set_cert_store' function. */ +/* #undef HAVE_SSL_SET_CERT_STORE */ + +/* Define to 1 if you have the `SSL_set_state' function. */ +/* #undef HAVE_SSL_SET_STATE */ + +/* Define to 1 if you have the <stdint.h> header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the <stdlib.h> header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the <strings.h> header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the <string.h> header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the `syslog' function. */ +#define HAVE_SYSLOG 1 + +/* Define to 1 if you have the <sys/ipc.h> header file. */ +#define HAVE_SYS_IPC_H 1 + +/* Define to 1 if you have the <sys/prctl.h> header file. */ +#define HAVE_SYS_PRCTL_H 1 + +/* Define to 1 if you have the <sys/processor.h> header file. */ +/* #undef HAVE_SYS_PROCESSOR_H */ + +/* Define to 1 if you have the <sys/resource.h> header file. */ +#define HAVE_SYS_RESOURCE_H 1 + +/* Define to 1 if you have the <sys/sem.h> header file. */ +#define HAVE_SYS_SEM_H 1 + +/* Define to 1 if you have the <sys/socket.h> header file. */ +#define HAVE_SYS_SOCKET_H 1 + +/* Define to 1 if you have the <sys/stat.h> header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the <sys/times.h> header file. */ +#define HAVE_SYS_TIMES_H 1 + +/* Define to 1 if you have the <sys/time.h> header file. */ +#define HAVE_SYS_TIME_H 1 + +/* Define to 1 if you have the <sys/types.h> header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have <sys/wait.h> that is POSIX.1 compatible. */ +#define HAVE_SYS_WAIT_H 1 + +/* Define to 1 if you have the `timegm' function. */ +#define HAVE_TIMEGM 1 + +/* Define to 1 if you have the `times' function. */ +#define HAVE_TIMES 1 + +/* Define to 1 if you have the <unistd.h> header file. */ +#define HAVE_UNISTD_H 1 + +/* Define to 1 if you have the <zutil.h> header file. */ +/* #undef HAVE_ZUTIL_H */ + +/* Root directory of the Apache install area */ +#define HTTPD_ROOT "/bottlenecks/rubbos/app/apache2" + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "" + +/* Location of the config file, relative to the Apache root directory */ +#define SERVER_CONFIG_FILE "conf/httpd.conf" + +/* This platform doesn't suffer from the thundering herd problem */ +/* #undef SINGLE_LISTEN_UNSERIALIZED_ACCEPT */ + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Path to suexec binary */ +/* #undef SUEXEC_BIN */ + +/* Enable extensions on AIX 3, Interix. */ +#ifndef _ALL_SOURCE +# define _ALL_SOURCE 1 +#endif +/* Enable GNU extensions on systems that have them. */ +#ifndef _GNU_SOURCE +# define _GNU_SOURCE 1 +#endif +/* Enable threading extensions on Solaris. */ +#ifndef _POSIX_PTHREAD_SEMANTICS +# define _POSIX_PTHREAD_SEMANTICS 1 +#endif +/* Enable extensions on HP NonStop. */ +#ifndef _TANDEM_SOURCE +# define _TANDEM_SOURCE 1 +#endif +/* Enable general extensions on Solaris. */ +#ifndef __EXTENSIONS__ +# define __EXTENSIONS__ 1 +#endif + + +/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most + significant byte first (like Motorola and SPARC, unlike Intel). */ +#if defined AC_APPLE_UNIVERSAL_BUILD +# if defined __BIG_ENDIAN__ +# define WORDS_BIGENDIAN 1 +# endif +#else +# ifndef WORDS_BIGENDIAN +/* # undef WORDS_BIGENDIAN */ +# endif +#endif + +/* Define to 1 if on MINIX. */ +/* #undef _MINIX */ + +/* Define to 2 if the system does not provide POSIX.1 features except with + this defined. */ +/* #undef _POSIX_1_SOURCE */ + +/* Define to 1 if you need to in order for `stat' and other things to work. */ +/* #undef _POSIX_SOURCE */ + +/* Define to empty if `const' does not conform to ANSI C. */ +/* #undef const */ + +/* Define to 'int' if <sys/resource.h> doesn't define it for us */ +/* #undef rlim_t */ diff --git a/rubbos/app/httpd-2.0.64/include/ap_config_auto.h.in b/rubbos/app/httpd-2.0.64/include/ap_config_auto.h.in new file mode 100644 index 00000000..0b069a29 --- /dev/null +++ b/rubbos/app/httpd-2.0.64/include/ap_config_auto.h.in @@ -0,0 +1,249 @@ +/* include/ap_config_auto.h.in. Generated from configure.in by autoheader. */ +/* Define this if struct tm has a field tm_gmtoff */ +#undef HAVE_GMTOFF + +/* Define if building universal (internal helper macro) */ +#undef AC_APPLE_UNIVERSAL_BUILD + +/* Location of the source for the current MPM */ +#undef APACHE_MPM_DIR + +/* SuExec root directory */ +#undef AP_DOC_ROOT + +/* Allow modules to run hook after a fatal exception */ +#undef AP_ENABLE_EXCEPTION_HOOK + +/* Allow IPv4 connections on IPv6 listening sockets */ +#undef AP_ENABLE_V4_MAPPED + +/* Minimum allowed GID */ +#undef AP_GID_MIN + +/* User allowed to call SuExec */ +#undef AP_HTTPD_USER + +/* SuExec log file */ +#undef AP_LOG_EXEC + +/* Listening sockets are non-blocking when there are more than 1 */ +#undef AP_NONBLOCK_WHEN_MULTI_LISTEN + +/* safe shell path for SuExec */ +#undef AP_SAFE_PATH + +/* Signal used to gracefully restart */ +#undef AP_SIG_GRACEFUL + +/* Signal used to gracefully restart (without SIG prefix) */ +#undef AP_SIG_GRACEFUL_SHORT + +/* Signal used to gracefully restart (as a quoted string) */ +#undef AP_SIG_GRACEFUL_STRING + +/* umask for suexec'd process */ +#undef AP_SUEXEC_UMASK + +/* Location of the MIME types config file, relative to the Apache root + directory */ +#undef AP_TYPES_CONFIG_FILE + +/* Minimum allowed UID */ +#undef AP_UID_MIN + +/* byte order is unknown due to cross-compilation */ +#undef AP_UNKNOWN_BYTE_ORDER + +/* User subdirectory */ +#undef AP_USERDIR_SUFFIX + +/* Using autoconf to configure Apache */ +#undef AP_USING_AUTOCONF + +/* Define to 1 if you have the `bindprocessor' function. */ +#undef HAVE_BINDPROCESSOR + +/* Define to 1 if you have the <bstring.h> header file. */ +#undef HAVE_BSTRING_H + +/* Define to 1 if you have the `getgrnam' function. */ +#undef HAVE_GETGRNAM + +/* Define to 1 if you have the `getpwnam' function. */ +#undef HAVE_GETPWNAM + +/* Define to 1 if you have the <grp.h> header file. */ +#undef HAVE_GRP_H + +/* Define to 1 if you have the `initgroups' function. */ +#undef HAVE_INITGROUPS + +/* Define to 1 if you have the <inttypes.h> header file. */ +#undef HAVE_INTTYPES_H + +/* Define to 1 if you have the `killpg' function. */ +#undef HAVE_KILLPG + +/* Define to 1 if you have the <limits.h> header file. */ +#undef HAVE_LIMITS_H + +/* Define to 1 if you have the <memory.h> header file. */ +#undef HAVE_MEMORY_H + +/* Define to 1 if you have the `prctl' function. */ +#undef HAVE_PRCTL + +/* Define to 1 if you have the `pthread_kill' function. */ +#undef HAVE_PTHREAD_KILL + +/* Define to 1 if you have the <pwd.h> header file. */ +#undef HAVE_PWD_H + +/* Define to 1 if you have the `setsid' function. */ +#undef HAVE_SETSID + +/* Define to 1 if you have the `SSL_set_cert_store' function. */ +#undef HAVE_SSL_SET_CERT_STORE + +/* Define to 1 if you have the `SSL_set_state' function. */ +#undef HAVE_SSL_SET_STATE + +/* Define to 1 if you have the <stdint.h> header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the <stdlib.h> header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the <strings.h> header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the <string.h> header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if you have the `syslog' function. */ +#undef HAVE_SYSLOG + +/* Define to 1 if you have the <sys/ipc.h> header file. */ +#undef HAVE_SYS_IPC_H + +/* Define to 1 if you have the <sys/prctl.h> header file. */ +#undef HAVE_SYS_PRCTL_H + +/* Define to 1 if you have the <sys/processor.h> header file. */ +#undef HAVE_SYS_PROCESSOR_H + +/* Define to 1 if you have the <sys/resource.h> header file. */ +#undef HAVE_SYS_RESOURCE_H + +/* Define to 1 if you have the <sys/sem.h> header file. */ +#undef HAVE_SYS_SEM_H + +/* Define to 1 if you have the <sys/socket.h> header file. */ +#undef HAVE_SYS_SOCKET_H + +/* Define to 1 if you have the <sys/stat.h> header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the <sys/times.h> header file. */ +#undef HAVE_SYS_TIMES_H + +/* Define to 1 if you have the <sys/time.h> header file. */ +#undef HAVE_SYS_TIME_H + +/* Define to 1 if you have the <sys/types.h> header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have <sys/wait.h> that is POSIX.1 compatible. */ +#undef HAVE_SYS_WAIT_H + +/* Define to 1 if you have the `timegm' function. */ +#undef HAVE_TIMEGM + +/* Define to 1 if you have the `times' function. */ +#undef HAVE_TIMES + +/* Define to 1 if you have the <unistd.h> header file. */ +#undef HAVE_UNISTD_H + +/* Define to 1 if you have the <zutil.h> header file. */ +#undef HAVE_ZUTIL_H + +/* Root directory of the Apache install area */ +#undef HTTPD_ROOT + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* Location of the config file, relative to the Apache root directory */ +#undef SERVER_CONFIG_FILE + +/* This platform doesn't suffer from the thundering herd problem */ +#undef SINGLE_LISTEN_UNSERIALIZED_ACCEPT + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Path to suexec binary */ +#undef SUEXEC_BIN + +/* Enable extensions on AIX 3, Interix. */ +#ifndef _ALL_SOURCE +# undef _ALL_SOURCE +#endif +/* Enable GNU extensions on systems that have them. */ +#ifndef _GNU_SOURCE +# undef _GNU_SOURCE +#endif +/* Enable threading extensions on Solaris. */ +#ifndef _POSIX_PTHREAD_SEMANTICS +# undef _POSIX_PTHREAD_SEMANTICS +#endif +/* Enable extensions on HP NonStop. */ +#ifndef _TANDEM_SOURCE +# undef _TANDEM_SOURCE +#endif +/* Enable general extensions on Solaris. */ +#ifndef __EXTENSIONS__ +# undef __EXTENSIONS__ +#endif + + +/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most + significant byte first (like Motorola and SPARC, unlike Intel). */ +#if defined AC_APPLE_UNIVERSAL_BUILD +# if defined __BIG_ENDIAN__ +# define WORDS_BIGENDIAN 1 +# endif +#else +# ifndef WORDS_BIGENDIAN +# undef WORDS_BIGENDIAN +# endif +#endif + +/* Define to 1 if on MINIX. */ +#undef _MINIX + +/* Define to 2 if the system does not provide POSIX.1 features except with + this defined. */ +#undef _POSIX_1_SOURCE + +/* Define to 1 if you need to in order for `stat' and other things to work. */ +#undef _POSIX_SOURCE + +/* Define to empty if `const' does not conform to ANSI C. */ +#undef const + +/* Define to 'int' if <sys/resource.h> doesn't define it for us */ +#undef rlim_t diff --git a/rubbos/app/httpd-2.0.64/include/ap_config_layout.h b/rubbos/app/httpd-2.0.64/include/ap_config_layout.h new file mode 100644 index 00000000..968d8f34 --- /dev/null +++ b/rubbos/app/httpd-2.0.64/include/ap_config_layout.h @@ -0,0 +1,59 @@ +/* Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef AP_CONFIG_LAYOUT_H +#define AP_CONFIG_LAYOUT_H + +/* Configured Apache directory layout */ +#define DEFAULT_PREFIX "/bottlenecks/rubbos/app/apache2" +#define DEFAULT_EXP_EXEC_PREFIX "/bottlenecks/rubbos/app/apache2" +#define DEFAULT_REL_EXEC_PREFIX "" +#define DEFAULT_EXP_BINDIR "/bottlenecks/rubbos/app/apache2/bin" +#define DEFAULT_REL_BINDIR "bin" +#define DEFAULT_EXP_SBINDIR "/bottlenecks/rubbos/app/apache2/bin" +#define DEFAULT_REL_SBINDIR "bin" +#define DEFAULT_EXP_LIBEXECDIR "/bottlenecks/rubbos/app/apache2/modules" +#define DEFAULT_REL_LIBEXECDIR "modules" +#define DEFAULT_EXP_MANDIR "/bottlenecks/rubbos/app/apache2/man" +#define DEFAULT_REL_MANDIR "man" +#define DEFAULT_EXP_SYSCONFDIR "/bottlenecks/rubbos/app/apache2/conf" +#define DEFAULT_REL_SYSCONFDIR "conf" +#define DEFAULT_EXP_DATADIR "/bottlenecks/rubbos/app/apache2" +#define DEFAULT_REL_DATADIR "" +#define DEFAULT_EXP_INSTALLBUILDDIR "/bottlenecks/rubbos/app/apache2/build" +#define DEFAULT_REL_INSTALLBUILDDIR "build" +#define DEFAULT_EXP_ERRORDIR "/bottlenecks/rubbos/app/apache2/error" +#define DEFAULT_REL_ERRORDIR "error" +#define DEFAULT_EXP_ICONSDIR "/bottlenecks/rubbos/app/apache2/icons" +#define DEFAULT_REL_ICONSDIR "icons" +#define DEFAULT_EXP_HTDOCSDIR "/bottlenecks/rubbos/app/apache2/htdocs" +#define DEFAULT_REL_HTDOCSDIR "htdocs" +#define DEFAULT_EXP_MANUALDIR "/bottlenecks/rubbos/app/apache2/manual" +#define DEFAULT_REL_MANUALDIR "manual" +#define DEFAULT_EXP_CGIDIR "/bottlenecks/rubbos/app/apache2/cgi-bin" +#define DEFAULT_REL_CGIDIR "cgi-bin" +#define DEFAULT_EXP_INCLUDEDIR "/bottlenecks/rubbos/app/apache2/include" +#define DEFAULT_REL_INCLUDEDIR "include" +#define DEFAULT_EXP_LOCALSTATEDIR "/bottlenecks/rubbos/app/apache2" +#define DEFAULT_REL_LOCALSTATEDIR "" +#define DEFAULT_EXP_RUNTIMEDIR "/bottlenecks/rubbos/app/apache2/logs" +#define DEFAULT_REL_RUNTIMEDIR "logs" +#define DEFAULT_EXP_LOGFILEDIR "/bottlenecks/rubbos/app/apache2/logs" +#define DEFAULT_REL_LOGFILEDIR "logs" +#define DEFAULT_EXP_PROXYCACHEDIR "/bottlenecks/rubbos/app/apache2/proxy" +#define DEFAULT_REL_PROXYCACHEDIR "proxy" + +#endif /* AP_CONFIG_LAYOUT_H */ diff --git a/rubbos/app/httpd-2.0.64/include/ap_config_layout.h.in b/rubbos/app/httpd-2.0.64/include/ap_config_layout.h.in new file mode 100644 index 00000000..5f936a23 --- /dev/null +++ b/rubbos/app/httpd-2.0.64/include/ap_config_layout.h.in @@ -0,0 +1,59 @@ +/* Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef AP_CONFIG_LAYOUT_H +#define AP_CONFIG_LAYOUT_H + +/* Configured Apache directory layout */ +#define DEFAULT_PREFIX "@prefix@" +#define DEFAULT_EXP_EXEC_PREFIX "@exp_exec_prefix@" +#define DEFAULT_REL_EXEC_PREFIX "@rel_exec_prefix@" +#define DEFAULT_EXP_BINDIR "@exp_bindir@" +#define DEFAULT_REL_BINDIR "@rel_bindir@" +#define DEFAULT_EXP_SBINDIR "@exp_sbindir@" +#define DEFAULT_REL_SBINDIR "@rel_sbindir@" +#define DEFAULT_EXP_LIBEXECDIR "@exp_libexecdir@" +#define DEFAULT_REL_LIBEXECDIR "@rel_libexecdir@" +#define DEFAULT_EXP_MANDIR "@exp_mandir@" +#define DEFAULT_REL_MANDIR "@rel_mandir@" +#define DEFAULT_EXP_SYSCONFDIR "@exp_sysconfdir@" +#define DEFAULT_REL_SYSCONFDIR "@rel_sysconfdir@" +#define DEFAULT_EXP_DATADIR "@exp_datadir@" +#define DEFAULT_REL_DATADIR "@rel_datadir@" +#define DEFAULT_EXP_INSTALLBUILDDIR "@exp_installbuilddir@" +#define DEFAULT_REL_INSTALLBUILDDIR "@rel_installbuilddir@" +#define DEFAULT_EXP_ERRORDIR "@exp_errordir@" +#define DEFAULT_REL_ERRORDIR "@rel_errordir@" +#define DEFAULT_EXP_ICONSDIR "@exp_iconsdir@" +#define DEFAULT_REL_ICONSDIR "@rel_iconsdir@" +#define DEFAULT_EXP_HTDOCSDIR "@exp_htdocsdir@" +#define DEFAULT_REL_HTDOCSDIR "@rel_htdocsdir@" +#define DEFAULT_EXP_MANUALDIR "@exp_manualdir@" +#define DEFAULT_REL_MANUALDIR "@rel_manualdir@" +#define DEFAULT_EXP_CGIDIR "@exp_cgidir@" +#define DEFAULT_REL_CGIDIR "@rel_cgidir@" +#define DEFAULT_EXP_INCLUDEDIR "@exp_includedir@" +#define DEFAULT_REL_INCLUDEDIR "@rel_includedir@" +#define DEFAULT_EXP_LOCALSTATEDIR "@exp_localstatedir@" +#define DEFAULT_REL_LOCALSTATEDIR "@rel_localstatedir@" +#define DEFAULT_EXP_RUNTIMEDIR "@exp_runtimedir@" +#define DEFAULT_REL_RUNTIMEDIR "@rel_runtimedir@" +#define DEFAULT_EXP_LOGFILEDIR "@exp_logfiledir@" +#define DEFAULT_REL_LOGFILEDIR "@rel_logfiledir@" +#define DEFAULT_EXP_PROXYCACHEDIR "@exp_proxycachedir@" +#define DEFAULT_REL_PROXYCACHEDIR "@rel_proxycachedir@" + +#endif /* AP_CONFIG_LAYOUT_H */ diff --git a/rubbos/app/httpd-2.0.64/include/ap_listen.h b/rubbos/app/httpd-2.0.64/include/ap_listen.h new file mode 100644 index 00000000..291b8266 --- /dev/null +++ b/rubbos/app/httpd-2.0.64/include/ap_listen.h @@ -0,0 +1,119 @@ +/* Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef AP_LISTEN_H +#define AP_LISTEN_H + +#include "apr_network_io.h" +#include "httpd.h" +#include "http_config.h" + +/** + * @package Apache Listeners Library + */ + +typedef struct ap_listen_rec ap_listen_rec; +typedef apr_status_t (*accept_function)(void **csd, ap_listen_rec *lr, apr_pool_t *ptrans); + +/** + * Apache's listeners record. These are used in the Multi-Processing Modules + * to setup all of the sockets for the MPM to listen to and accept on. + */ +struct ap_listen_rec { + /** + * The next listener in the list + */ + ap_listen_rec *next; + /** + * The actual socket + */ + apr_socket_t *sd; + /** + * The sockaddr the socket should bind to + */ + apr_sockaddr_t *bind_addr; + /** + * The accept function for this socket + */ + accept_function accept_func; + /** + * Is this socket currently active + */ + int active; +/* more stuff here, like which protocol is bound to the port */ +}; + +/** + * The global list of ap_listen_rec structures + */ +AP_DECLARE_DATA extern ap_listen_rec *ap_listeners; + +/** + * Setup all of the defaults for the listener list + */ +void ap_listen_pre_config(void); +#if !defined(SPMT_OS2_MPM) +/** + * Loop through the global ap_listen_rec list and create all of the required + * sockets. This executes the listen and bind on the sockets. + * @param s The global server_rec + * @return The number of open sockets. + * @warning This function is not available to Windows platforms, or the + * Prefork or SPMT_OS2 MPMs. + */ +int ap_setup_listeners(server_rec *s); +#endif +/* Split into two #if's to make the exports scripts easier. + */ +#if defined(SPMT_OS2_MPM) +/** + * Create and open a socket on the specified port. This includes listening + * and binding the socket. + * @param process The process record for the currently running server + * @param port The port to open a socket on. + * @return The number of open sockets + * @warning This function is only available to Windows platforms, or the + * Prefork or SPMT_OS2 MPMs. + */ +int ap_listen_open(process_rec *process, apr_port_t port); +#endif + +/* Although these functions are exported from libmain, they are not really + * public functions. These functions are actually called while parsing the + * config file, when one of the LISTEN_COMMANDS directives is read. These + * should not ever be called by external modules. ALL MPMs should include + * LISTEN_COMMANDS in their command_rec table so that these functions are + * called. + */ +const char *ap_set_listenbacklog(cmd_parms *cmd, void *dummy, const char *arg); +const char *ap_set_listener(cmd_parms *cmd, void *dummy, const char *ips); +const char *ap_set_send_buffer_size(cmd_parms *cmd, void *dummy, + const char *arg); +AP_DECLARE_NONSTD(const char *) ap_set_receive_buffer_size(cmd_parms *cmd, + void *dummy, + const char *arg); + +#define LISTEN_COMMANDS \ +AP_INIT_TAKE1("ListenBacklog", ap_set_listenbacklog, NULL, RSRC_CONF, \ + "Maximum length of the queue of pending connections, as used by listen(2)"), \ +AP_INIT_TAKE1("Listen", ap_set_listener, NULL, RSRC_CONF, \ + "A port number or a numeric IP address and a port number"), \ +AP_INIT_TAKE1("SendBufferSize", ap_set_send_buffer_size, NULL, RSRC_CONF, \ + "Send buffer size in bytes"), \ +AP_INIT_TAKE1("ReceiveBufferSize", ap_set_receive_buffer_size, NULL, \ + RSRC_CONF, "Receive buffer size in bytes") + +#endif diff --git a/rubbos/app/httpd-2.0.64/include/ap_mmn.h b/rubbos/app/httpd-2.0.64/include/ap_mmn.h new file mode 100644 index 00000000..a3704803 --- /dev/null +++ b/rubbos/app/httpd-2.0.64/include/ap_mmn.h @@ -0,0 +1,127 @@ +/* Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef APACHE_AP_MMN_H +#define APACHE_AP_MMN_H + +/** + * @package Module Magic Number + */ + +/* + * MODULE_MAGIC_NUMBER_MAJOR + * Major API changes that could cause compatibility problems for older modules + * such as structure size changes. No binary compatibility is possible across + * a change in the major version. + * + * MODULE_MAGIC_NUMBER_MINOR + * Minor API changes that do not cause binary compatibility problems. + * Should be reset to 0 when upgrading MODULE_MAGIC_NUMBER_MAJOR. + * + * See the MODULE_MAGIC_AT_LEAST macro below for an example. + */ + +/* + * 20010224 (2.0.13-dev) MODULE_MAGIC_COOKIE reset to "AP20" + * 20010523 (2.0.19-dev) bump for scoreboard structure reordering + * 20010627 (2.0.19-dev) more API changes than I can count + * 20010726 (2.0.22-dev) more big API changes + * 20010808 (2.0.23-dev) dir d_is_absolute bit introduced, bucket changes, etc + * 20010825 (2.0.25-dev) removed d_is_absolute, introduced map_to_storage hook + * 20011002 (2.0.26-dev) removed 1.3-depreciated request_rec.content_language + * 20011127 (2.0.29-dev) bump for postconfig hook change, and removal of socket + * from connection record + * 20011212 (2.0.30-dev) bump for new used_path_info member of request_rec + * 20011218 (2.0.30-dev) bump for new sbh member of conn_rec, different + * declarations for scoreboard, new parameter to + * create_connection hook + * 20020102 (2.0.30-dev) bump for changed type of limit_req_body in + * core_dir_config + * 20020109 (2.0.31-dev) bump for changed shm and scoreboard declarations + * 20020111 (2.0.31-dev) bump for ETag fields added at end of cor_dir_config + * 20020114 (2.0.31-dev) mod_dav changed how it asks its provider to fulfill + * a GET request + * 20020118 (2.0.31-dev) Input filtering split of blocking and mode + * 20020127 (2.0.31-dev) bump for pre_mpm hook change + * 20020128 (2.0.31-dev) bump for pre_config hook change + * 20020218 (2.0.33-dev) bump for AddOutputFilterByType directive + * 20020220 (2.0.33-dev) bump for scoreboard.h structure change + * 20020302 (2.0.33-dev) bump for protocol_filter additions. + * 20020306 (2.0.34-dev) bump for filter type renames. + * 20020318 (2.0.34-dev) mod_dav's API for REPORT generation changed + * 20020319 (2.0.34-dev) M_INVALID changed, plus new M_* methods for RFC 3253 + * 20020327 (2.0.35-dev) Add parameter to quick_handler hook + * 20020329 (2.0.35-dev) bump for addition of freelists to bucket API + * 20020329.1 (2.0.36) minor bump for new arg to opt fn ap_cgi_build_command + * 20020506 (2.0.37-dev) Removed r->boundary in request_rec. + * 20020529 (2.0.37-dev) Standardized the names of some apr_pool_*_set funcs + * 20020602 (2.0.37-dev) Bucket API change (metadata buckets) + * 20020612 (2.0.38-dev) Changed server_rec->[keep_alive_]timeout to apr time + * 20020625 (2.0.40-dev) Changed conn_rec->keepalive to an enumeration + * 20020628 (2.0.40-dev) Added filter_init to filter registration functions + * 20020903 (2.0.41-dev) APR's error constants changed + * 20020903.2 (2.0.46-dev) add ap_escape_logitem + * 20020903.3 (2.0.46-dev) allow_encoded_slashes added to core_dir_config + * 20020903.4 (2.0.47-dev) add ap_is_recursion_limit_exceeded() + * 20020903.5 (2.0.49-dev) add ap_escape_errorlog_item() + * 20020903.6 (2.0.49-dev) add insert_error_filter hook + * 20020903.7 (2.0.49-dev) added XHTML Doctypes + * 20020903.8 (2.0.50-dev) export ap_set_sub_req_protocol and + * ap_finalize_sub_req_protocol on Win32 and NetWare + * 20020903.9 (2.0.51-dev) create pcommands and initialize arrays before + * calling ap_setup_prelinked_modules + * 20020903.10 (2.0.55-dev) add ap_log_cerror() + * 20020903.11 (2.0.55-dev) added trace_enable to core_server_config + * 20020903.12 (2.0.56-dev) added ap_get_server_revision / ap_version_t + * 20020903.13 (2.0.62-dev) Add *ftp_directory_charset to proxy_dir_conf + * 20020903.14 (2.0.64-dev) added ap_vhost_iterate_given_conn + */ + +#define MODULE_MAGIC_COOKIE 0x41503230UL /* "AP20" */ + +#ifndef MODULE_MAGIC_NUMBER_MAJOR +#define MODULE_MAGIC_NUMBER_MAJOR 20020903 +#endif +#define MODULE_MAGIC_NUMBER_MINOR 14 /* 0...n */ + +/** + * Determine if the server's current MODULE_MAGIC_NUMBER is at least a + * specified value. + * <pre> + * Useful for testing for features. + * For example, suppose you wish to use the apr_table_overlap + * function. You can do this: + * + * #if AP_MODULE_MAGIC_AT_LEAST(19980812,2) + * ... use apr_table_overlap() + * #else + * ... alternative code which doesn't use apr_table_overlap() + * #endif + * </pre> + * @param major The major module magic number + * @param minor The minor module magic number + * @deffunc AP_MODULE_MAGIC_AT_LEAST(int major, int minor) + */ +#define AP_MODULE_MAGIC_AT_LEAST(major,minor) \ + ((major) < MODULE_MAGIC_NUMBER_MAJOR \ + || ((major) == MODULE_MAGIC_NUMBER_MAJOR \ + && (minor) <= MODULE_MAGIC_NUMBER_MINOR)) + +/** @deprecated present for backwards compatibility */ +#define MODULE_MAGIC_NUMBER MODULE_MAGIC_NUMBER_MAJOR +#define MODULE_MAGIC_AT_LEAST old_broken_macro_we_hope_you_are_not_using + +#endif /* !APACHE_AP_MMN_H */ diff --git a/rubbos/app/httpd-2.0.64/include/ap_mpm.h b/rubbos/app/httpd-2.0.64/include/ap_mpm.h new file mode 100644 index 00000000..9e41e904 --- /dev/null +++ b/rubbos/app/httpd-2.0.64/include/ap_mpm.h @@ -0,0 +1,176 @@ +/* Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef AP_MPM_H +#define AP_MPM_H + +#include "apr_thread_proc.h" + +/** + * @package Multi-Processing Module library + */ + +/* + The MPM, "multi-processing model" provides an abstraction of the + interface with the OS for distributing incoming connections to + threads/process for processing. http_main invokes the MPM, and + the MPM runs until a shutdown/restart has been indicated. + The MPM calls out to the apache core via the ap_process_connection + function when a connection arrives. + + The MPM may or may not be multithreaded. In the event that it is + multithreaded, at any instant it guarantees a 1:1 mapping of threads + ap_process_connection invocations. + + Note: In the future it will be possible for ap_process_connection + to return to the MPM prior to finishing the entire connection; and + the MPM will proceed with asynchronous handling for the connection; + in the future the MPM may call ap_process_connection again -- but + does not guarantee it will occur on the same thread as the first call. + + The MPM further guarantees that no asynchronous behaviour such as + longjmps and signals will interfere with the user code that is + invoked through ap_process_connection. The MPM may reserve some + signals for its use (i.e. SIGUSR1), but guarantees that these signals + are ignored when executing outside the MPM code itself. (This + allows broken user code that does not handle EINTR to function + properly.) + + The suggested server restart and stop behaviour will be "graceful". + However the MPM may choose to terminate processes when the user + requests a non-graceful restart/stop. When this occurs, the MPM kills + all threads with extreme prejudice, and destroys the pchild pool. + User cleanups registered in the pchild apr_pool_t will be invoked at + this point. (This can pose some complications, the user cleanups + are asynchronous behaviour not unlike longjmp/signal... but if the + admin is asking for a non-graceful shutdown, how much effort should + we put into doing it in a nice way?) + + unix/posix notes: + - The MPM does not set a SIGALRM handler, user code may use SIGALRM. + But the preferred method of handling timeouts is to use the + timeouts provided by the BUFF abstraction. + - The proper setting for SIGPIPE is SIG_IGN, if user code changes it + for any of their own processing, it must be restored to SIG_IGN + prior to executing or returning to any apache code. + TODO: add SIGPIPE debugging check somewhere to make sure it's SIG_IGN +*/ + +/** + * This is the function that MPMs must create. This function is responsible + * for controlling the parent and child processes. It will run until a + * restart/shutdown is indicated. + * @param pconf the configuration pool, reset before the config file is read + * @param plog the log pool, reset after the config file is read + * @param server_conf the global server config. + * @return 1 for shutdown 0 otherwise. + * @deffunc int ap_mpm_run(apr_pool_t *pconf, apr_pool_t *plog, server_rec *server_conf) + */ +AP_DECLARE(int) ap_mpm_run(apr_pool_t *pconf, apr_pool_t *plog, server_rec *server_conf); + +/** + * predicate indicating if a graceful stop has been requested ... + * used by the connection loop + * @return 1 if a graceful stop has been requested, 0 otherwise + * @deffunc int ap_graceful_stop_signalled(*void) + */ +AP_DECLARE(int) ap_graceful_stop_signalled(void); + +/** + * Spawn a process with privileges that another module has requested + * @param r The request_rec of the current request + * @param newproc The resulting process handle. + * @param progname The program to run + * @param const_args the arguments to pass to the new program. The first + * one should be the program name. + * @param env The new environment apr_table_t for the new process. This + * should be a list of NULL-terminated strings. + * @param attr the procattr we should use to determine how to create the new + * process + * @param p The pool to use. + */ +AP_DECLARE(apr_status_t) ap_os_create_privileged_process( + const request_rec *r, + apr_proc_t *newproc, + const char *progname, + const char * const *args, + const char * const *env, + apr_procattr_t *attr, + apr_pool_t *p); + +/* Subtypes/Values for AP_MPMQ_IS_THREADED and AP_MPMQ_IS_FORKED */ +#define AP_MPMQ_NOT_SUPPORTED 0 /* This value specifies whether */ + /* an MPM is capable of */ + /* threading or forking. */ +#define AP_MPMQ_STATIC 1 /* This value specifies whether */ + /* an MPM is using a static # */ + /* threads or daemons. */ +#define AP_MPMQ_DYNAMIC 2 /* This value specifies whether */ + /* an MPM is using a dynamic # */ + /* threads or daemons. */ + +/* Values returned for AP_MPMQ_MPM_STATE */ +#define AP_MPMQ_STARTING 0 +#define AP_MPMQ_RUNNING 1 +#define AP_MPMQ_STOPPING 2 + +#define AP_MPMQ_MAX_DAEMON_USED 1 /* Max # of daemons used so far */ +#define AP_MPMQ_IS_THREADED 2 /* MPM can do threading */ +#define AP_MPMQ_IS_FORKED 3 /* MPM can do forking */ +#define AP_MPMQ_HARD_LIMIT_DAEMONS 4 /* The compiled max # daemons */ +#define AP_MPMQ_HARD_LIMIT_THREADS 5 /* The compiled max # threads */ +#define AP_MPMQ_MAX_THREADS 6 /* # of threads/child by config */ +#define AP_MPMQ_MIN_SPARE_DAEMONS 7 /* Min # of spare daemons */ +#define AP_MPMQ_MIN_SPARE_THREADS 8 /* Min # of spare threads */ +#define AP_MPMQ_MAX_SPARE_DAEMONS 9 /* Max # of spare daemons */ +#define AP_MPMQ_MAX_SPARE_THREADS 10 /* Max # of spare threads */ +#define AP_MPMQ_MAX_REQUESTS_DAEMON 11 /* Max # of requests per daemon */ +#define AP_MPMQ_MAX_DAEMONS 12 /* Max # of daemons by config */ +#define AP_MPMQ_MPM_STATE 13 /* starting, running, stopping */ + +/** + * Query a property of the current MPM. + * @param query_code One of APM_MPMQ_* + * @param result A location to place the result of the query + * @return APR_SUCCESS or APR_ENOTIMPL + * @deffunc int ap_mpm_query(int query_code, int *result) + */ +AP_DECLARE(apr_status_t) ap_mpm_query(int query_code, int *result); + +/* Defining GPROF when compiling uses the moncontrol() function to + * disable gprof profiling in the parent, and enable it only for + * request processing in children (or in one_process mode). It's + * absolutely required to get useful gprof results under linux + * because the profile itimers and such are disabled across a + * fork(). It's probably useful elsewhere as well. + */ +#ifdef GPROF +extern void moncontrol(int); +#define AP_MONCONTROL(x) moncontrol(x) +#else +#define AP_MONCONTROL(x) +#endif + +#if AP_ENABLE_EXCEPTION_HOOK +typedef struct ap_exception_info_t { + int sig; + pid_t pid; +} ap_exception_info_t; + +AP_DECLARE_HOOK(int,fatal_exception,(ap_exception_info_t *ei)) +#endif /*AP_ENABLE_EXCEPTION_HOOK*/ + +#endif diff --git a/rubbos/app/httpd-2.0.64/include/ap_provider.h b/rubbos/app/httpd-2.0.64/include/ap_provider.h new file mode 100644 index 00000000..e9045bae --- /dev/null +++ b/rubbos/app/httpd-2.0.64/include/ap_provider.h @@ -0,0 +1,54 @@ +/* Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef AP_PROVIDER_H +#define AP_PROVIDER_H + +#include "ap_config.h" + +/** + * @package Provider API + */ + +/** + * This function is used to register a provider with the global + * provider pool. + * @param pool The pool to create any storage from + * @param provider_group The group to store the provider in + * @param provider_name The name for this provider + * @param provider_version The version for this provider + * @param provider Opaque structure for this provider + * @return APR_SUCCESS if all went well + */ +AP_DECLARE(apr_status_t) ap_register_provider(apr_pool_t *pool, + const char *provider_group, + const char *provider_name, + const char *provider_version, + const void *provider); + +/** + * This function is used to retrieve a provider from the global + * provider pool. + * @param provider_group The group to look for this provider in + * @param provider_name The name for the provider + * @param provider_version The version for the provider + * @return provider pointer to provider if found, NULL otherwise + */ +AP_DECLARE(void *) ap_lookup_provider(const char *provider_group, + const char *provider_name, + const char *provider_version); + +#endif diff --git a/rubbos/app/httpd-2.0.64/include/ap_regkey.h b/rubbos/app/httpd-2.0.64/include/ap_regkey.h new file mode 100644 index 00000000..d3f41297 --- /dev/null +++ b/rubbos/app/httpd-2.0.64/include/ap_regkey.h @@ -0,0 +1,218 @@ +/* Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef AP_REGKEY_H +#define AP_REGKEY_H + +#if defined(WIN32) || defined(DOXYGEN) + +#include "apr.h" +#include "apr_pools.h" +#include "ap_config.h" /* Just for AP_DECLARE */ + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct ap_regkey_t ap_regkey_t; + +/* Used to recover AP_REGKEY_* constants + */ +AP_DECLARE(const ap_regkey_t *) ap_regkey_const(int i); + +/** + * @file ap_regkey.h + * @brief APR-style Win32 Registry Manipulation + */ + +/** + * Win32 Only: Constants for ap_regkey_open() + */ +#define AP_REGKEY_CLASSES_ROOT ap_regkey_const(0) +#define AP_REGKEY_CURRENT_CONFIG ap_regkey_const(1) +#define AP_REGKEY_CURRENT_USER ap_regkey_const(2) +#define AP_REGKEY_LOCAL_MACHINE ap_regkey_const(3) +#define AP_REGKEY_USERS ap_regkey_const(4) +#define AP_REGKEY_PERFORMANCE_DATA ap_regkey_const(5) +#define AP_REGKEY_DYN_DATA ap_regkey_const(6) + +/** + * Win32 Only: Flags for ap_regkey_value_set() + */ +#define AP_REGKEY_EXPAND 0x0001 + +/** + * Win32 Only: Open the specified registry key. + * @param newkey The opened registry key + * @param parentkey The open registry key of the parent, or one of + * <PRE> + * AP_REGKEY_CLASSES_ROOT + * AP_REGKEY_CURRENT_CONFIG + * AP_REGKEY_CURRENT_USER + * AP_REGKEY_LOCAL_MACHINE + * AP_REGKEY_USERS + * AP_REGKEY_PERFORMANCE_DATA + * AP_REGKEY_DYN_DATA + * </PRE> + * @param keyname The path of the key relative to the parent key + * @param flags Or'ed value of: + * <PRE> + * APR_READ open key for reading + * APR_WRITE open key for writing + * APR_CREATE create the key if it doesn't exist + * APR_EXCL return error if APR_CREATE and key exists + * </PRE> + * @param pool The pool in which newkey is allocated + */ +AP_DECLARE(apr_status_t) ap_regkey_open(ap_regkey_t **newkey, + const ap_regkey_t *parentkey, + const char *keyname, + apr_int32_t flags, + apr_pool_t *pool); + +/** + * Win32 Only: Close the registry key opened or created by ap_regkey_open(). + * @param key The registry key to close + */ +AP_DECLARE(apr_status_t) ap_regkey_close(ap_regkey_t *key); + +/** + * Win32 Only: Remove the given registry key. + * @param parentkey The open registry key of the parent, or one of + * <PRE> + * AP_REGKEY_CLASSES_ROOT + * AP_REGKEY_CURRENT_CONFIG + * AP_REGKEY_CURRENT_USER + * AP_REGKEY_LOCAL_MACHINE + * AP_REGKEY_USERS + * AP_REGKEY_PERFORMANCE_DATA + * AP_REGKEY_DYN_DATA + * </PRE> + * @param keyname The path of the key relative to the parent key + * @param pool The pool used for temp allocations + * @remark ap_regkey_remove() is not recursive, although it removes + * all values within the given keyname, it will not remove a key + * containing subkeys. + */ +AP_DECLARE(apr_status_t) ap_regkey_remove(const ap_regkey_t *parent, + const char *keyname, + apr_pool_t *pool); + +/** + * Win32 Only: Retrieve a registry value string from an open key. + * @param result The string value retrieved + * @param key The registry key to retrieve the value from + * @param valuename The named value to retrieve (pass "" for the default) + * @param pool The pool used to store the result + * @remark There is no toggle to prevent environment variable expansion + * if the registry value is set with AP_REG_EXPAND (REG_EXPAND_SZ), such + * expansions are always performed. + */ +AP_DECLARE(apr_status_t) ap_regkey_value_get(char **result, + ap_regkey_t *key, + const char *valuename, + apr_pool_t *pool); + +/** + * Win32 Only: Store a registry value string into an open key. + * @param key The registry key to store the value into + * @param valuename The named value to store (pass "" for the default) + * @param value The string to store for the named value + * @param flags The option AP_REGKEY_EXPAND or 0, where AP_REGKEY_EXPAND + * values will find all %foo% variables expanded from the environment. + * @param pool The pool used for temp allocations + */ +AP_DECLARE(apr_status_t) ap_regkey_value_set(ap_regkey_t *key, + const char *valuename, + const char *value, + apr_int32_t flags, + apr_pool_t *pool); + +/** + * Win32 Only: Retrieve a raw byte value from an open key. + * @param result The raw bytes value retrieved + * @param resultsize Pointer to a variable to store the number raw bytes retrieved + * @param key The registry key to retrieve the value from + * @param valuename The named value to retrieve (pass "" for the default) + * @param pool The pool used to store the result + */ +AP_DECLARE(apr_status_t) ap_regkey_value_raw_get(void **result, + apr_size_t *resultsize, + apr_int32_t *resulttype, + ap_regkey_t *key, + const char *valuename, + apr_pool_t *pool); + +/** + * Win32 Only: Store a raw bytes value into an open key. + * @param key The registry key to store the value into + * @param valuename The named value to store (pass "" for the default) + * @param value The bytes to store for the named value + * @param valuesize The number of bytes for value + * @param valuetype The + * values will find all %foo% variables expanded from the environment. + * @param pool The pool used for temp allocations + */ +AP_DECLARE(apr_status_t) ap_regkey_value_raw_set(ap_regkey_t *key, + const char *valuename, + const void *value, + apr_size_t valuesize, + apr_int32_t valuetype, + apr_pool_t *pool); + +/** + * Win32 Only: Retrieve a registry value string from an open key. + * @param result The string elements retrieved from a REG_MULTI_SZ string array + * @param key The registry key to retrieve the value from + * @param valuename The named value to retrieve (pass "" for the default) + * @param pool The pool used to store the result + */ +AP_DECLARE(apr_status_t) ap_regkey_value_array_get(apr_array_header_t **result, + ap_regkey_t *key, + const char *valuename, + apr_pool_t *pool); + +/** + * Win32 Only: Store a registry value string array into an open key. + * @param key The registry key to store the value into + * @param valuename The named value to store (pass "" for the default) + * @param nelts The string elements to store in a REG_MULTI_SZ string array + * @param elts The number of elements in the elts string array + * @param pool The pool used for temp allocations + */ +AP_DECLARE(apr_status_t) ap_regkey_value_array_set(ap_regkey_t *key, + const char *valuename, + int nelts, + const char * const * elts, + apr_pool_t *pool); + +/** + * Win32 Only: Remove a registry value from an open key. + * @param key The registry key to remove the value from + * @param valuename The named value to remove (pass "" for the default) + * @param pool The pool used for temp allocations + */ +AP_DECLARE(apr_status_t) ap_regkey_value_remove(const ap_regkey_t *key, + const char *valuename, + apr_pool_t *pool); + +#ifdef __cplusplus +} +#endif + +#endif /* def WIN32 || def DOXYGEN */ + +#endif /* AP_REGKEY_H */ diff --git a/rubbos/app/httpd-2.0.64/include/ap_release.h b/rubbos/app/httpd-2.0.64/include/ap_release.h new file mode 100644 index 00000000..9fee3f4f --- /dev/null +++ b/rubbos/app/httpd-2.0.64/include/ap_release.h @@ -0,0 +1,56 @@ +/* Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef AP_RELEASE_H +#define AP_RELEASE_H + +#include "apr_general.h" /* stringify */ + +#define AP_SERVER_COPYRIGHT \ + "Copyright 2009 The Apache Software Foundation." + +/* + * The below defines the base string of the Server: header. Additional + * tokens can be added via the ap_add_version_component() API call. + * + * The tokens are listed in order of their significance for identifying the + * application. + * + * "Product tokens should be short and to the point -- use of them for + * advertizing or other non-essential information is explicitly forbidden." + * + * Example: "Apache/1.1.0 MrWidget/0.1-alpha" + */ +#define AP_SERVER_BASEVENDOR "Apache Software Foundation" +#define AP_SERVER_BASEPRODUCT "Apache" + +#define AP_SERVER_MAJORVERSION_NUMBER 2 +#define AP_SERVER_MINORVERSION_NUMBER 0 +#define AP_SERVER_PATCHLEVEL_NUMBER 64 +#define AP_SERVER_ADD_STRING "" + +/* keep old macros as well */ +#define AP_SERVER_MAJORVERSION APR_STRINGIFY(AP_SERVER_MAJORVERSION_NUMBER) +#define AP_SERVER_MINORVERSION APR_STRINGIFY(AP_SERVER_MINORVERSION_NUMBER) +#define AP_SERVER_PATCHLEVEL APR_STRINGIFY(AP_SERVER_PATCHLEVEL_NUMBER) \ + AP_SERVER_ADD_STRING + +#define AP_SERVER_MINORREVISION AP_SERVER_MAJORVERSION "." AP_SERVER_MINORVERSION +#define AP_SERVER_BASEREVISION AP_SERVER_MINORREVISION "." AP_SERVER_PATCHLEVEL +#define AP_SERVER_BASEVERSION AP_SERVER_BASEPRODUCT "/" AP_SERVER_BASEREVISION +#define AP_SERVER_VERSION AP_SERVER_BASEVERSION + +#endif diff --git a/rubbos/app/httpd-2.0.64/include/http_config.h b/rubbos/app/httpd-2.0.64/include/http_config.h new file mode 100644 index 00000000..783e44b4 --- /dev/null +++ b/rubbos/app/httpd-2.0.64/include/http_config.h @@ -0,0 +1,1018 @@ +/* Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef APACHE_HTTP_CONFIG_H +#define APACHE_HTTP_CONFIG_H + +#include "apr_hooks.h" +#include "util_cfgtree.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @file http_config.h + * @brief Apache Configuration + */ + +/* + * The central data structures around here... + */ + +/* Command dispatch structures... */ + +/** + * How the directives arguments should be parsed. + * @remark Note that for all of these except RAW_ARGS, the config routine is + * passed a freshly allocated string which can be modified or stored + * or whatever... + */ +enum cmd_how { + RAW_ARGS, /**< cmd_func parses command line itself */ + TAKE1, /**< one argument only */ + TAKE2, /**< two arguments only */ + ITERATE, /**< one argument, occuring multiple times + * (e.g., IndexIgnore) + */ + ITERATE2, /**< two arguments, 2nd occurs multiple times + * (e.g., AddIcon) + */ + FLAG, /**< One of 'On' or 'Off' */ + NO_ARGS, /**< No args at all, e.g. </Directory> */ + TAKE12, /**< one or two arguments */ + TAKE3, /**< three arguments only */ + TAKE23, /**< two or three arguments */ + TAKE123, /**< one, two or three arguments */ + TAKE13 /**< one or three arguments */ +}; +/** + * This structure is passed to a command which is being invoked, + * to carry a large variety of miscellaneous data which is all of + * use to *somebody*... + */ +typedef struct cmd_parms_struct cmd_parms; + +#if defined(AP_HAVE_DESIGNATED_INITIALIZER) || defined(DOXYGEN) + +/** + * All the types of functions that can be used in directives + * @internal + */ +typedef union { + /** function to call for a no-args */ + const char *(*no_args) (cmd_parms *parms, void *mconfig); + /** function to call for a raw-args */ + const char *(*raw_args) (cmd_parms *parms, void *mconfig, + const char *args); + /** function to call for a take1 */ + const char *(*take1) (cmd_parms *parms, void *mconfig, const char *w); + /** function to call for a take2 */ + const char *(*take2) (cmd_parms *parms, void *mconfig, const char *w, + const char *w2); + /** function to call for a take3 */ + const char *(*take3) (cmd_parms *parms, void *mconfig, const char *w, + const char *w2, const char *w3); + /** function to call for a flag */ + const char *(*flag) (cmd_parms *parms, void *mconfig, int on); +} cmd_func; + +/** This configuration directive does not take any arguments */ +# define AP_NO_ARGS func.no_args +/** This configuration directive will handle it's own parsing of arguments*/ +# define AP_RAW_ARGS func.raw_args +/** This configuration directive takes 1 argument*/ +# define AP_TAKE1 func.take1 +/** This configuration directive takes 2 arguments */ +# define AP_TAKE2 func.take2 +/** This configuration directive takes 3 arguments */ +# define AP_TAKE3 func.take3 +/** This configuration directive takes a flag (on/off) as a argument*/ +# define AP_FLAG func.flag + +/** method of declaring a directive with no arguments */ +# define AP_INIT_NO_ARGS(directive, func, mconfig, where, help) \ + { directive, { .no_args=func }, mconfig, where, RAW_ARGS, help } +/** method of declaring a directive with raw argument parsing */ +# define AP_INIT_RAW_ARGS(directive, func, mconfig, where, help) \ + { directive, { .raw_args=func }, mconfig, where, RAW_ARGS, help } +/** method of declaring a directive which takes 1 argument */ +# define AP_INIT_TAKE1(directive, func, mconfig, where, help) \ + { directive, { .take1=func }, mconfig, where, TAKE1, help } +/** method of declaring a directive which takes multiple arguments */ +# define AP_INIT_ITERATE(directive, func, mconfig, where, help) \ + { directive, { .take1=func }, mconfig, where, ITERATE, help } +/** method of declaring a directive which takes 2 arguments */ +# define AP_INIT_TAKE2(directive, func, mconfig, where, help) \ + { directive, { .take2=func }, mconfig, where, TAKE2, help } +/** method of declaring a directive which takes 1 or 2 arguments */ +# define AP_INIT_TAKE12(directive, func, mconfig, where, help) \ + { directive, { .take2=func }, mconfig, where, TAKE12, help } +/** method of declaring a directive which takes multiple 2 arguments */ +# define AP_INIT_ITERATE2(directive, func, mconfig, where, help) \ + { directive, { .take2=func }, mconfig, where, ITERATE2, help } +/** method of declaring a directive which takes 1 or 3 arguments */ +# define AP_INIT_TAKE13(directive, func, mconfig, where, help) \ + { directive, { .take3=func }, mconfig, where, TAKE13, help } +/** method of declaring a directive which takes 2 or 3 arguments */ +# define AP_INIT_TAKE23(directive, func, mconfig, where, help) \ + { directive, { .take3=func }, mconfig, where, TAKE23, help } +/** method of declaring a directive which takes 1 to 3 arguments */ +# define AP_INIT_TAKE123(directive, func, mconfig, where, help) \ + { directive, { .take3=func }, mconfig, where, TAKE123, help } +/** method of declaring a directive which takes 3 arguments */ +# define AP_INIT_TAKE3(directive, func, mconfig, where, help) \ + { directive, { .take3=func }, mconfig, where, TAKE3, help } +/** method of declaring a directive which takes a flag (on/off) as a argument*/ +# define AP_INIT_FLAG(directive, func, mconfig, where, help) \ + { directive, { .flag=func }, mconfig, where, FLAG, help } + +#else /* AP_HAVE_DESIGNATED_INITIALIZER */ + +typedef const char *(*cmd_func) (); + +# define AP_NO_ARGS func +# define AP_RAW_ARGS func +# define AP_TAKE1 func +# define AP_TAKE2 func +# define AP_TAKE3 func +# define AP_FLAG func + +# define AP_INIT_NO_ARGS(directive, func, mconfig, where, help) \ + { directive, func, mconfig, where, RAW_ARGS, help } +# define AP_INIT_RAW_ARGS(directive, func, mconfig, where, help) \ + { directive, func, mconfig, where, RAW_ARGS, help } +# define AP_INIT_TAKE1(directive, func, mconfig, where, help) \ + { directive, func, mconfig, where, TAKE1, help } +# define AP_INIT_ITERATE(directive, func, mconfig, where, help) \ + { directive, func, mconfig, where, ITERATE, help } +# define AP_INIT_TAKE2(directive, func, mconfig, where, help) \ + { directive, func, mconfig, where, TAKE2, help } +# define AP_INIT_TAKE12(directive, func, mconfig, where, help) \ + { directive, func, mconfig, where, TAKE12, help } +# define AP_INIT_ITERATE2(directive, func, mconfig, where, help) \ + { directive, func, mconfig, where, ITERATE2, help } +# define AP_INIT_TAKE13(directive, func, mconfig, where, help) \ + { directive, func, mconfig, where, TAKE13, help } +# define AP_INIT_TAKE23(directive, func, mconfig, where, help) \ + { directive, func, mconfig, where, TAKE23, help } +# define AP_INIT_TAKE123(directive, func, mconfig, where, help) \ + { directive, func, mconfig, where, TAKE123, help } +# define AP_INIT_TAKE3(directive, func, mconfig, where, help) \ + { directive, func, mconfig, where, TAKE3, help } +# define AP_INIT_FLAG(directive, func, mconfig, where, help) \ + { directive, func, mconfig, where, FLAG, help } + +#endif /* AP_HAVE_DESIGNATED_INITIALIZER */ + +/** + * The command record structure. Each modules can define a table of these + * to define the directives it will implement. + */ +typedef struct command_struct command_rec; +struct command_struct { + /** Name of this command */ + const char *name; + /** The function to be called when this directive is parsed */ + cmd_func func; + /** Extra data, for functions which implement multiple commands... */ + void *cmd_data; + /** What overrides need to be allowed to enable this command. */ + int req_override; + /** What the command expects as arguments + * @defvar cmd_how args_how*/ + enum cmd_how args_how; + + /** 'usage' message, in case of syntax errors */ + const char *errmsg; +}; + +/** + * @defgroup ConfigDirectives Allowed locations for configuration directives. + * + * The allowed locations for a configuration directive are the union of + * those indicated by each set bit in the req_override mask. + * + * @{ + */ +#define OR_NONE 0 /**< *.conf is not available anywhere in this override */ +#define OR_LIMIT 1 /**< *.conf inside <Directory> or <Location> + and .htaccess when AllowOverride Limit */ +#define OR_OPTIONS 2 /**< *.conf anywhere + and .htaccess when AllowOverride Options */ +#define OR_FILEINFO 4 /**< *.conf anywhere + and .htaccess when AllowOverride FileInfo */ +#define OR_AUTHCFG 8 /**< *.conf inside <Directory> or <Location> + and .htaccess when AllowOverride AuthConfig */ +#define OR_INDEXES 16 /**< *.conf anywhere + and .htaccess when AllowOverride Indexes */ +#define OR_UNSET 32 /**< unset a directive (in Allow) */ +#define ACCESS_CONF 64 /**< *.conf inside <Directory> or <Location> */ +#define RSRC_CONF 128 /**< *.conf outside <Directory> or <Location> */ +#define EXEC_ON_READ 256 /**< force directive to execute a command + which would modify the configuration (like including another + file, or IFModule */ +/** this directive can be placed anywhere */ +#define OR_ALL (OR_LIMIT|OR_OPTIONS|OR_FILEINFO|OR_AUTHCFG|OR_INDEXES) + +/** @} */ + +/** + * This can be returned by a function if they don't wish to handle + * a command. Make it something not likely someone will actually use + * as an error code. + */ +#define DECLINE_CMD "\a\b" + +/** Common structure for reading of config files / passwd files etc. */ +typedef struct ap_configfile_t ap_configfile_t; +struct ap_configfile_t { + int (*getch) (void *param); /**< a getc()-like function */ + void *(*getstr) (void *buf, size_t bufsiz, void *param); + /**< a fgets()-like function */ + int (*close) (void *param); /**< a close handler function */ + void *param; /**< the argument passed to getch/getstr/close */ + const char *name; /**< the filename / description */ + unsigned line_number; /**< current line number, starting at 1 */ +}; + +/** + * This structure is passed to a command which is being invoked, + * to carry a large variety of miscellaneous data which is all of + * use to *somebody*... + */ +struct cmd_parms_struct { + /** Argument to command from cmd_table */ + void *info; + /** Which allow-override bits are set */ + int override; + /** Which methods are <Limit>ed */ + apr_int64_t limited; + /** methods which are limited */ + apr_array_header_t *limited_xmethods; + /** methods which are xlimited */ + ap_method_list_t *xlimited; + + /** Config file structure. */ + ap_configfile_t *config_file; + /** the directive specifying this command */ + ap_directive_t *directive; + + /** Pool to allocate new storage in */ + apr_pool_t *pool; + /** Pool for scratch memory; persists during configuration, but + * wiped before the first request is served... */ + apr_pool_t *temp_pool; + /** Server_rec being configured for */ + server_rec *server; + /** If configuring for a directory, pathname of that directory. + * NOPE! That's what it meant previous to the existance of <Files>, + * <Location> and regex matching. Now the only usefulness that can be + * derived from this field is whether a command is being called in a + * server context (path == NULL) or being called in a dir context + * (path != NULL). */ + char *path; + /** configuration command */ + const command_rec *cmd; + + /** per_dir_config vector passed to handle_command */ + struct ap_conf_vector_t *context; + /** directive with syntax error */ + const ap_directive_t *err_directive; +}; + +/** + * Module structures. Just about everything is dispatched through + * these, directly or indirectly (through the command and handler + * tables). + */ +typedef struct module_struct module; +struct module_struct { + /** API version, *not* module version; check that module is + * compatible with this version of the server. + */ + int version; + /** API minor version. Provides API feature milestones. Not checked + * during module init */ + int minor_version; + /** Index to this modules structures in config vectors. */ + int module_index; + + /** The name of the module's C file */ + const char *name; + /** The handle for the DSO. Internal use only */ + void *dynamic_load_handle; + + /** A pointer to the next module in the list + * @defvar module_struct *next */ + struct module_struct *next; + + /** Magic Cookie to identify a module structure; It's mainly + * important for the DSO facility (see also mod_so). */ + unsigned long magic; + + /** Function to allow MPMs to re-write command line arguments. This + * hook is only available to MPMs. + * @param The process that the server is running in. + */ + void (*rewrite_args) (process_rec *process); + /** Function to allow all modules to create per directory configuration + * structures. + * @param p The pool to use for all allocations. + * @param dir The directory currently being processed. + * @return The per-directory structure created + */ + void *(*create_dir_config) (apr_pool_t *p, char *dir); + /** Function to allow all modules to merge the per directory configuration + * structures for two directories. + * @param p The pool to use for all allocations. + * @param base_conf The directory structure created for the parent directory. + * @param new_conf The directory structure currently being processed. + * @return The new per-directory structure created + */ + void *(*merge_dir_config) (apr_pool_t *p, void *base_conf, void *new_conf); + /** Function to allow all modules to create per server configuration + * structures. + * @param p The pool to use for all allocations. + * @param s The server currently being processed. + * @return The per-server structure created + */ + void *(*create_server_config) (apr_pool_t *p, server_rec *s); + /** Function to allow all modules to merge the per server configuration + * structures for two servers. + * @param p The pool to use for all allocations. + * @param base_conf The directory structure created for the parent directory. + * @param new_conf The directory structure currently being processed. + * @return The new per-directory structure created + */ + void *(*merge_server_config) (apr_pool_t *p, void *base_conf, + void *new_conf); + + /** A command_rec table that describes all of the directives this module + * defines. */ + const command_rec *cmds; + + /** A hook to allow modules to hook other points in the request processing. + * In this function, modules should call the ap_hook_*() functions to + * register an interest in a specific step in processing the current + * request. + * @param p the pool to use for all allocations + */ + void (*register_hooks) (apr_pool_t *p); +}; + +/** + * @defgroup ModuleInit Module structure initializers + * + * Initializer for the first few module slots, which are only + * really set up once we start running. Note that the first two slots + * provide a version check; this should allow us to deal with changes to + * the API. The major number should reflect changes to the API handler table + * itself or removal of functionality. The minor number should reflect + * additions of functionality to the existing API. (the server can detect + * an old-format module, and either handle it back-compatibly, or at least + * signal an error). See src/include/ap_mmn.h for MMN version history. + * @{ + */ + +/** The one used in Apache 1.3, which will deliberately cause an error */ +#define STANDARD_MODULE_STUFF this_module_needs_to_be_ported_to_apache_2_0 + +/** Use this in all standard modules */ +#define STANDARD20_MODULE_STUFF MODULE_MAGIC_NUMBER_MAJOR, \ + MODULE_MAGIC_NUMBER_MINOR, \ + -1, \ + __FILE__, \ + NULL, \ + NULL, \ + MODULE_MAGIC_COOKIE, \ + NULL /* rewrite args spot */ + +/** Use this only in MPMs */ +#define MPM20_MODULE_STUFF MODULE_MAGIC_NUMBER_MAJOR, \ + MODULE_MAGIC_NUMBER_MINOR, \ + -1, \ + __FILE__, \ + NULL, \ + NULL, \ + MODULE_MAGIC_COOKIE + +/** @} */ + +/* CONFIGURATION VECTOR FUNCTIONS */ + +/** configuration vector structure */ +typedef struct ap_conf_vector_t ap_conf_vector_t; + +/** + * Generic accessors for other modules to get at their own module-specific + * data + * @param conf_vector The vector in which the modules configuration is stored. + * usually r->per_dir_config or s->module_config + * @param m The module to get the data for. + * @return The module-specific data + */ +AP_DECLARE(void *) ap_get_module_config(const ap_conf_vector_t *cv, + const module *m); + +/** + * Generic accessors for other modules to set at their own module-specific + * data + * @param conf_vector The vector in which the modules configuration is stored. + * usually r->per_dir_config or s->module_config + * @param m The module to set the data for. + * @param val The module-specific data to set + */ +AP_DECLARE(void) ap_set_module_config(ap_conf_vector_t *cv, const module *m, + void *val); + +#if !defined(AP_DEBUG) + +#define ap_get_module_config(v,m) \ + (((void **)(v))[(m)->module_index]) +#define ap_set_module_config(v,m,val) \ + ((((void **)(v))[(m)->module_index]) = (val)) + +#endif /* AP_DEBUG */ + + +/** + * Generic command handling function for strings + * @param cmd The command parameters for this directive + * @param struct_ptr pointer into a given type + * @param arg The argument to the directive + * @return An error string or NULL on success + */ +AP_DECLARE_NONSTD(const char *) ap_set_string_slot(cmd_parms *cmd, + void *struct_ptr, + const char *arg); + +/** + * Generic command handling function for integers + * @param cmd The command parameters for this directive + * @param struct_ptr pointer into a given type + * @param arg The argument to the directive + * @return An error string or NULL on success + */ +AP_DECLARE_NONSTD(const char *) ap_set_int_slot(cmd_parms *cmd, + void *struct_ptr, + const char *arg); + +/** + * Return true if the specified method is limited by being listed in + * a <Limit> container, or by *not* being listed in a <LimiteExcept> + * container. + * + * @param method Pointer to a string specifying the method to check. + * @param cmd Pointer to the cmd_parms structure passed to the + * directive handler. + * @return 0 if the method is not limited in the current scope + */ +AP_DECLARE(int) ap_method_is_limited(cmd_parms *cmd, const char *method); + +/** + * Generic command handling function for strings, always sets the value + * to a lowercase string + * @param cmd The command parameters for this directive + * @param struct_ptr pointer into a given type + * @param arg The argument to the directive + * @return An error string or NULL on success + */ +AP_DECLARE_NONSTD(const char *) ap_set_string_slot_lower(cmd_parms *cmd, + void *struct_ptr, + const char *arg); +/** + * Generic command handling function for flags + * @param cmd The command parameters for this directive + * @param struct_ptr pointer into a given type + * @param arg The argument to the directive (either 1 or 0) + * @return An error string or NULL on success + */ +AP_DECLARE_NONSTD(const char *) ap_set_flag_slot(cmd_parms *cmd, + void *struct_ptr, + int arg); +/** + * Generic command handling function for files + * @param cmd The command parameters for this directive + * @param struct_ptr pointer into a given type + * @param arg The argument to the directive + * @return An error string or NULL on success + */ +AP_DECLARE_NONSTD(const char *) ap_set_file_slot(cmd_parms *cmd, + void *struct_ptr, + const char *arg); +/** + * Generic command handling function to respond with cmd->help as an error + * @param cmd The command parameters for this directive + * @param struct_ptr pointer into a given type + * @param arg The argument to the directive + * @return The cmd->help value as the error string + * @tip This allows simple declarations such as; + * <pre> + * AP_INIT_RAW_ARGS("Foo", ap_set_deprecated, NULL, OR_ALL, + * "The Foo directive is no longer supported, use Bar"), + * </pre> + */ +AP_DECLARE_NONSTD(const char *) ap_set_deprecated(cmd_parms *cmd, + void *struct_ptr, + const char *arg); +/** + * For modules which need to read config files, open logs, etc. this returns + * the canonical form of fname made absolute to ap_server_root. + * @param p pool to allocate data from + * @param fname The file name + */ +AP_DECLARE(char *) ap_server_root_relative(apr_pool_t *p, const char *fname); + +/* Finally, the hook for dynamically loading modules in... */ + +/** + * Add a module to the server + * @param m The module structure of the module to add + * @param p The pool of the same lifetime as the module + */ +AP_DECLARE(void) ap_add_module(module *m, apr_pool_t *p); + +/** + * Remove a module from the server. There are some caveats: + * when the module is removed, its slot is lost so all the current + * per-dir and per-server configurations are invalid. So we should + * only ever call this function when you are invalidating almost + * all our current data. I.e. when doing a restart. + * @param m the module structure of the module to remove + */ +AP_DECLARE(void) ap_remove_module(module *m); +/** + * Add a module to the chained modules list and the list of loaded modules + * @param m The module structure of the module to add + * @param p The pool with the same lifetime as the module + */ +AP_DECLARE(void) ap_add_loaded_module(module *mod, apr_pool_t *p); +/** + * Remove a module fromthe chained modules list and the list of loaded modules + * @param m the module structure of the module to remove + */ +AP_DECLARE(void) ap_remove_loaded_module(module *mod); +/** + * Add a module to the list of loaded module based on the name of the + * module + * @param name The name of the module + * @param p The pool valid for the lifetime of the module + * @return 1 on success, 0 on failure + */ +AP_DECLARE(int) ap_add_named_module(const char *name, apr_pool_t *p); +/** + * Find the name of the specified module + * @param m The module to get the name for + * @return the name of the module + */ +AP_DECLARE(const char *) ap_find_module_name(module *m); +/** + * Find a module based on the name of the module + * @param name the name of the module + * @return the module structure if found, NULL otherwise + */ +AP_DECLARE(module *) ap_find_linked_module(const char *name); + +/** + * Open a ap_configfile_t as apr_file_t + * @param ret_cfg open ap_configfile_t struct pointer + * @param p The pool to allocate the structure from + * @param name the name of the file to open + */ +AP_DECLARE(apr_status_t) ap_pcfg_openfile(ap_configfile_t **ret_cfg, + apr_pool_t *p, const char *name); + +/** + * Allocate a ap_configfile_t handle with user defined functions and params + * @param p The pool to allocate from + * @param descr The name of the file + * @param param The argument passed to getch/getstr/close + * @param getc_func The getch function + * @param gets_func The getstr function + * @param close_func The close function + */ +AP_DECLARE(ap_configfile_t *) ap_pcfg_open_custom(apr_pool_t *p, + const char *descr, + void *param, + int(*getc_func)(void*), + void *(*gets_func) (void *buf, size_t bufsiz, void *param), + int(*close_func)(void *param)); + +/** + * Read one line from open ap_configfile_t, strip LF, increase line number + * @param buf place to store the line read + * @param bufsize size of the buffer + * @param cfp File to read from + * @return 1 on success, 0 on failure + */ +AP_DECLARE(int) ap_cfg_getline(char *buf, size_t bufsize, ap_configfile_t *cfp); + +/** + * Read one char from open configfile_t, increase line number upon LF + * @param cfp The file to read from + * @return the character read + */ +AP_DECLARE(int) ap_cfg_getc(ap_configfile_t *cfp); + +/** + * Detach from open ap_configfile_t, calling the close handler + * @param cfp The file to close + * @return 1 on sucess, 0 on failure + */ +AP_DECLARE(int) ap_cfg_closefile(ap_configfile_t *cfp); + +/** + * Read all data between the current <foo> and the matching </foo>. All + * of this data is forgotten immediately. + * @param cmd The cmd_parms to pass to the directives inside the container + * @param directive The directive name to read until + * @return Error string on failure, NULL on success + */ +AP_DECLARE(const char *) ap_soak_end_container(cmd_parms *cmd, char *directive); + +/** + * Read all data between the current <foo> and the matching </foo> and build + * a config tree from it + * @param p pool to allocate from + * @param temp_pool Temporary pool to allocate from + * @param parms The cmd_parms to pass to all directives read + * @param current The current node in the tree + * @param curr_parent The current parent node + * @param orig_directive The directive to read until hit. + * @return Error string on failure, NULL on success +*/ +AP_DECLARE(const char *) ap_build_cont_config(apr_pool_t *p, + apr_pool_t *temp_pool, + cmd_parms *parms, + ap_directive_t **current, + ap_directive_t **curr_parent, + char *orig_directive); + +/** + * Build a config tree from a config file + * @param parms The cmd_parms to pass to all of the directives in the file + * @param conf_pool The pconf pool + * @param temp_pool The temporary pool + * @param conftree Place to store the root node of the config tree + * @return Error string on erro, NULL otherwise + */ +AP_DECLARE(const char *) ap_build_config(cmd_parms *parms, + apr_pool_t *conf_pool, + apr_pool_t *temp_pool, + ap_directive_t **conftree); + +/** + * Walk a config tree and setup the server's internal structures + * @param conftree The config tree to walk + * @param parms The cmd_parms to pass to all functions + * @param section_vector The per-section config vector. + * @return Error string on error, NULL otherwise + */ +AP_DECLARE(const char *) ap_walk_config(ap_directive_t *conftree, + cmd_parms *parms, + ap_conf_vector_t *section_vector); + +/** + * @defgroup ap_check_cmd_context ap_check_cmd_context + * @{ + */ +/** + * Check the context a command is used in. + * @param cmd The command to check + * @param forbidden Where the command is forbidden. + * @return Error string on error, NULL on success + */ +AP_DECLARE(const char *) ap_check_cmd_context(cmd_parms *cmd, + unsigned forbidden); + +#define NOT_IN_VIRTUALHOST 0x01 /**< Forbidden in <Virtualhost> */ +#define NOT_IN_LIMIT 0x02 /**< Forbidden in <Limit> */ +#define NOT_IN_DIRECTORY 0x04 /**< Forbidden in <Directory> */ +#define NOT_IN_LOCATION 0x08 /**< Forbidden in <Location> */ +#define NOT_IN_FILES 0x10 /**< Forbidden in <Files> */ +/** Forbidden in <Directory>/<Location>/<Files>*/ +#define NOT_IN_DIR_LOC_FILE (NOT_IN_DIRECTORY|NOT_IN_LOCATION|NOT_IN_FILES) +/** Forbidden in <VirtualHost>/<Limit>/<Directory>/<Location>/<Files> */ +#define GLOBAL_ONLY (NOT_IN_VIRTUALHOST|NOT_IN_LIMIT|NOT_IN_DIR_LOC_FILE) + +/** @} */ + +#ifdef CORE_PRIVATE + +/** + * The topmost module in the list + * @defvar module *ap_top_module + */ +AP_DECLARE_DATA extern module *ap_top_module; + +/** + * Array of all statically linked modules + * @defvar module *ap_prelinked_modules[] + */ +AP_DECLARE_DATA extern module *ap_prelinked_modules[]; +/** + * Array of all preloaded modules + * @defvar module *ap_preloaded_modules[] + */ +AP_DECLARE_DATA extern module *ap_preloaded_modules[]; +/** + * Array of all loaded modules + * @defvar module **ap_loaded_modules + */ +AP_DECLARE_DATA extern module **ap_loaded_modules; + +/* For mod_so.c... */ +/** Run a single module's two create_config hooks + * @param p the pool to allocate from + * @param s The server to configure for. + * @param m The module to configure + */ +AP_DECLARE(void) ap_single_module_configure(apr_pool_t *p, server_rec *s, + module *m); + +/* For http_main.c... */ +/** + * Add all of the prelinked modules into the loaded module list + * @param process The process that is currently running the server + */ +AP_DECLARE(void) ap_setup_prelinked_modules(process_rec *process); + +/** + * Show the preloaded configuration directives, the help string explaining + * the directive arguments, in what module they are handled, and in + * what parts of the configuration they are allowed. Used for httpd -h. + */ +AP_DECLARE(void) ap_show_directives(void); + +/** + * Show the preloaded module names. Used for httpd -l. + */ +AP_DECLARE(void) ap_show_modules(void); + +/** + * Show the MPM name. Used in reporting modules such as mod_info to + * provide extra information to the user + */ +AP_DECLARE(const char *) ap_show_mpm(void); + +/** + * Read all config files and setup the server + * @param process The process running the server + * @param temp_pool A pool to allocate temporary data from. + * @param config_name The name of the config file + * @param conftree Place to store the root of the config tree + * @return The setup server_rec list. + */ +AP_DECLARE(server_rec *) ap_read_config(process_rec *process, + apr_pool_t *temp_pool, + const char *config_name, + ap_directive_t **conftree); + +/** + * Run all rewrite args hooks for loaded modules + * @param process The process currently running the server + */ +AP_DECLARE(void) ap_run_rewrite_args(process_rec *process); + +/** + * Run the register hooks function for a specified module + * @param m The module to run the register hooks function fo + * @param p The pool valid for the lifetime of the module + */ +AP_DECLARE(void) ap_register_hooks(module *m, apr_pool_t *p); + +/** + * Setup all virtual hosts + * @param p The pool to allocate from + * @param main_server The head of the server_rec list + */ +AP_DECLARE(void) ap_fixup_virtual_hosts(apr_pool_t *p, + server_rec *main_server); + +/* For http_request.c... */ + +/** + * Setup the config vector for a request_rec + * @param p The pool to allocate the config vector from + * @return The config vector + */ +AP_CORE_DECLARE(ap_conf_vector_t*) ap_create_request_config(apr_pool_t *p); + +/** + * Setup the config vector for per dir module configs + * @param p The pool to allocate the config vector from + * @return The config vector + */ +AP_CORE_DECLARE(ap_conf_vector_t *) ap_create_per_dir_config(apr_pool_t *p); + +/** + * Run all of the modules merge per dir config functions + * @param p The pool to pass to the merge functions + * @param base The base directory config structure + * @param new_conf The new directory config structure + */ +AP_CORE_DECLARE(ap_conf_vector_t*) ap_merge_per_dir_configs(apr_pool_t *p, + ap_conf_vector_t *base, + ap_conf_vector_t *new_conf); + +/* For http_connection.c... */ +/** + * Setup the config vector for a connection_rec + * @param p The pool to allocate the config vector from + * @return The config vector + */ +AP_CORE_DECLARE(ap_conf_vector_t*) ap_create_conn_config(apr_pool_t *p); + +/* For http_core.c... (<Directory> command and virtual hosts) */ + +/** + * parse an htaccess file + * @param resulting htaccess_result + * @param r The request currently being served + * @param override Which overrides are active + * @param path The path to the htaccess file + * @param access_name The list of possible names for .htaccess files + * int The status of the current request + */ +AP_CORE_DECLARE(int) ap_parse_htaccess(ap_conf_vector_t **result, + request_rec *r, int override, + const char *path, + const char *access_name); + +/** + * Setup a virtual host + * @param p The pool to allocate all memory from + * @param hostname The hostname of the virtual hsot + * @param main_server The main server for this Apache configuration + * @param ps Place to store the new server_rec + * return Error string on error, NULL on success + */ +AP_CORE_DECLARE(const char *) ap_init_virtual_host(apr_pool_t *p, + const char *hostname, + server_rec *main_server, + server_rec **); + +/** + * Process the config file for Apache + * @param s The server rec to use for the command parms + * @param fname The name of the config file + * @param conftree The root node of the created config tree + * @param p Pool for general allocation + * @param ptem Pool for temporary allocation + */ +AP_DECLARE(void) ap_process_resource_config(server_rec *s, const char *fname, + ap_directive_t **conftree, + apr_pool_t *p, apr_pool_t *ptemp); + +/** + * Process all directives in the config tree + * @param s The server rec to use in the command parms + * @param conftree The config tree to process + * @param p The pool for general allocation + * @param ptemp The pool for temporary allocations + */ +AP_DECLARE(void) ap_process_config_tree(server_rec *s, ap_directive_t *conftree, + apr_pool_t *p, apr_pool_t *ptemp); + +/* Module-method dispatchers, also for http_request.c */ +/** + * Run the handler phase of each module until a module accepts the + * responsibility of serving the request + * @param r The current request + * @return The status of the current request + */ +AP_CORE_DECLARE(int) ap_invoke_handler(request_rec *r); + +/* for mod_perl */ + +/** + * Find a given directive in a command_rec table + * @param name The directive to search for + * @param cmds The table to search + * @return The directive definition of the specified directive + */ +AP_CORE_DECLARE(const command_rec *) ap_find_command(const char *name, + const command_rec *cmds); + +/** + * Find a given directive in a list module + * @param cmd_name The directive to search for + * @param mod The module list to search + * @return The directive definition of the specified directive + */ +AP_CORE_DECLARE(const command_rec *) ap_find_command_in_modules(const char *cmd_name, + module **mod); + +/** + * Ask a module to create per-server and per-section (dir/loc/file) configs + * (if it hasn't happened already). The results are stored in the server's + * config, and the specified per-section config vector. + * @param server The server to operate upon. + * @param section_vector The per-section config vector. + * @param section Which section to create a config for. + * @param mod The module which is defining the config data. + * @param pconf A pool for all configuration allocations. + * @return The (new) per-section config data. + */ +AP_CORE_DECLARE(void *) ap_set_config_vectors(server_rec *server, + ap_conf_vector_t *section_vector, + const char *section, + module *mod, apr_pool_t *pconf); + +#endif + + /* Hooks */ + +/** + * Run the header parser functions for each module + * @param r The current request + * @return OK or DECLINED + */ +AP_DECLARE_HOOK(int,header_parser,(request_rec *r)) + +/** + * Run the pre_config function for each module + * @param pconf The config pool + * @param plog The logging streams pool + * @param ptemp The temporary pool + * @return OK or DECLINED on success anything else is a error + */ +AP_DECLARE_HOOK(int,pre_config,(apr_pool_t *pconf,apr_pool_t *plog, + apr_pool_t *ptemp)) + + +/** + * Run the post_config function for each module + * @param pconf The config pool + * @param plog The logging streams pool + * @param ptemp The temporary pool + * @param s The list of server_recs + * @return OK or DECLINED on success anything else is a error + */ +AP_DECLARE_HOOK(int,post_config,(apr_pool_t *pconf,apr_pool_t *plog, + apr_pool_t *ptemp,server_rec *s)) + +/** + * Run the open_logs functions for each module + * @param pconf The config pool + * @param plog The logging streams pool + * @param ptemp The temporary pool + * @param s The list of server_recs + * @return OK or DECLINED on success anything else is a error + */ +AP_DECLARE_HOOK(int,open_logs,(apr_pool_t *pconf,apr_pool_t *plog, + apr_pool_t *ptemp,server_rec *s)) + +/** + * Run the child_init functions for each module + * @param pchild The child pool + * @param s The list of server_recs in this server + */ +AP_DECLARE_HOOK(void,child_init,(apr_pool_t *pchild, server_rec *s)) + +/** + * Run the handler functions for each module + * @param r The request_rec + * @remark non-wildcard handlers should HOOK_MIDDLE, wildcard HOOK_LAST + */ +AP_DECLARE_HOOK(int,handler,(request_rec *r)) + +/** + * Run the quick handler functions for each module. The quick_handler + * is run before any other requests hooks are called (location_walk, + * directory_walk, access checking, et. al.). This hook was added + * to provide a quick way to serve content from a URI keyed cache. + * + * @param r The request_rec + * @param lookup_uri Controls whether the caller actually wants content or not. + * lookup is set when the quick_handler is called out of + * ap_sub_req_lookup_uri() + */ +AP_DECLARE_HOOK(int,quick_handler,(request_rec *r, int lookup_uri)) + +/** + * Retrieve the optional functions for each module. + * This is run immediately before the server starts. Optional functions should + * be registered during the hook registration phase. + */ +AP_DECLARE_HOOK(void,optional_fn_retrieve,(void)) + +#ifdef __cplusplus +} +#endif + +#endif /* !APACHE_HTTP_CONFIG_H */ diff --git a/rubbos/app/httpd-2.0.64/include/http_connection.h b/rubbos/app/httpd-2.0.64/include/http_connection.h new file mode 100644 index 00000000..2b7d379f --- /dev/null +++ b/rubbos/app/httpd-2.0.64/include/http_connection.h @@ -0,0 +1,139 @@ +/* Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef APACHE_HTTP_CONNECTION_H +#define APACHE_HTTP_CONNECTION_H + +#include "apr_hooks.h" +#include "apr_network_io.h" +#include "apr_buckets.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @package Apache connection library + */ +#ifdef CORE_PRIVATE +/** + * This is the protocol module driver. This calls all of the + * pre-connection and connection hooks for all protocol modules. + * @param c The connection on which the request is read + * @param csd The mechanism on which this connection is to be read. + * Most times this will be a socket, but it is up to the module + * that accepts the request to determine the exact type. + * @deffunc void ap_process_connection(conn_rec *c, void *csd) + */ +AP_CORE_DECLARE(void) ap_process_connection(conn_rec *c, void *csd); + +AP_CORE_DECLARE(void) ap_flush_conn(conn_rec *c); + +/** + * This function is responsible for the following cases: + * <pre> + * we now proceed to read from the client until we get EOF, or until + * MAX_SECS_TO_LINGER has passed. the reasons for doing this are + * documented in a draft: + * + * http://www.ics.uci.edu/pub/ietf/http/draft-ietf-http-connection-00.txt + * + * in a nutshell -- if we don't make this effort we risk causing + * TCP RST packets to be sent which can tear down a connection before + * all the response data has been sent to the client. + * </pre> + * @param c The connection we are closing + */ +AP_DECLARE(void) ap_lingering_close(conn_rec *c); +#endif + + /* Hooks */ +/** + * create_connection is a RUN_FIRST hook which allows modules to create + * connections. In general, you should not install filters with the + * create_connection hook. If you require vhost configuration information + * to make filter installation decisions, you must use the pre_connection + * or install_network_transport hook. This hook should close the connection + * if it encounters a fatal error condition. + * + * @param p The pool from which to allocate the connection record + * @param csd The socket that has been accepted + * @param conn_id A unique identifier for this connection. The ID only + * needs to be unique at that time, not forever. + * @param sbh A handle to scoreboard information for this connection. + * @return An allocated connection record or NULL. + */ +AP_DECLARE_HOOK(conn_rec *, create_connection, + (apr_pool_t *p, server_rec *server, apr_socket_t *csd, + long conn_id, void *sbh, apr_bucket_alloc_t *alloc)) + +/** + * This hook gives protocol modules an opportunity to set everything up + * before calling the protocol handler. All pre-connection hooks are + * run until one returns something other than ok or decline + * @param c The connection on which the request has been received. + * @param csd The mechanism on which this connection is to be read. + * Most times this will be a socket, but it is up to the module + * that accepts the request to determine the exact type. + * @return OK or DECLINED + * @deffunc int ap_run_pre_connection(conn_rec *c, void *csd) + */ +AP_DECLARE_HOOK(int,pre_connection,(conn_rec *c, void *csd)) + +/** + * This hook implements different protocols. After a connection has been + * established, the protocol module must read and serve the request. This + * function does that for each protocol module. The first protocol module + * to handle the request is the last module run. + * @param c The connection on which the request has been received. + * @return OK or DECLINED + * @deffunc int ap_run_process_connection(conn_rec *c) + */ +AP_DECLARE_HOOK(int,process_connection,(conn_rec *c)) + +/* End Of Connection (EOC) bucket */ + +AP_DECLARE_DATA extern const apr_bucket_type_t ap_bucket_type_eoc; + +/** + * Determine if a bucket is an End Of Connection (EOC) bucket + * @param e The bucket to inspect + * @return true or false + */ +#define AP_BUCKET_IS_EOC(e) (e->type == &ap_bucket_type_eoc) + +/** + * Make the bucket passed in an End Of Connection (EOC) bucket + * @param b The bucket to make into an EOC bucket + * @return The new bucket, or NULL if allocation failed + * @deffunc apr_bucket *ap_bucket_eoc_make(apr_bucket *b) + */ +AP_DECLARE(apr_bucket *) ap_bucket_eoc_make(apr_bucket *b); + +/** + * Create a bucket referring to an End Of Connection (EOC). This indicates + * that the connection will be closed. + * @param list The freelist from which this bucket should be allocated + * @return The new bucket, or NULL if allocation failed + * @deffunc apr_bucket *ap_bucket_eoc_create(apr_bucket_alloc_t *list) + */ +AP_DECLARE(apr_bucket *) ap_bucket_eoc_create(apr_bucket_alloc_t *list); + +#ifdef __cplusplus +} +#endif + +#endif /* !APACHE_HTTP_REQUEST_H */ diff --git a/rubbos/app/httpd-2.0.64/include/http_core.h b/rubbos/app/httpd-2.0.64/include/http_core.h new file mode 100644 index 00000000..99b17a90 --- /dev/null +++ b/rubbos/app/httpd-2.0.64/include/http_core.h @@ -0,0 +1,640 @@ +/* Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef APACHE_HTTP_CORE_H +#define APACHE_HTTP_CORE_H + +#include "apr.h" +#include "apr_hash.h" +#include "apr_optional.h" +#include "util_filter.h" + +#if APR_HAVE_STRUCT_RLIMIT +#include <sys/time.h> +#include <sys/resource.h> +#endif + + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @package CORE HTTP Daemon + */ + +/* **************************************************************** + * + * The most basic server code is encapsulated in a single module + * known as the core, which is just *barely* functional enough to + * serve documents, though not terribly well. + * + * Largely for NCSA back-compatibility reasons, the core needs to + * make pieces of its config structures available to other modules. + * The accessors are declared here, along with the interpretation + * of one of them (allow_options). + */ + +#define OPT_NONE 0 +#define OPT_INDEXES 1 +#define OPT_INCLUDES 2 +#define OPT_SYM_LINKS 4 +#define OPT_EXECCGI 8 +#define OPT_UNSET 16 +#define OPT_INCNOEXEC 32 +#define OPT_SYM_OWNER 64 +#define OPT_MULTI 128 +#define OPT_ALL (OPT_INDEXES|OPT_INCLUDES|OPT_SYM_LINKS|OPT_EXECCGI) + +/* options for get_remote_host() */ +/* REMOTE_HOST returns the hostname, or NULL if the hostname + * lookup fails. It will force a DNS lookup according to the + * HostnameLookups setting. + */ +#define REMOTE_HOST (0) + +/* REMOTE_NAME returns the hostname, or the dotted quad if the + * hostname lookup fails. It will force a DNS lookup according + * to the HostnameLookups setting. + */ +#define REMOTE_NAME (1) + +/* REMOTE_NOLOOKUP is like REMOTE_NAME except that a DNS lookup is + * never forced. + */ +#define REMOTE_NOLOOKUP (2) + +/* REMOTE_DOUBLE_REV will always force a DNS lookup, and also force + * a double reverse lookup, regardless of the HostnameLookups + * setting. The result is the (double reverse checked) hostname, + * or NULL if any of the lookups fail. + */ +#define REMOTE_DOUBLE_REV (3) + +#define SATISFY_ALL 0 +#define SATISFY_ANY 1 +#define SATISFY_NOSPEC 2 + +/* Make sure we don't write less than 8000 bytes at any one time. + */ +#define AP_MIN_BYTES_TO_WRITE 8000 + +/* default maximum of internal redirects */ +# define AP_DEFAULT_MAX_INTERNAL_REDIRECTS 10 + +/* default maximum subrequest nesting level */ +# define AP_DEFAULT_MAX_SUBREQ_DEPTH 10 + +/** + * Retrieve the value of Options for this request + * @param r The current request + * @return the Options bitmask + * @deffunc int ap_allow_options(request_rec *r) + */ +AP_DECLARE(int) ap_allow_options(request_rec *r); + +/** + * Retrieve the value of the AllowOverride for this request + * @param r The current request + * @return the overrides bitmask + * @deffunc int ap_allow_overrides(request_rec *r) + */ +AP_DECLARE(int) ap_allow_overrides(request_rec *r); + +/** + * Retrieve the value of the DefaultType directive, or text/plain if not set + * @param r The current request + * @return The default type + * @deffunc const char *ap_default_type(request_rec *r) + */ +AP_DECLARE(const char *) ap_default_type(request_rec *r); + +/** + * Retrieve the document root for this server + * @param r The current request + * @warning Don't use this! If your request went through a Userdir, or + * something like that, it'll screw you. But it's back-compatible... + * @return The document root + * @deffunc const char *ap_document_root(request_rec *r) + */ +AP_DECLARE(const char *) ap_document_root(request_rec *r); + +/** + * Lookup the remote client's DNS name or IP address + * @param conn The current connection + * @param dir_config The directory config vector from the request + * @param type The type of lookup to perform. One of: + * <pre> + * REMOTE_HOST returns the hostname, or NULL if the hostname + * lookup fails. It will force a DNS lookup according to the + * HostnameLookups setting. + * REMOTE_NAME returns the hostname, or the dotted quad if the + * hostname lookup fails. It will force a DNS lookup according + * to the HostnameLookups setting. + * REMOTE_NOLOOKUP is like REMOTE_NAME except that a DNS lookup is + * never forced. + * REMOTE_DOUBLE_REV will always force a DNS lookup, and also force + * a double reverse lookup, regardless of the HostnameLookups + * setting. The result is the (double reverse checked) + * hostname, or NULL if any of the lookups fail. + * </pre> + * @param str_is_ip unless NULL is passed, this will be set to non-zero on output when an IP address + * string is returned + * @return The remote hostname + * @deffunc const char *ap_get_remote_host(conn_rec *conn, void *dir_config, int type, int *str_is_ip) + */ +AP_DECLARE(const char *) ap_get_remote_host(conn_rec *conn, void *dir_config, int type, int *str_is_ip); + +/** + * Retrieve the login name of the remote user. Undef if it could not be + * determined + * @param r The current request + * @return The user logged in to the client machine + * @deffunc const char *ap_get_remote_logname(request_rec *r) + */ +AP_DECLARE(const char *) ap_get_remote_logname(request_rec *r); + +/* Used for constructing self-referencing URLs, and things like SERVER_PORT, + * and SERVER_NAME. + */ +/** + * build a fully qualified URL from the uri and information in the request rec + * @param p The pool to allocate the URL from + * @param uri The path to the requested file + * @param r The current request + * @return A fully qualified URL + * @deffunc char *ap_construct_url(apr_pool_t *p, const char *uri, request_rec *r) + */ +AP_DECLARE(char *) ap_construct_url(apr_pool_t *p, const char *uri, request_rec *r); + +/** + * Get the current server name from the request + * @param r The current request + * @return the server name + * @deffunc const char *ap_get_server_name(request_rec *r) + */ +AP_DECLARE(const char *) ap_get_server_name(request_rec *r); + +/** + * Get the current server port + * @param The current request + * @return The server's port + * @deffunc apr_port_t ap_get_server_port(const request_rec *r) + */ +AP_DECLARE(apr_port_t) ap_get_server_port(const request_rec *r); + +/** + * Return the limit on bytes in request msg body + * @param r The current request + * @return the maximum number of bytes in the request msg body + * @deffunc apr_off_t ap_get_limit_req_body(const request_rec *r) + */ +AP_DECLARE(apr_off_t) ap_get_limit_req_body(const request_rec *r); + +/** + * Return the limit on bytes in XML request msg body + * @param r The current request + * @return the maximum number of bytes in XML request msg body + * @deffunc size_t ap_get_limit_xml_body(const request_rec *r) + */ +AP_DECLARE(size_t) ap_get_limit_xml_body(const request_rec *r); + +/** + * Install a custom response handler for a given status + * @param r The current request + * @param status The status for which the custom response should be used + * @param string The custom response. This can be a static string, a file + * or a URL + */ +AP_DECLARE(void) ap_custom_response(request_rec *r, int status, const char *string); + +/** + * Check if the current request is beyond the configured max. number of redirects or subrequests + * @param r The current request + * @return true (is exceeded) or false + * @deffunc int ap_is_recursion_limit_exceeded(const request_rec *r) + */ +AP_DECLARE(int) ap_is_recursion_limit_exceeded(const request_rec *r); + +/** + * Check for a definition from the server command line + * @param name The define to check for + * @return 1 if defined, 0 otherwise + * @deffunc int ap_exists_config_define(const char *name) + */ +AP_DECLARE(int) ap_exists_config_define(const char *name); +/* FIXME! See STATUS about how */ +AP_DECLARE_NONSTD(int) ap_core_translate(request_rec *r); + +/* Authentication stuff. This is one of the places where compatibility + * with the old config files *really* hurts; they don't discriminate at + * all between different authentication schemes, meaning that we need + * to maintain common state for all of them in the core, and make it + * available to the other modules through interfaces. + */ +typedef struct require_line require_line; + +/** A structure to keep track of authorization requirements */ +struct require_line { + /** Where the require line is in the config file. */ + apr_int64_t method_mask; + /** The complete string from the command line */ + char *requirement; +}; + +/** + * Return the type of authorization required for this request + * @param r The current request + * @return The authorization required + * @deffunc const char *ap_auth_type(request_rec *r) + */ +AP_DECLARE(const char *) ap_auth_type(request_rec *r); + +/** + * Return the current Authorization realm + * @param r The current request + * @return The current authorization realm + * @deffunc const char *ap_auth_name(request_rec *r) + */ +AP_DECLARE(const char *) ap_auth_name(request_rec *r); + +/** + * How the requires lines must be met. + * @param r The current request + * @return How the requirements must be met. One of: + * <pre> + * SATISFY_ANY -- any of the requirements must be met. + * SATISFY_ALL -- all of the requirements must be met. + * SATISFY_NOSPEC -- There are no applicable satisfy lines + * </pre> + * @deffunc int ap_satisfies(request_rec *r) + */ +AP_DECLARE(int) ap_satisfies(request_rec *r); + +/** + * Retrieve information about all of the requires directives for this request + * @param r The current request + * @return An array of all requires directives for this request + * @deffunc const apr_array_header_t *ap_requires(request_rec *r) + */ +AP_DECLARE(const apr_array_header_t *) ap_requires(request_rec *r); + +#ifdef CORE_PRIVATE + +/* + * Core is also unlike other modules in being implemented in more than + * one file... so, data structures are declared here, even though most of + * the code that cares really is in http_core.c. Also, another accessor. + */ + +AP_DECLARE_DATA extern module core_module; + +/* Per-request configuration */ + +typedef struct { + /* bucket brigade used by getline for look-ahead and + * ap_get_client_block for holding left-over request body */ + struct apr_bucket_brigade *bb; + + /* an array of per-request working data elements, accessed + * by ID using ap_get_request_note() + * (Use ap_register_request_note() during initialization + * to add elements) + */ + void **notes; + + /* There is a script processor installed on the output filter chain, + * so it needs the default_handler to deliver a (script) file into + * the chain so it can process it. Normally, default_handler only + * serves files on a GET request (assuming the file is actual content), + * since other methods are not content-retrieval. This flag overrides + * that behavior, stating that the "content" is actually a script and + * won't actually be delivered as the response for the non-GET method. + */ + int deliver_script; + + /* Custom response strings registered via ap_custom_response(), + * or NULL; check per-dir config if nothing found here + */ + char **response_code_strings; /* from ap_custom_response(), not from + * ErrorDocument + */ + /* Should addition of charset= be suppressed for this request? + */ + int suppress_charset; +} core_request_config; + +/* Standard entries that are guaranteed to be accessible via + * ap_get_request_note() for each request (additional entries + * can be added with ap_register_request_note()) + */ +#define AP_NOTE_DIRECTORY_WALK 0 +#define AP_NOTE_LOCATION_WALK 1 +#define AP_NOTE_FILE_WALK 2 +#define AP_NUM_STD_NOTES 3 + +/** + * Reserve an element in the core_request_config->notes array + * for some application-specific data + * @return An integer key that can be passed to ap_get_request_note() + * during request processing to access this element for the + * current request. + */ +AP_DECLARE(apr_size_t) ap_register_request_note(void); + +/** + * Retrieve a pointer to an element in the core_request_config->notes array + * @param r The request + * @param note_num A key for the element: either a value obtained from + * ap_register_request_note() or one of the predefined AP_NOTE_* + * values. + * @return NULL if the note_num is invalid, otherwise a pointer to the + * requested note element. + * @remark At the start of a request, each note element is NULL. The + * handle provided by ap_get_request_note() is a pointer-to-pointer + * so that the caller can point the element to some app-specific + * data structure. The caller should guarantee that any such + * structure will last as long as the request itself. + */ +AP_DECLARE(void **) ap_get_request_note(request_rec *r, apr_size_t note_num); + +/* Per-directory configuration */ + +typedef unsigned char allow_options_t; +typedef unsigned char overrides_t; + +/* + * Bits of info that go into making an ETag for a file + * document. Why a long? Because char historically + * proved too short for Options, and int can be different + * sizes on different platforms. + */ +typedef unsigned long etag_components_t; + +#define ETAG_UNSET 0 +#define ETAG_NONE (1 << 0) +#define ETAG_MTIME (1 << 1) +#define ETAG_INODE (1 << 2) +#define ETAG_SIZE (1 << 3) +#define ETAG_BACKWARD (ETAG_MTIME | ETAG_INODE | ETAG_SIZE) +#define ETAG_ALL (ETAG_MTIME | ETAG_INODE | ETAG_SIZE) + +typedef enum { + srv_sig_unset, + srv_sig_off, + srv_sig_on, + srv_sig_withmail +} server_signature_e; + +typedef struct { + /* path of the directory/regex/etc. see also d_is_fnmatch/absolute below */ + char *d; + /* the number of slashes in d */ + unsigned d_components; + + /* If (opts & OPT_UNSET) then no absolute assignment to options has + * been made. + * invariant: (opts_add & opts_remove) == 0 + * Which said another way means that the last relative (options + or -) + * assignment made to each bit is recorded in exactly one of opts_add + * or opts_remove. + */ + allow_options_t opts; + allow_options_t opts_add; + allow_options_t opts_remove; + overrides_t override; + + /* MIME typing --- the core doesn't do anything at all with this, + * but it does know what to slap on a request for a document which + * goes untyped by other mechanisms before it slips out the door... + */ + + char *ap_default_type; + + /* Authentication stuff. Groan... */ + + int *satisfy; /* for every method one */ + char *ap_auth_type; + char *ap_auth_name; + apr_array_header_t *ap_requires; + + /* Custom response config. These can contain text or a URL to redirect to. + * if response_code_strings is NULL then there are none in the config, + * if it's not null then it's allocated to sizeof(char*)*RESPONSE_CODES. + * This lets us do quick merges in merge_core_dir_configs(). + */ + + char **response_code_strings; /* from ErrorDocument, not from + * ap_custom_response() */ + + /* Hostname resolution etc */ +#define HOSTNAME_LOOKUP_OFF 0 +#define HOSTNAME_LOOKUP_ON 1 +#define HOSTNAME_LOOKUP_DOUBLE 2 +#define HOSTNAME_LOOKUP_UNSET 3 + unsigned int hostname_lookups : 4; + + signed int do_rfc1413 : 2; /* See if client is advertising a username? */ + + signed int content_md5 : 2; /* calculate Content-MD5? */ + +#define USE_CANONICAL_NAME_OFF (0) +#define USE_CANONICAL_NAME_ON (1) +#define USE_CANONICAL_NAME_DNS (2) +#define USE_CANONICAL_NAME_UNSET (3) + unsigned use_canonical_name : 2; + + /* since is_fnmatch(conf->d) was being called so frequently in + * directory_walk() and its relatives, this field was created and + * is set to the result of that call. + */ + unsigned d_is_fnmatch : 1; + + /* should we force a charset on any outgoing parameterless content-type? + * if so, which charset? + */ +#define ADD_DEFAULT_CHARSET_OFF (0) +#define ADD_DEFAULT_CHARSET_ON (1) +#define ADD_DEFAULT_CHARSET_UNSET (2) + unsigned add_default_charset : 2; + const char *add_default_charset_name; + + /* System Resource Control */ +#ifdef RLIMIT_CPU + struct rlimit *limit_cpu; +#endif +#if defined (RLIMIT_DATA) || defined (RLIMIT_VMEM) || defined(RLIMIT_AS) + struct rlimit *limit_mem; +#endif +#ifdef RLIMIT_NPROC + struct rlimit *limit_nproc; +#endif + apr_off_t limit_req_body; /* limit on bytes in request msg body */ + long limit_xml_body; /* limit on bytes in XML request msg body */ + + /* logging options */ + + server_signature_e server_signature; + + int loglevel; + + /* Access control */ + apr_array_header_t *sec_file; + regex_t *r; + + const char *mime_type; /* forced with ForceType */ + const char *handler; /* forced with SetHandler */ + const char *output_filters; /* forced with SetOutputFilters */ + const char *input_filters; /* forced with SetInputFilters */ + int accept_path_info; /* forced with AcceptPathInfo */ + + apr_hash_t *ct_output_filters; /* added with AddOutputFilterByType */ + + /* + * What attributes/data should be included in ETag generation? + */ + etag_components_t etag_bits; + etag_components_t etag_add; + etag_components_t etag_remove; + + /* + * Run-time performance tuning + */ +#define ENABLE_MMAP_OFF (0) +#define ENABLE_MMAP_ON (1) +#define ENABLE_MMAP_UNSET (2) + unsigned int enable_mmap : 2; /* whether files in this dir can be mmap'ed */ + +#define ENABLE_SENDFILE_OFF (0) +#define ENABLE_SENDFILE_ON (1) +#define ENABLE_SENDFILE_UNSET (2) + unsigned int enable_sendfile : 2; /* files in this dir can be mmap'ed */ + unsigned int allow_encoded_slashes : 1; /* URLs may contain %2f w/o being + * pitched indiscriminately */ +} core_dir_config; + +/* Per-server core configuration */ + +typedef struct { + +#ifdef GPROF + char *gprof_dir; +#endif + + /* Name translations --- we want the core to be able to do *something* + * so it's at least a minimally functional web server on its own (and + * can be tested that way). But let's keep it to the bare minimum: + */ + const char *ap_document_root; + + /* Access control */ + + char *access_name; + apr_array_header_t *sec_dir; + apr_array_header_t *sec_url; + + /* recursion backstopper */ + int redirect_limit; /* maximum number of internal redirects */ + int subreq_limit; /* maximum nesting level of subrequests */ + + /* TRACE control */ +#define AP_TRACE_UNSET -1 +#define AP_TRACE_DISABLE 0 +#define AP_TRACE_ENABLE 1 +#define AP_TRACE_EXTENDED 2 + int trace_enable; + +} core_server_config; + +/* for AddOutputFiltersByType in core.c */ +void ap_add_output_filters_by_type(request_rec *r); + +/* for http_config.c */ +void ap_core_reorder_directories(apr_pool_t *, server_rec *); + +/* for mod_perl */ +AP_CORE_DECLARE(void) ap_add_per_dir_conf(server_rec *s, void *dir_config); +AP_CORE_DECLARE(void) ap_add_per_url_conf(server_rec *s, void *url_config); +AP_CORE_DECLARE(void) ap_add_file_conf(core_dir_config *conf, void *url_config); +AP_CORE_DECLARE_NONSTD(const char *) ap_limit_section(cmd_parms *cmd, void *dummy, const char *arg); + +#endif + + +/* ---------------------------------------------------------------------- + * + * Runtime status/management + */ + +typedef enum { + ap_mgmt_type_string, + ap_mgmt_type_long, + ap_mgmt_type_hash +} ap_mgmt_type_e; + +typedef union { + const char *s_value; + long i_value; + apr_hash_t *h_value; +} ap_mgmt_value; + +typedef struct { + const char *description; + const char *name; + ap_mgmt_type_e vtype; + ap_mgmt_value v; +} ap_mgmt_item_t; + +/* Handles for core filters */ +extern AP_DECLARE_DATA ap_filter_rec_t *ap_subreq_core_filter_handle; +extern AP_DECLARE_DATA ap_filter_rec_t *ap_core_output_filter_handle; +extern AP_DECLARE_DATA ap_filter_rec_t *ap_content_length_filter_handle; +extern AP_DECLARE_DATA ap_filter_rec_t *ap_net_time_filter_handle; +extern AP_DECLARE_DATA ap_filter_rec_t *ap_core_input_filter_handle; + +/** + * This hook provdes a way for modules to provide metrics/statistics about + * their operational status. + * + * @param p A pool to use to create entries in the hash table + * @param val The name of the parameter(s) that is wanted. This is + * tree-structured would be in the form ('*' is all the tree, + * 'module.*' all of the module , 'module.foo.*', or + * 'module.foo.bar' ) + * @param ht The hash table to store the results. Keys are item names, and + * the values point to ap_mgmt_item_t structures. + * @ingroup hooks + */ +AP_DECLARE_HOOK(int, get_mgmt_items, + (apr_pool_t *p, const char * val, apr_hash_t *ht)) + +/* ---------------------------------------------------------------------- */ + +/* ---------------------------------------------------------------------- + * + * I/O logging with mod_logio + */ + +APR_DECLARE_OPTIONAL_FN(void, ap_logio_add_bytes_out, + (conn_rec *c, apr_off_t bytes)); + +/* ---------------------------------------------------------------------- */ + +#ifdef __cplusplus +} +#endif + +#endif /* !APACHE_HTTP_CORE_H */ diff --git a/rubbos/app/httpd-2.0.64/include/http_log.h b/rubbos/app/httpd-2.0.64/include/http_log.h new file mode 100644 index 00000000..52880585 --- /dev/null +++ b/rubbos/app/httpd-2.0.64/include/http_log.h @@ -0,0 +1,334 @@ +/* Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef APACHE_HTTP_LOG_H +#define APACHE_HTTP_LOG_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include "apr_thread_proc.h" + +/** + * @package Apache logging library + */ + +#ifdef HAVE_SYSLOG +#include <syslog.h> + +#ifndef LOG_PRIMASK +#define LOG_PRIMASK 7 +#endif + +#define APLOG_EMERG LOG_EMERG /* system is unusable */ +#define APLOG_ALERT LOG_ALERT /* action must be taken immediately */ +#define APLOG_CRIT LOG_CRIT /* critical conditions */ +#define APLOG_ERR LOG_ERR /* error conditions */ +#define APLOG_WARNING LOG_WARNING /* warning conditions */ +#define APLOG_NOTICE LOG_NOTICE /* normal but significant condition */ +#define APLOG_INFO LOG_INFO /* informational */ +#define APLOG_DEBUG LOG_DEBUG /* debug-level messages */ + +#define APLOG_LEVELMASK LOG_PRIMASK /* mask off the level value */ + +#else + +#define APLOG_EMERG 0 /* system is unusable */ +#define APLOG_ALERT 1 /* action must be taken immediately */ +#define APLOG_CRIT 2 /* critical conditions */ +#define APLOG_ERR 3 /* error conditions */ +#define APLOG_WARNING 4 /* warning conditions */ +#define APLOG_NOTICE 5 /* normal but significant condition */ +#define APLOG_INFO 6 /* informational */ +#define APLOG_DEBUG 7 /* debug-level messages */ + +#define APLOG_LEVELMASK 7 /* mask off the level value */ + +#endif + +/* APLOG_NOERRNO is ignored and should not be used. It will be + * removed in a future release of Apache. + */ +#define APLOG_NOERRNO (APLOG_LEVELMASK + 1) + +/* Use APLOG_TOCLIENT on ap_log_rerror() to give content + * handlers the option of including the error text in the + * ErrorDocument sent back to the client. Setting APLOG_TOCLIENT + * will cause the error text to be saved in the request_rec->notes + * table, keyed to the string "error-notes", if and only if: + * - the severity level of the message is APLOG_WARNING or greater + * - there are no other "error-notes" set in request_rec->notes + * Once error-notes is set, it is up to the content handler to + * determine whether this text should be sent back to the client. + * Note: Client generated text streams sent back to the client MUST + * be escaped to prevent CSS attacks. + */ +#define APLOG_TOCLIENT ((APLOG_LEVELMASK + 1) * 2) + +/* normal but significant condition on startup, usually printed to stderr */ +#define APLOG_STARTUP ((APLOG_LEVELMASK + 1) * 4) + +#ifndef DEFAULT_LOGLEVEL +#define DEFAULT_LOGLEVEL APLOG_WARNING +#endif + +extern int AP_DECLARE_DATA ap_default_loglevel; + +#define APLOG_MARK __FILE__,__LINE__ + +/** + * Set up for logging to stderr. + * @param p The pool to allocate out of + */ +AP_DECLARE(void) ap_open_stderr_log(apr_pool_t *p); + +/** + * Replace logging to stderr with logging to the given file. + * @param p The pool to allocate out of + * @param file Name of the file to log stderr output + */ +AP_DECLARE(apr_status_t) ap_replace_stderr_log(apr_pool_t *p, + const char *file); + +/** + * Open the error log and replace stderr with it. + * @param pconf Not used + * @param plog The pool to allocate the logs from + * @param ptemp Pool used for temporary allocations + * @param s_main The main server + * @tip ap_open_logs isn't expected to be used by modules, it is + * an internal core function + */ +int ap_open_logs(apr_pool_t *pconf, apr_pool_t *plog, + apr_pool_t *ptemp, server_rec *s_main); + +#ifdef CORE_PRIVATE + +/** + * Perform special processing for piped loggers in MPM child + * processes. + * @param p Not used + * @param s Not used + * @tip ap_logs_child_init is not for use by modules; it is an + * internal core function + */ +void ap_logs_child_init(apr_pool_t *p, server_rec *s); + +#endif /* CORE_PRIVATE */ + +/* + * The primary logging functions, ap_log_error, ap_log_rerror, ap_log_cerror, + * and ap_log_perror use a printf style format string to build the log message. + * It is VERY IMPORTANT that you not include any raw data from the network, + * such as the request-URI or request header fields, within the format + * string. Doing so makes the server vulnerable to a denial-of-service + * attack and other messy behavior. Instead, use a simple format string + * like "%s", followed by the string containing the untrusted data. + */ + +/** + * ap_log_error() - log messages which are not related to a particular + * request or connection. This uses a printf-like format to log messages + * to the error_log. + * @param file The file in which this function is called + * @param line The line number on which this function is called + * @param level The level of this error message + * @param status The status code from the previous command + * @param s The server on which we are logging + * @param fmt The format string + * @param ... The arguments to use to fill out fmt. + * @tip Use APLOG_MARK to fill out file and line + * @tip If a request_rec is available, use that with ap_log_rerror() + * in preference to calling this function. Otherwise, if a conn_rec is + * available, use that with ap_log_cerror() in preference to calling + * this function. + * @warning It is VERY IMPORTANT that you not include any raw data from + * the network, such as the request-URI or request header fields, within + * the format string. Doing so makes the server vulnerable to a + * denial-of-service attack and other messy behavior. Instead, use a + * simple format string like "%s", followed by the string containing the + * untrusted data. + * @deffunc void ap_log_error(const char *file, int line, int level, apr_status_t status, const server_rec *s, const char *fmt, ...) + */ +AP_DECLARE(void) ap_log_error(const char *file, int line, int level, + apr_status_t status, const server_rec *s, + const char *fmt, ...) + __attribute__((format(printf,6,7))); + +/** + * ap_log_perror() - log messages which are not related to a particular + * request, connection, or virtual server. This uses a printf-like + * format to log messages to the error_log. + * @param file The file in which this function is called + * @param line The line number on which this function is called + * @param level The level of this error message + * @param status The status code from the previous command + * @param p The pool which we are logging for + * @param fmt The format string + * @param ... The arguments to use to fill out fmt. + * @tip Use APLOG_MARK to fill out file and line + * @warning It is VERY IMPORTANT that you not include any raw data from + * the network, such as the request-URI or request header fields, within + * the format string. Doing so makes the server vulnerable to a + * denial-of-service attack and other messy behavior. Instead, use a + * simple format string like "%s", followed by the string containing the + * untrusted data. + * @deffunc void ap_log_perror(const char *file, int line, int level, apr_status_t status, apr_pool_t *p, const char *fmt, ...) + */ +AP_DECLARE(void) ap_log_perror(const char *file, int line, int level, + apr_status_t status, apr_pool_t *p, + const char *fmt, ...) + __attribute__((format(printf,6,7))); + +/** + * ap_log_rerror() - log messages which are related to a particular + * request. This uses a a printf-like format to log messages to the + * error_log. + * @param file The file in which this function is called + * @param line The line number on which this function is called + * @param level The level of this error message + * @param status The status code from the previous command + * @param r The request which we are logging for + * @param fmt The format string + * @param ... The arguments to use to fill out fmt. + * @tip Use APLOG_MARK to fill out file and line + * @warning It is VERY IMPORTANT that you not include any raw data from + * the network, such as the request-URI or request header fields, within + * the format string. Doing so makes the server vulnerable to a + * denial-of-service attack and other messy behavior. Instead, use a + * simple format string like "%s", followed by the string containing the + * untrusted data. + * @deffunc void ap_log_rerror(const char *file, int line, int level, apr_status_t status, const request_rec *r, const char *fmt, ...) + */ +AP_DECLARE(void) ap_log_rerror(const char *file, int line, int level, + apr_status_t status, const request_rec *r, + const char *fmt, ...) + __attribute__((format(printf,6,7))); + +/** + * ap_log_cerror() - log messages which are related to a particular + * connection. This uses a a printf-like format to log messages to the + * error_log. + * @param file The file in which this function is called + * @param line The line number on which this function is called + * @param level The level of this error message + * @param status The status code from the previous command + * @param c The connection which we are logging for + * @param fmt The format string + * @param ... The arguments to use to fill out fmt. + * @tip Use APLOG_MARK to fill out file and line + * @tip If a request_rec is available, use that with ap_log_rerror() + * in preference to calling this function. + * @warning It is VERY IMPORTANT that you not include any raw data from + * the network, such as the request-URI or request header fields, within + * the format string. Doing so makes the server vulnerable to a + * denial-of-service attack and other messy behavior. Instead, use a + * simple format string like "%s", followed by the string containing the + * untrusted data. + * @note ap_log_cerror() is available starting with Apache 2.0.55. + * @deffunc void ap_log_cerror(const char *file, int line, int level, apr_status_t status, const conn_rec *c, const char *fmt, ...) + */ +AP_DECLARE(void) ap_log_cerror(const char *file, int line, int level, + apr_status_t status, const conn_rec *c, + const char *fmt, ...) + __attribute__((format(printf,6,7))); + +/** + * Convert stderr to the error log + * @param s The current server + * @deffunc void ap_error_log2stderr(server_rec *s) + */ +AP_DECLARE(void) ap_error_log2stderr(server_rec *s); + +/** + * Log the current pid of the parent process + * @param p The pool to use for logging + * @param fname The name of the file to log to + */ +AP_DECLARE(void) ap_log_pid(apr_pool_t *p, const char *fname); + +/** + * Retrieve the pid from a pidfile. + * @param p The pool to use for logging + * @param filename The name of the file containing the pid + * @param mypid Pointer to pid_t (valid only if return APR_SUCCESS) + */ +AP_DECLARE(apr_status_t) ap_read_pid(apr_pool_t *p, const char *filename, pid_t *mypid); + +typedef struct piped_log piped_log; + +/** + * The piped logging structure. Piped logs are used to move functionality + * out of the main server. For example, log rotation is done with piped logs. + */ +struct piped_log { + /** The pool to use for the piped log */ + apr_pool_t *p; + /** The pipe between the server and the logging process */ + apr_file_t *fds[2]; + /* XXX - an #ifdef that needs to be eliminated from public view. Shouldn't + * be hard */ +#ifdef AP_HAVE_RELIABLE_PIPED_LOGS + /** The name of the program the logging process is running */ + char *program; + /** The pid of the logging process */ + apr_proc_t *pid; +#endif +}; + +/** + * Open the piped log process + * @param p The pool to allocate out of + * @param program The program to run in the logging process + * @return The piped log structure + * @deffunc piped_log *ap_open_piped_log(apr_pool_t *p, const char *program) + */ +AP_DECLARE(piped_log *) ap_open_piped_log(apr_pool_t *p, const char *program); + +/** + * Close the piped log and kill the logging process + * @param pl The piped log structure + * @deffunc void ap_close_piped_log(piped_log *pl) + */ +AP_DECLARE(void) ap_close_piped_log(piped_log *pl); + +/** + * A macro to access the read side of the piped log pipe + * @param pl The piped log structure + * @return The native file descriptor + * @deffunc ap_piped_log_read_fd(pl) + */ +#define ap_piped_log_read_fd(pl) ((pl)->fds[0]) + +/** + * A macro to access the write side of the piped log pipe + * @param pl The piped log structure + * @return The native file descriptor + * @deffunc ap_piped_log_read_fd(pl) + */ +#define ap_piped_log_write_fd(pl) ((pl)->fds[1]) + +AP_DECLARE_HOOK(void, error_log, (const char *file, int line, int level, + apr_status_t status, const server_rec *s, + const request_rec *r, apr_pool_t *pool, + const char *errstr)) + +#ifdef __cplusplus +} +#endif + +#endif /* !APACHE_HTTP_LOG_H */ diff --git a/rubbos/app/httpd-2.0.64/include/http_main.h b/rubbos/app/httpd-2.0.64/include/http_main.h new file mode 100644 index 00000000..cc4ce59d --- /dev/null +++ b/rubbos/app/httpd-2.0.64/include/http_main.h @@ -0,0 +1,58 @@ +/* Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef APACHE_HTTP_MAIN_H +#define APACHE_HTTP_MAIN_H + +#include "apr_optional.h" + +/* AP_SERVER_BASEARGS is the command argument list parsed by http_main.c + * in apr_getopt() format. Use this for default'ing args that the MPM + * can safely ignore and pass on from its rewrite_args() handler. + */ +#define AP_SERVER_BASEARGS "C:c:D:d:E:e:f:vVlLtSh?X" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @package Command line options + */ + +/** The name of the Apache executable */ +AP_DECLARE_DATA extern const char *ap_server_argv0; +/** The global server's ServerRoot */ +AP_DECLARE_DATA extern const char *ap_server_root; + +/* for -C, -c and -D switches */ +/** An array of all -C directives. These are processed before the server's + * config file */ +AP_DECLARE_DATA extern apr_array_header_t *ap_server_pre_read_config; +/** An array of all -c directives. These are processed after the server's + * config file */ +AP_DECLARE_DATA extern apr_array_header_t *ap_server_post_read_config; +/** An array of all -D defines on the command line. This allows people to + * effect the server based on command line options */ +AP_DECLARE_DATA extern apr_array_header_t *ap_server_config_defines; + +APR_DECLARE_OPTIONAL_FN(int, ap_signal_server, (int *, apr_pool_t *)); + +#ifdef __cplusplus +} +#endif + +#endif /* !APACHE_HTTP_MAIN_H */ diff --git a/rubbos/app/httpd-2.0.64/include/http_protocol.h b/rubbos/app/httpd-2.0.64/include/http_protocol.h new file mode 100644 index 00000000..6287589f --- /dev/null +++ b/rubbos/app/httpd-2.0.64/include/http_protocol.h @@ -0,0 +1,697 @@ +/* Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef APACHE_HTTP_PROTOCOL_H +#define APACHE_HTTP_PROTOCOL_H + +#include "httpd.h" +#include "apr_hooks.h" +#include "apr_portable.h" +#include "apr_mmap.h" +#include "apr_buckets.h" +#include "util_filter.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @package HTTP protocol handling + */ + +/** + * This hook allows modules to insert filters for the current error response + * @param r the current request + * @ingroup hooks + */ +AP_DECLARE_HOOK(void,insert_error_filter,(request_rec *r)) + +/* This is an optimization. We keep a record of the filter_rec that + * stores the old_write filter, so that we can avoid strcmp's later. + */ +AP_DECLARE_DATA extern ap_filter_rec_t *ap_old_write_func; + +/* + * Prototypes for routines which either talk directly back to the user, + * or control the ones that eventually do. + */ + +/** + * Read a request and fill in the fields. + * @param c The current connection + * @return The new request_rec + */ +request_rec *ap_read_request(conn_rec *c); + +/** + * Read the mime-encoded headers. + * @param r The current request + */ +AP_DECLARE(void) ap_get_mime_headers(request_rec *r); + +/** + * Optimized version of ap_get_mime_headers() that requires a + * temporary brigade to work with + * @param r The current request + * @param bb temp brigade + */ +AP_DECLARE(void) ap_get_mime_headers_core(request_rec *r, + apr_bucket_brigade *bb); + +/* Finish up stuff after a request */ + +/** + * Called at completion of sending the response. It sends the terminating + * protocol information. + * @param r The current request + * @deffunc void ap_finalize_request_protocol(request_rec *r) + */ +AP_DECLARE(void) ap_finalize_request_protocol(request_rec *r); + +/** + * Send error back to client. + * @param r The current request + * @param recursive_error last arg indicates error status in case we get + * an error in the process of trying to deal with an ErrorDocument + * to handle some other error. In that case, we print the default + * report for the first thing that went wrong, and more briefly report + * on the problem with the ErrorDocument. + * @deffunc void ap_send_error_response(request_rec *r, int recursive_error) + */ +AP_DECLARE(void) ap_send_error_response(request_rec *r, int recursive_error); + +/* Set last modified header line from the lastmod date of the associated file. + * Also, set content length. + * + * May return an error status, typically HTTP_NOT_MODIFIED (that when the + * permit_cache argument is set to one). + */ + +/** + * Set the content length for this request + * @param r The current request + * @param length The new content length + * @deffunc void ap_set_content_length(request_rec *r, apr_off_t length) + */ +AP_DECLARE(void) ap_set_content_length(request_rec *r, apr_off_t length); + +/** + * Set the keepalive status for this request + * @param r The current request + * @return 1 if keepalive can be set, 0 otherwise + * @deffunc int ap_set_keepalive(request_rec *r) + */ +AP_DECLARE(int) ap_set_keepalive(request_rec *r); + +/** + * Return the latest rational time from a request/mtime pair. Mtime is + * returned unless it's in the future, in which case we return the current time. + * @param r The current request + * @param mtime The last modified time + * @return the latest rational time. + * @deffunc apr_time_t ap_rationalize_mtime(request_rec *r, apr_time_t mtime) + */ +AP_DECLARE(apr_time_t) ap_rationalize_mtime(request_rec *r, apr_time_t mtime); + +/** + * Build the content-type that should be sent to the client from the + * content-type specified. The following rules are followed: + * - if type is NULL, type is set to ap_default_type(r) + * - if charset adding is disabled, stop processing and return type. + * - then, if there are no parameters on type, add the default charset + * - return type + * @param r The current request + * @return The content-type + * @deffunc const char *ap_make_content_type(request_rec *r, const char *type); + */ +AP_DECLARE(const char *) ap_make_content_type(request_rec *r, + const char *type); + +#ifdef CORE_PRIVATE +/** + * Precompile metadata structures used by ap_make_content_type() + * @param r The pool to use for allocations + * @deffunc void ap_setup_make_content_type(apr_pool_t *pool) + */ +AP_DECLARE(void) ap_setup_make_content_type(apr_pool_t *pool); +#endif /* CORE_PRIVATE */ + +/** + * Construct an entity tag from the resource information. If it's a real + * file, build in some of the file characteristics. + * @param r The current request + * @param force_weak Force the entity tag to be weak - it could be modified + * again in as short an interval. + * @return The entity tag + * @deffunc char *ap_make_etag(request_rec *r, int force_weak) + */ +AP_DECLARE(char *) ap_make_etag(request_rec *r, int force_weak); + +/** + * Set the E-tag outgoing header + * @param The current request + * @deffunc void ap_set_etag(request_rec *r) + */ +AP_DECLARE(void) ap_set_etag(request_rec *r); + +/** + * Set the last modified time for the file being sent + * @param r The current request + * @deffunc void ap_set_last_modified(request_rec *r) + */ +AP_DECLARE(void) ap_set_last_modified(request_rec *r); + +/** + * Implements condition GET rules for HTTP/1.1 specification. This function + * inspects the client headers and determines if the response fulfills + * the requirements specified. + * @param r The current request + * @return OK if the response fulfills the condition GET rules, some + * other status code otherwise + * @deffunc int ap_meets_conditions(request_rec *r) + */ +AP_DECLARE(int) ap_meets_conditions(request_rec *r); + +/* Other ways to send stuff at the client. All of these keep track + * of bytes_sent automatically. This indirection is intended to make + * it a little more painless to slide things like HTTP-NG packetization + * underneath the main body of the code later. In the meantime, it lets + * us centralize a bit of accounting (bytes_sent). + * + * These also return the number of bytes written by the call. + * They should only be called with a timeout registered, for obvious reaasons. + * (Ditto the send_header stuff). + */ + +/** + * Send an entire file to the client, using sendfile if supported by the + * current platform + * @param fd The file to send. + * @param r The current request + * @param offset Offset into the file to start sending. + * @param length Amount of data to send + * @param nbytes Amount of data actually sent + * @deffunc apr_status_t ap_send_fd(apr_file_t *fd, request_rec *r, apr_off_t offset, apr_size_t length, apr_size_t *nbytes); + */ +AP_DECLARE(apr_status_t) ap_send_fd(apr_file_t *fd, request_rec *r, apr_off_t offset, + apr_size_t length, apr_size_t *nbytes); + +#if APR_HAS_MMAP +/** + * Send an MMAP'ed file to the client + * @param mm The MMAP'ed file to send + * @param r The current request + * @param offset The offset into the MMAP to start sending + * @param length The amount of data to send + * @return The number of bytes sent + * @deffunc size_t ap_send_mmap(apr_mmap_t *mm, request_rec *r, size_t offset, size_t length) + */ +AP_DECLARE(size_t) ap_send_mmap(apr_mmap_t *mm, request_rec *r, size_t offset, + size_t length); +#endif + + +/** + * Register a new request method, and return the offset that will be + * associated with that method. + * + * @param p The pool to create registered method numbers from. + * @param methname The name of the new method to register. + * @return Ab int value representing an offset into a bitmask. + */ +AP_DECLARE(int) ap_method_register(apr_pool_t *p, const char *methname); + +/** + * Initialize the method_registry and allocate memory for it. + * + * @param p Pool to allocate memory for the registry from. + */ +AP_DECLARE(void) ap_method_registry_init(apr_pool_t *p); + +/* + * This is a convenience macro to ease with checking a mask + * against a method name. + */ +#define AP_METHOD_CHECK_ALLOWED(mask, methname) \ + ((mask) & (AP_METHOD_BIT << ap_method_number_of((methname)))) + +/** + * Create a new method list with the specified number of preallocated + * slots for extension methods. + * + * @param p Pointer to a pool in which the structure should be + * allocated. + * @param nelts Number of preallocated extension slots + * @return Pointer to the newly created structure. + * @deffunc ap_method_list_t ap_make_method_list(apr_pool_t *p, int nelts) + */ +AP_DECLARE(ap_method_list_t *) ap_make_method_list(apr_pool_t *p, int nelts); +AP_DECLARE(void) ap_copy_method_list(ap_method_list_t *dest, + ap_method_list_t *src); +AP_DECLARE_NONSTD(void) ap_method_list_do(int (*comp) (void *urec, const char *mname, + int mnum), + void *rec, + const ap_method_list_t *ml, ...); +AP_DECLARE(void) ap_method_list_vdo(int (*comp) (void *urec, const char *mname, + int mnum), + void *rec, const ap_method_list_t *ml, + va_list vp); +/** + * Search for an HTTP method name in an ap_method_list_t structure, and + * return true if found. + * + * @param method String containing the name of the method to check. + * @param l Pointer to a method list, such as cmd->methods_limited. + * @return 1 if method is in the list, otherwise 0 + * @deffunc int ap_method_in_list(const char *method, ap_method_list_t *l) + */ +AP_DECLARE(int) ap_method_in_list(ap_method_list_t *l, const char *method); + +/** + * Add an HTTP method name to an ap_method_list_t structure if it isn't + * already listed. + * + * @param method String containing the name of the method to check. + * @param l Pointer to a method list, such as cmd->methods_limited. + * @return None. + * @deffunc void ap_method_in_list(ap_method_list_t *l, const char *method) + */ +AP_DECLARE(void) ap_method_list_add(ap_method_list_t *l, const char *method); + +/** + * Remove an HTTP method name from an ap_method_list_t structure. + * + * @param l Pointer to a method list, such as cmd->methods_limited. + * @param method String containing the name of the method to remove. + * @return None. + * @deffunc void ap_method_list_remove(ap_method_list_t *l, const char *method) + */ +AP_DECLARE(void) ap_method_list_remove(ap_method_list_t *l, + const char *method); + +/** + * Reset a method list to be completely empty. + * + * @param l Pointer to a method list, such as cmd->methods_limited. + * @return None. + * @deffunc void ap_clear_method_list(ap_method_list_t *l) + */ +AP_DECLARE(void) ap_clear_method_list(ap_method_list_t *l); + +/** + * Set the content type for this request (r->content_type). + * @param r The current request + * @param ct The new content type + * @deffunc void ap_set_content_type(request_rec *r, const char* ct) + * @warning This function must be called to set r->content_type in order + * for the AddOutputFilterByType directive to work correctly. + */ +AP_DECLARE(void) ap_set_content_type(request_rec *r, const char *ct); + +/* Hmmm... could macrofy these for now, and maybe forever, though the + * definitions of the macros would get a whole lot hairier. + */ + +/** + * Output one character for this request + * @param c the character to output + * @param r the current request + * @return The number of bytes sent + * @deffunc int ap_rputc(int c, request_rec *r) + */ +AP_DECLARE(int) ap_rputc(int c, request_rec *r); + +/** + * Output a string for the current request + * @param str The string to output + * @param r The current request + * @return The number of bytes sent + * @deffunc int ap_rputs(const char *str, request_rec *r) + */ +AP_DECLARE(int) ap_rputs(const char *str, request_rec *r); + +/** + * Write a buffer for the current request + * @param buf The buffer to write + * @param nbyte The number of bytes to send from the buffer + * @param r The current request + * @return The number of bytes sent + * @deffunc int ap_rwrite(const void *buf, int nbyte, request_rec *r) + */ +AP_DECLARE(int) ap_rwrite(const void *buf, int nbyte, request_rec *r); + +/** + * Write an unspecified number of strings to the request + * @param r The current request + * @param ... The strings to write + * @return The number of bytes sent + * @deffunc int ap_rvputs(request_rec *r, ...) + */ +AP_DECLARE_NONSTD(int) ap_rvputs(request_rec *r,...); + +/** + * Output data to the client in a printf format + * @param r The current request + * @param fmt The format string + * @param vlist The arguments to use to fill out the format string + * @return The number of bytes sent + * @deffunc int ap_vrprintf(request_rec *r, const char *fmt, va_list vlist) + */ +AP_DECLARE(int) ap_vrprintf(request_rec *r, const char *fmt, va_list vlist); + +/** + * Output data to the client in a printf format + * @param r The current request + * @param fmt The format string + * @param ... The arguments to use to fill out the format string + * @return The number of bytes sent + * @deffunc int ap_rprintf(request_rec *r, const char *fmt, ...) + */ +AP_DECLARE_NONSTD(int) ap_rprintf(request_rec *r, const char *fmt,...) + __attribute__((format(printf,2,3))); +/** + * Flush all of the data for the current request to the client + * @param r The current request + * @return The number of bytes sent + * @deffunc int ap_rflush(request_rec *r) + */ +AP_DECLARE(int) ap_rflush(request_rec *r); + +/** + * Index used in custom_responses array for a specific error code + * (only use outside protocol.c is in getting them configured). + * @param status HTTP status code + * @return The index of the response + * @deffunc int ap_index_of_response(int status) + */ +AP_DECLARE(int) ap_index_of_response(int status); + +/** + * Return the Status-Line for a given status code (excluding the + * HTTP-Version field). If an invalid or unknown status code is + * passed, "500 Internal Server Error" will be returned. + * @param status The HTTP status code + * @return The Status-Line + * @deffunc const char *ap_get_status_line(int status) + */ +AP_DECLARE(const char *) ap_get_status_line(int status); + +/* Reading a block of data from the client connection (e.g., POST arg) */ + +/** + * Setup the client to allow Apache to read the request body. + * @param r The current request + * @param read_policy How the server should interpret a chunked + * transfer-encoding. One of: <pre> + * REQUEST_NO_BODY Send 413 error if message has any body + * REQUEST_CHUNKED_ERROR Send 411 error if body without Content-Length + * REQUEST_CHUNKED_DECHUNK If chunked, remove the chunks for me. + * </pre> + * @return either OK or an error code + * @deffunc int ap_setup_client_block(request_rec *r, int read_policy) + */ +AP_DECLARE(int) ap_setup_client_block(request_rec *r, int read_policy); + +/** + * Determine if the client has sent any data. This also sends a + * 100 Continue response to HTTP/1.1 clients, so modules should not be called + * until the module is ready to read content. + * @warning Never call this function more than once. + * @param r The current request + * @return 0 if there is no message to read, 1 otherwise + * @deffunc int ap_should_client_block(request_rec *r) + */ +AP_DECLARE(int) ap_should_client_block(request_rec *r); + +/** + * Call this in a loop. It will put data into a buffer and return the length + * of the input block + * @param r The current request + * @param buffer The buffer in which to store the data + * @param bufsiz The size of the buffer + * @return Number of bytes inserted into the buffer. When done reading, 0 + * if EOF, or -1 if there was an error + * @deffunc long ap_get_client_block(request_rec *r, char *buffer, apr_size_t bufsiz) + */ +AP_DECLARE(long) ap_get_client_block(request_rec *r, char *buffer, apr_size_t bufsiz); + +/** + * In HTTP/1.1, any method can have a body. However, most GET handlers + * wouldn't know what to do with a request body if they received one. + * This helper routine tests for and reads any message body in the request, + * simply discarding whatever it receives. We need to do this because + * failing to read the request body would cause it to be interpreted + * as the next request on a persistent connection. + * @param r The current request + * @return error status if request is malformed, OK otherwise + * @deffunc int ap_discard_request_body(request_rec *r) + */ +AP_DECLARE(int) ap_discard_request_body(request_rec *r); + + +/** + * Setup the output headers so that the client knows how to authenticate + * itself the next time, if an authentication request failed. This function + * works for both basic and digest authentication + * @param r The current request + * @deffunc void ap_note_auth_failure(request_rec *r) + */ +AP_DECLARE(void) ap_note_auth_failure(request_rec *r); + +/** + * Setup the output headers so that the client knows how to authenticate + * itself the next time, if an authentication request failed. This function + * works only for basic authentication + * @param r The current request + * @deffunc void ap_note_basic_auth_failure(request_rec *r) + */ +AP_DECLARE(void) ap_note_basic_auth_failure(request_rec *r); + +/** + * Setup the output headers so that the client knows how to authenticate + * itself the next time, if an authentication request failed. This function + * works only for digest authentication + * @param r The current request + * @deffunc void ap_note_digest_auth_failure(request_rec *r) + */ +AP_DECLARE(void) ap_note_digest_auth_failure(request_rec *r); + +/** + * Get the password from the request headers + * @param r The current request + * @param pw The password as set in the headers + * @return 0 (OK) if it set the 'pw' argument (and assured + * a correct value in r->user); otherwise it returns + * an error code, either HTTP_INTERNAL_SERVER_ERROR if things are + * really confused, HTTP_UNAUTHORIZED if no authentication at all + * seemed to be in use, or DECLINED if there was authentication but + * it wasn't Basic (in which case, the caller should presumably + * decline as well). + * @deffunc int ap_get_basic_auth_pw(request_rec *r, const char **pw) + */ +AP_DECLARE(int) ap_get_basic_auth_pw(request_rec *r, const char **pw); + +/** + * parse_uri: break apart the uri + * @warning Side Effects: <pre> + * - sets r->args to rest after '?' (or NULL if no '?') + * - sets r->uri to request uri (without r->args part) + * - sets r->hostname (if not set already) from request (scheme://host:port) + * </pre> + * @param r The current request + * @param uri The uri to break apart + * @deffunc void ap_parse_uri(request_rec *r, const char *uri) + */ +AP_CORE_DECLARE(void) ap_parse_uri(request_rec *r, const char *uri); + +/** + * Get the next line of input for the request + * @param s The buffer into which to read the line + * @param n The size of the buffer + * @param r The request + * @param fold Whether to merge continuation lines + * @return The length of the line, if successful + * n, if the line is too big to fit in the buffer + * -1 for miscellaneous errors + * @deffunc int ap_method_number_of(const char *method) + */ +AP_DECLARE(int) ap_getline(char *s, int n, request_rec *r, int fold); + +/** + * Get the next line of input for the request + * + * Note: on ASCII boxes, ap_rgetline is a macro which simply calls + * ap_rgetline_core to get the line of input. + * + * on EBCDIC boxes, ap_rgetline is a wrapper function which + * translates ASCII protocol lines to the local EBCDIC code page + * after getting the line of input. + * + * @param s Pointer to the pointer to the buffer into which the line + * should be read; if *s==NULL, a buffer of the necessary size + * to hold the data will be allocated from the request pool + * @param n The size of the buffer + * @param read The length of the line. + * @param r The request + * @param fold Whether to merge continuation lines + * @param bb Working brigade to use when reading buckets + * @return APR_SUCCESS, if successful + * APR_ENOSPC, if the line is too big to fit in the buffer + * Other errors where appropriate + */ +#if APR_CHARSET_EBCDIC +AP_DECLARE(apr_status_t) ap_rgetline(char **s, apr_size_t n, + apr_size_t *read, + request_rec *r, int fold, + apr_bucket_brigade *bb); +#else /* ASCII box */ +#define ap_rgetline(s, n, read, r, fold, bb) \ + ap_rgetline_core((s), (n), (read), (r), (fold), (bb)) +#endif +AP_DECLARE(apr_status_t) ap_rgetline_core(char **s, apr_size_t n, + apr_size_t *read, + request_rec *r, int fold, + apr_bucket_brigade *bb); + +/** + * Get the method number associated with the given string, assumed to + * contain an HTTP method. Returns M_INVALID if not recognized. + * @param method A string containing a valid HTTP method + * @return The method number + */ +AP_DECLARE(int) ap_method_number_of(const char *method); + +/** + * Get the method name associated with the given internal method + * number. Returns NULL if not recognized. + * @param p A pool to use for temporary allocations. + * @param methnum An integer value corresponding to an internal method number + * @return The name corresponding to the method number + */ +AP_DECLARE(const char *) ap_method_name_of(apr_pool_t *p, int methnum); + + + /* Hooks */ + /* + * post_read_request --- run right after read_request or internal_redirect, + * and not run during any subrequests. + */ +/** + * This hook allows modules to affect the request immediately after the request + * has been read, and before any other phases have been processes. This allows + * modules to make decisions based upon the input header fields + * @param r The current request + * @return OK or DECLINED + * @deffunc ap_run_post_read_request(request_rec *r) + */ +AP_DECLARE_HOOK(int,post_read_request,(request_rec *r)) + +/** + * This hook allows modules to perform any module-specific logging activities + * over and above the normal server things. + * @param r The current request + * @return OK, DECLINED, or HTTP_... + * @deffunc int ap_run_log_transaction(request_rec *r) + */ +AP_DECLARE_HOOK(int,log_transaction,(request_rec *r)) + +/** + * This hook allows modules to retrieve the http method from a request. This + * allows Apache modules to easily extend the methods that Apache understands + * @param r The current request + * @return The http method from the request + * @deffunc const char *ap_run_http_method(const request_rec *r) + */ +AP_DECLARE_HOOK(const char *,http_method,(const request_rec *r)) + +/** + * Return the default port from the current request + * @param r The current request + * @return The current port + * @deffunc apr_port_t ap_run_default_port(const request_rec *r) + */ +AP_DECLARE_HOOK(apr_port_t,default_port,(const request_rec *r)) + +typedef struct ap_bucket_error ap_bucket_error; + +/** + * A bucket referring to an HTTP error + * This bucket can be passed down the filter stack to indicate that an + * HTTP error occurred while running a filter. In order for this bucket + * to be used successfully, it MUST be sent as the first bucket in the + * first brigade to be sent from a given filter. + */ +struct ap_bucket_error { + /** Number of buckets using this memory */ + apr_bucket_refcount refcount; + /** The error code */ + int status; + /** The error string */ + const char *data; +}; + +AP_DECLARE_DATA extern const apr_bucket_type_t ap_bucket_type_error; + +/** + * Determine if a bucket is an error bucket + * @param e The bucket to inspect + * @return true or false + */ +#define AP_BUCKET_IS_ERROR(e) (e->type == &ap_bucket_type_error) + +/** + * Make the bucket passed in an error bucket + * @param b The bucket to make into an error bucket + * @param error The HTTP error code to put in the bucket. + * @param buf An optional error string to put in the bucket. + * @param p A pool to allocate out of. + * @return The new bucket, or NULL if allocation failed + * @deffunc apr_bucket *ap_bucket_error_make(apr_bucket *b, int error, const char *buf, apr_pool_t *p) + */ +AP_DECLARE(apr_bucket *) ap_bucket_error_make(apr_bucket *b, int error, + const char *buf, apr_pool_t *p); + +/** + * Create a bucket referring to an HTTP error. + * @param error The HTTP error code to put in the bucket. + * @param buf An optional error string to put in the bucket. + * @param p A pool to allocate the error string out of. + * @param list The bucket allocator from which to allocate the bucket + * @return The new bucket, or NULL if allocation failed + * @deffunc apr_bucket *ap_bucket_error_create(int error, const char *buf, apr_pool_t *p, apr_bucket_alloc_t *list) + */ +AP_DECLARE(apr_bucket *) ap_bucket_error_create(int error, const char *buf, + apr_pool_t *p, + apr_bucket_alloc_t *list); + +AP_DECLARE_NONSTD(apr_status_t) ap_byterange_filter(ap_filter_t *f, apr_bucket_brigade *b); +AP_DECLARE_NONSTD(apr_status_t) ap_http_header_filter(ap_filter_t *f, apr_bucket_brigade *b); +AP_DECLARE_NONSTD(apr_status_t) ap_content_length_filter(ap_filter_t *, + apr_bucket_brigade *); +AP_DECLARE_NONSTD(apr_status_t) ap_old_write_filter(ap_filter_t *f, apr_bucket_brigade *b); + +/* + * Setting up the protocol fields for subsidiary requests... + * Also, a wrapup function to keep the internal accounting straight. + */ +AP_DECLARE(void) ap_set_sub_req_protocol(request_rec *rnew, const request_rec *r); +AP_DECLARE(void) ap_finalize_sub_req_protocol(request_rec *sub_r); + +#ifdef __cplusplus +} +#endif + +#endif /* !APACHE_HTTP_PROTOCOL_H */ diff --git a/rubbos/app/httpd-2.0.64/include/http_request.h b/rubbos/app/httpd-2.0.64/include/http_request.h new file mode 100644 index 00000000..c10e44db --- /dev/null +++ b/rubbos/app/httpd-2.0.64/include/http_request.h @@ -0,0 +1,373 @@ +/* Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef APACHE_HTTP_REQUEST_H +#define APACHE_HTTP_REQUEST_H + +#include "apr_hooks.h" +#include "util_filter.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define AP_SUBREQ_NO_ARGS 0 +#define AP_SUBREQ_MERGE_ARGS 1 + +/** + * @file http_request.h + * @brief Apache Request library + */ + +/* http_request.c is the code which handles the main line of request + * processing, once a request has been read in (finding the right per- + * directory configuration, building it if necessary, and calling all + * the module dispatch functions in the right order). + * + * The pieces here which are public to the modules, allow them to learn + * how the server would handle some other file or URI, or perhaps even + * direct the server to serve that other file instead of the one the + * client requested directly. + * + * There are two ways to do that. The first is the sub_request mechanism, + * which handles looking up files and URIs as adjuncts to some other + * request (e.g., directory entries for multiviews and directory listings); + * the lookup functions stop short of actually running the request, but + * (e.g., for includes), a module may call for the request to be run + * by calling run_sub_req. The space allocated to create sub_reqs can be + * reclaimed by calling destroy_sub_req --- be sure to copy anything you care + * about which was allocated in its apr_pool_t elsewhere before doing this. + */ + +/** + * An internal handler used by the ap_process_request, all subrequest mechanisms + * and the redirect mechanism. + * @param r The request, subrequest or internal redirect to pre-process + * @return The return code for the request + */ +AP_DECLARE(int) ap_process_request_internal(request_rec *r); + +/** + * Create a subrequest from the given URI. This subrequest can be + * inspected to find information about the requested URI + * @param new_uri The URI to lookup + * @param r The current request + * @param next_filter The first filter the sub_request should use. If this is + * NULL, it defaults to the first filter for the main request + * @return The new request record + * @deffunc request_rec * ap_sub_req_lookup_uri(const char *new_uri, const request_rec *r) + */ +AP_DECLARE(request_rec *) ap_sub_req_lookup_uri(const char *new_uri, + const request_rec *r, + ap_filter_t *next_filter); + +/** + * Create a subrequest for the given file. This subrequest can be + * inspected to find information about the requested file + * @param new_file The file to lookup + * @param r The current request + * @param next_filter The first filter the sub_request should use. If this is + * NULL, it defaults to the first filter for the main request + * @return The new request record + * @deffunc request_rec * ap_sub_req_lookup_file(const char *new_file, const request_rec *r) + */ +AP_DECLARE(request_rec *) ap_sub_req_lookup_file(const char *new_file, + const request_rec *r, + ap_filter_t *next_filter); +/** + * Create a subrequest for the given apr_dir_read result. This subrequest + * can be inspected to find information about the requested file + * @param finfo The apr_dir_read result to lookup + * @param r The current request + * @param subtype What type of subrequest to perform, one of; + * <PRE> + * AP_SUBREQ_NO_ARGS ignore r->args and r->path_info + * AP_SUBREQ_MERGE_ARGS merge r->args and r->path_info + * </PRE> + * @param next_filter The first filter the sub_request should use. If this is + * NULL, it defaults to the first filter for the main request + * @return The new request record + * @deffunc request_rec * ap_sub_req_lookup_dirent(apr_finfo_t *finfo, int subtype, const request_rec *r) + * @tip The apr_dir_read flags value APR_FINFO_MIN|APR_FINFO_NAME flag is the + * minimum recommended query if the results will be passed to apr_dir_read. + * The file info passed must include the name, and must have the same relative + * directory as the current request. + */ +AP_DECLARE(request_rec *) ap_sub_req_lookup_dirent(const apr_finfo_t *finfo, + const request_rec *r, + int subtype, + ap_filter_t *next_filter); +/** + * Create a subrequest for the given URI using a specific method. This + * subrequest can be inspected to find information about the requested URI + * @param method The method to use in the new subrequest + * @param new_uri The URI to lookup + * @param r The current request + * @param next_filter The first filter the sub_request should use. If this is + * NULL, it defaults to the first filter for the main request + * @return The new request record + * @deffunc request_rec * ap_sub_req_method_uri(const char *method, const char *new_uri, const request_rec *r) + */ +AP_DECLARE(request_rec *) ap_sub_req_method_uri(const char *method, + const char *new_uri, + const request_rec *r, + ap_filter_t *next_filter); +/** + * An output filter to strip EOS buckets from sub-requests. This always + * has to be inserted at the end of a sub-requests filter stack. + * @param f The current filter + * @param bb The brigade to filter + * @deffunc apr_status_t ap_sub_req_output_filter(ap_filter_t *f, apr_bucket_brigade *bb) + */ +AP_CORE_DECLARE_NONSTD(apr_status_t) ap_sub_req_output_filter(ap_filter_t *f, + apr_bucket_brigade *bb); + +/** + * Run the handler for the subrequest + * @param r The subrequest to run + * @return The return code for the subrequest + * @deffunc int ap_run_sub_req(request_rec *r) + */ +AP_DECLARE(int) ap_run_sub_req(request_rec *r); + +/** + * Free the memory associated with a subrequest + * @param r The subrequest to finish + * @deffunc void ap_destroy_sub_req(request_rec *r) + */ +AP_DECLARE(void) ap_destroy_sub_req(request_rec *r); + +/* + * Then there's the case that you want some other request to be served + * as the top-level request INSTEAD of what the client requested directly. + * If so, call this from a handler, and then immediately return OK. + */ + +/** + * Redirect the current request to some other uri + * @param new_uri The URI to replace the current request with + * @param r The current request + * @deffunc void ap_internal_redirect(const char *new_uri, request_rec *r) + */ +AP_DECLARE(void) ap_internal_redirect(const char *new_uri, request_rec *r); + +/** + * This function is designed for things like actions or CGI scripts, when + * using AddHandler, and you want to preserve the content type across + * an internal redirect. + * @param new_uri The URI to replace the current request with. + * @param r The current request + * @deffunc void ap_internal_redirect_handler(const char *new_uri, request_rec *r) + */ +AP_DECLARE(void) ap_internal_redirect_handler(const char *new_uri, request_rec *r); + +/** + * Redirect the current request to a sub_req, merging the pools + * @param sub_req A subrequest created from this request + * @param r The current request + * @deffunc void ap_internal_fast_redirect(request_rec *sub_req, request_rec *r) + * @tip the sub_req's pool will be merged into r's pool, be very careful + * not to destroy this subrequest, it will be destroyed with the main request! + */ +AP_DECLARE(void) ap_internal_fast_redirect(request_rec *sub_req, request_rec *r); + +/** + * Can be used within any handler to determine if any authentication + * is required for the current request + * @param r The current request + * @return 1 if authentication is required, 0 otherwise + * @deffunc int ap_some_auth_required(request_rec *r) + */ +AP_DECLARE(int) ap_some_auth_required(request_rec *r); + +/** + * Determine if the current request is the main request or a subrequest + * @param r The current request + * @return 1 if this is the main request, 0 otherwise + * @deffunc int ap_is_initial_req(request_rec *r) + */ +AP_DECLARE(int) ap_is_initial_req(request_rec *r); + +/** + * Function to set the r->mtime field to the specified value if it's later + * than what's already there. + * @param r The current request + * @param dependency_time Time to set the mtime to + * @deffunc void ap_update_mtime(request_rec *r, apr_time_t dependency_mtime) + */ +AP_DECLARE(void) ap_update_mtime(request_rec *r, apr_time_t dependency_mtime); + +/** + * Add one or more methods to the list permitted to access the resource. + * Usually executed by the content handler before the response header is + * sent, but sometimes invoked at an earlier phase if a module knows it + * can set the list authoritatively. Note that the methods are ADDED + * to any already permitted unless the reset flag is non-zero. The + * list is used to generate the Allow response header field when it + * is needed. + * @param r The pointer to the request identifying the resource. + * @param reset Boolean flag indicating whether this list should + * completely replace any current settings. + * @param ... A NULL-terminated list of strings, each identifying a + * method name to add. + * @return None. + * @deffunc void ap_allow_methods(request_rec *r, int reset, ...) + */ +AP_DECLARE(void) ap_allow_methods(request_rec *r, int reset, ...); + +/** + * Add one or more methods to the list permitted to access the resource. + * Usually executed by the content handler before the response header is + * sent, but sometimes invoked at an earlier phase if a module knows it + * can set the list authoritatively. Note that the methods are ADDED + * to any already permitted unless the reset flag is non-zero. The + * list is used to generate the Allow response header field when it + * is needed. + * @param r The pointer to the request identifying the resource. + * @param reset Boolean flag indicating whether this list should + * completely replace any current settings. + * @param ... A list of method identifiers, from the "M_" series + * defined in httpd.h, terminated with a value of -1 + * (e.g., "M_GET, M_POST, M_OPTIONS, -1") + * @return None. + * @deffunc void ap_allow_standard_methods(request_rec *r, int reset, ...) + */ +AP_DECLARE(void) ap_allow_standard_methods(request_rec *r, int reset, ...); + +#define MERGE_ALLOW 0 +#define REPLACE_ALLOW 1 + +#ifdef CORE_PRIVATE +/* Function called by main.c to handle first-level request */ +void ap_process_request(request_rec *); +/** + * Kill the current request + * @param type Why the request is dieing + * @param r The current request + * @deffunc void ap_die(int type, request_rec *r) + */ +AP_DECLARE(void) ap_die(int type, request_rec *r); +#endif + +/* Hooks */ + +/** + * Gives modules a chance to create their request_config entry when the + * request is created. + * @param r The current request + * @ingroup hooks + */ +AP_DECLARE_HOOK(int,create_request,(request_rec *r)) + +/** + * This hook allow modules an opportunity to translate the URI into an + * actual filename. If no modules do anything special, the server's default + * rules will be followed. + * @param r The current request + * @return OK, DECLINED, or HTTP_... + * @ingroup hooks + */ +AP_DECLARE_HOOK(int,translate_name,(request_rec *r)) + +/** + * This hook allow modules to set the per_dir_config based on their own + * context (such as <Proxy > sections) and responds to contextless requests + * such as TRACE that need no security or filesystem mapping. + * based on the filesystem. + * @param r The current request + * @return DONE (or HTTP_) if this contextless request was just fulfilled + * (such as TRACE), OK if this is not a file, and DECLINED if this is a file. + * The core map_to_storage (HOOK_RUN_REALLY_LAST) will directory_walk + * and file_walk the r->filename. + * + * @ingroup hooks + */ +AP_DECLARE_HOOK(int,map_to_storage,(request_rec *r)) + +/** + * This hook is used to analyze the request headers, authenticate the user, + * and set the user information in the request record (r->user and + * r->ap_auth_type). This hook is only run when Apache determines that + * authentication/authorization is required for this resource (as determined + * by the 'Require' directive). It runs after the access_checker hook, and + * before the auth_checker hook. + * + * @param r The current request + * @return OK, DECLINED, or HTTP_... + * @ingroup hooks + */ +AP_DECLARE_HOOK(int,check_user_id,(request_rec *r)) + +/** + * Allows modules to perform module-specific fixing of header fields. This + * is invoked just before any content-handler + * @param r The current request + * @return OK, DECLINED, or HTTP_... + * @ingroup hooks + */ +AP_DECLARE_HOOK(int,fixups,(request_rec *r)) + +/** + * This routine is called to determine and/or set the various document type + * information bits, like Content-type (via r->content_type), language, et + * cetera. + * @param r the current request + * @return OK, DECLINED, or HTTP_... + * @ingroup hooks + */ +AP_DECLARE_HOOK(int,type_checker,(request_rec *r)) + +/** + * This hook is used to apply additional access control to this resource. + * It runs *before* a user is authenticated, so this hook is really to + * apply additional restrictions independent of a user. It also runs + * independent of 'Require' directive usage. + * + * @param r the current request + * @return OK, DECLINED, or HTTP_... + * @ingroup hooks + */ +AP_DECLARE_HOOK(int,access_checker,(request_rec *r)) + +/** + * This hook is used to check to see if the resource being requested + * is available for the authenticated user (r->user and r->ap_auth_type). + * It runs after the access_checker and check_user_id hooks. Note that + * it will *only* be called if Apache determines that access control has + * been applied to this resource (through a 'Require' directive). + * + * @param r the current request + * @return OK, DECLINED, or HTTP_... + * @ingroup hooks + */ +AP_DECLARE_HOOK(int,auth_checker,(request_rec *r)) + +/** + * This hook allows modules to insert filters for the current request + * @param r the current request + * @ingroup hooks + */ +AP_DECLARE_HOOK(void,insert_filter,(request_rec *r)) + +AP_DECLARE(int) ap_location_walk(request_rec *r); +AP_DECLARE(int) ap_directory_walk(request_rec *r); +AP_DECLARE(int) ap_file_walk(request_rec *r); + +#ifdef __cplusplus +} +#endif + +#endif /* !APACHE_HTTP_REQUEST_H */ diff --git a/rubbos/app/httpd-2.0.64/include/http_vhost.h b/rubbos/app/httpd-2.0.64/include/http_vhost.h new file mode 100644 index 00000000..1acfd95f --- /dev/null +++ b/rubbos/app/httpd-2.0.64/include/http_vhost.h @@ -0,0 +1,109 @@ +/* Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef APACHE_HTTP_VHOST_H +#define APACHE_HTTP_VHOST_H + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @package Virtual Host package + */ + +/** + * called before any config is read + * @param p Pool to allocate out of + */ +AP_DECLARE(void) ap_init_vhost_config(apr_pool_t *p); + +/** + * called after the config has been read to compile the tables needed to do + * the run-time vhost lookups + * @param p The pool to allocate out of + * @param main_server The start of the virtual host list + * @deffunc ap_fini_vhost_config(apr_pool_t *p, server_rec *main_server) + */ +AP_DECLARE(void) ap_fini_vhost_config(apr_pool_t *p, server_rec *main_server); + +/** + * handle addresses in <VirtualHost> statement + * @param p The pool to allocate out of + * @param hostname The hostname in the VirtualHost statement + * @param s The list of Virtual Hosts. + */ +const char *ap_parse_vhost_addrs(apr_pool_t *p, const char *hostname, server_rec *s); + +/* handle NameVirtualHost directive */ +const char *ap_set_name_virtual_host (cmd_parms *cmd, void *dummy, + const char *arg); + +/** + * Callback function for every Name Based Virtual Host. + * @param baton Opaque user object + * @param conn The current Connection + * @param s The current Server + * @see ap_vhost_iterate_given_conn + * @return 0 on success, any non-zero return will stop the iteration. + */ +typedef int(*ap_vhost_iterate_conn_cb)(void* baton, conn_rec* conn, server_rec* s); + +/** + * For every virtual host on this connection, call func_cb. + * @param conn The current connection + * @param func_cb Function called for every Name Based Virtual Host for this + * connection. + * @param baton Opaque object passed to func_cb. + * @return The return value from func_cb. + * @note If func_cb returns non-zero, the function will return at this point, + * and not continue iterating the virtual hosts. + */ +AP_DECLARE(int) ap_vhost_iterate_given_conn(conn_rec *conn, + ap_vhost_iterate_conn_cb func_cb, + void* baton); + +/** + * given an ip address only, give our best guess as to what vhost it is + * @param conn The current connection + */ +AP_DECLARE(void) ap_update_vhost_given_ip(conn_rec *conn); + +/** + * ap_update_vhost_given_ip is never enough, and this is always called after + * the headers have been read. It may change r->server. + * @param r The current request + */ +AP_DECLARE(void) ap_update_vhost_from_headers(request_rec *r); + +/** + * Match the host in the header with the hostname of the server for this + * request. + * @param r The current request + * @param host The hostname in the headers + * @param port The port from the headers + * @return return 1 if the host:port matches any of the aliases of r->server, + * return 0 otherwise + * @deffunc int ap_matches_request_vhost(request_rec *r, const char *host, apr_port_t port) + */ +AP_DECLARE(int) ap_matches_request_vhost(request_rec *r, const char *host, + apr_port_t port); + +#ifdef __cplusplus +} +#endif + +#endif /* !APACHE_HTTP_VHOST_H */ diff --git a/rubbos/app/httpd-2.0.64/include/httpd.h b/rubbos/app/httpd-2.0.64/include/httpd.h new file mode 100644 index 00000000..4ad2df22 --- /dev/null +++ b/rubbos/app/httpd-2.0.64/include/httpd.h @@ -0,0 +1,1760 @@ +/* Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef APACHE_HTTPD_H +#define APACHE_HTTPD_H + +/** + * @file httpd.h + * @brief HTTP Daemon routines + */ + +/* XXX - We need to push more stuff to other .h files, or even .c files, to + * make this file smaller + */ + +/* Headers in which EVERYONE has an interest... */ +#include "ap_config.h" +#include "ap_mmn.h" + +#include "ap_release.h" + +#include "apr_general.h" +#include "apr_tables.h" +#include "apr_pools.h" +#include "apr_time.h" +#include "apr_network_io.h" +#include "apr_buckets.h" + +#include "os.h" + +#include "pcreposix.h" + +/* Note: util_uri.h is also included, see below */ + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef CORE_PRIVATE + +/* ----------------------------- config dir ------------------------------ */ + +/* Define this to be the default server home dir. Most things later in this + * file with a relative pathname will have this added. + */ +#ifndef HTTPD_ROOT +#ifdef OS2 +/* Set default for OS/2 file system */ +#define HTTPD_ROOT "/os2httpd" +#elif defined(WIN32) +/* Set default for Windows file system */ +#define HTTPD_ROOT "/apache" +#elif defined (BEOS) +/* Set the default for BeOS */ +#define HTTPD_ROOT "/boot/home/apache" +#elif defined (NETWARE) +/* Set the default for NetWare */ +#define HTTPD_ROOT "/apache" +#else +#define HTTPD_ROOT "/usr/local/apache" +#endif +#endif /* HTTPD_ROOT */ + +/* + * --------- You shouldn't have to edit anything below this line ---------- + * + * Any modifications to any defaults not defined above should be done in the + * respective configuration file. + * + */ + +/* Default location of documents. Can be overridden by the DocumentRoot + * directive. + */ +#ifndef DOCUMENT_LOCATION +#ifdef OS2 +/* Set default for OS/2 file system */ +#define DOCUMENT_LOCATION HTTPD_ROOT "/docs" +#else +#define DOCUMENT_LOCATION HTTPD_ROOT "/htdocs" +#endif +#endif /* DOCUMENT_LOCATION */ + +/* Maximum number of dynamically loaded modules */ +#ifndef DYNAMIC_MODULE_LIMIT +#define DYNAMIC_MODULE_LIMIT 64 +#endif + +/* Default administrator's address */ +#define DEFAULT_ADMIN "[no address given]" + +/* The name of the log files */ +#ifndef DEFAULT_ERRORLOG +#if defined(OS2) || defined(WIN32) +#define DEFAULT_ERRORLOG "logs/error.log" +#else +#define DEFAULT_ERRORLOG "logs/error_log" +#endif +#endif /* DEFAULT_ERRORLOG */ + +/* Define this to be what your per-directory security files are called */ +#ifndef DEFAULT_ACCESS_FNAME +#ifdef OS2 +/* Set default for OS/2 file system */ +#define DEFAULT_ACCESS_FNAME "htaccess" +#else +#define DEFAULT_ACCESS_FNAME ".htaccess" +#endif +#endif /* DEFAULT_ACCESS_FNAME */ + +/* The name of the server config file */ +#ifndef SERVER_CONFIG_FILE +#define SERVER_CONFIG_FILE "conf/httpd.conf" +#endif + +/* Whether we should enable rfc1413 identity checking */ +#ifndef DEFAULT_RFC1413 +#define DEFAULT_RFC1413 0 +#endif + +/* The default path for CGI scripts if none is currently set */ +#ifndef DEFAULT_PATH +#define DEFAULT_PATH "/bin:/usr/bin:/usr/ucb:/usr/bsd:/usr/local/bin" +#endif + +/* The path to the suExec wrapper, can be overridden in Configuration */ +#ifndef SUEXEC_BIN +#define SUEXEC_BIN HTTPD_ROOT "/bin/suexec" +#endif + +/* The timeout for waiting for messages */ +#ifndef DEFAULT_TIMEOUT +#define DEFAULT_TIMEOUT 300 +#endif + +/* The timeout for waiting for keepalive timeout until next request */ +#ifndef DEFAULT_KEEPALIVE_TIMEOUT +#define DEFAULT_KEEPALIVE_TIMEOUT 15 +#endif + +/* The number of requests to entertain per connection */ +#ifndef DEFAULT_KEEPALIVE +#define DEFAULT_KEEPALIVE 100 +#endif + +/* Limits on the size of various request items. These limits primarily + * exist to prevent simple denial-of-service attacks on a server based + * on misuse of the protocol. The recommended values will depend on the + * nature of the server resources -- CGI scripts and database backends + * might require large values, but most servers could get by with much + * smaller limits than we use below. The request message body size can + * be limited by the per-dir config directive LimitRequestBody. + * + * Internal buffer sizes are two bytes more than the DEFAULT_LIMIT_REQUEST_LINE + * and DEFAULT_LIMIT_REQUEST_FIELDSIZE below, which explains the 8190. + * These two limits can be lowered (but not raised) by the server config + * directives LimitRequestLine and LimitRequestFieldsize, respectively. + * + * DEFAULT_LIMIT_REQUEST_FIELDS can be modified or disabled (set = 0) by + * the server config directive LimitRequestFields. + */ +#ifndef DEFAULT_LIMIT_REQUEST_LINE +#define DEFAULT_LIMIT_REQUEST_LINE 8190 +#endif /* default limit on bytes in Request-Line (Method+URI+HTTP-version) */ +#ifndef DEFAULT_LIMIT_REQUEST_FIELDSIZE +#define DEFAULT_LIMIT_REQUEST_FIELDSIZE 8190 +#endif /* default limit on bytes in any one header field */ +#ifndef DEFAULT_LIMIT_REQUEST_FIELDS +#define DEFAULT_LIMIT_REQUEST_FIELDS 100 +#endif /* default limit on number of request header fields */ + + +/** + * The default default character set name to add if AddDefaultCharset is + * enabled. Overridden with AddDefaultCharsetName. + */ +#define DEFAULT_ADD_DEFAULT_CHARSET_NAME "iso-8859-1" + +#endif /* CORE_PRIVATE */ + +/** default HTTP Server protocol */ +#define AP_SERVER_PROTOCOL "HTTP/1.1" + + +/* ------------------ stuff that modules are allowed to look at ----------- */ + +/** Define this to be what your HTML directory content files are called */ +#ifndef AP_DEFAULT_INDEX +#define AP_DEFAULT_INDEX "index.html" +#endif + + +/** + * Define this to be what type you'd like returned for files with unknown + * suffixes. + * @warning MUST be all lower case. + */ +#ifndef DEFAULT_CONTENT_TYPE +#define DEFAULT_CONTENT_TYPE "text/plain" +#endif + +/** The name of the MIME types file */ +#ifndef AP_TYPES_CONFIG_FILE +#define AP_TYPES_CONFIG_FILE "conf/mime.types" +#endif + +/* + * Define the HTML doctype strings centrally. + */ +/** HTML 2.0 Doctype */ +#define DOCTYPE_HTML_2_0 "<!DOCTYPE HTML PUBLIC \"-//IETF//" \ + "DTD HTML 2.0//EN\">\n" +/** HTML 3.2 Doctype */ +#define DOCTYPE_HTML_3_2 "<!DOCTYPE HTML PUBLIC \"-//W3C//" \ + "DTD HTML 3.2 Final//EN\">\n" +/** HTML 4.0 Strict Doctype */ +#define DOCTYPE_HTML_4_0S "<!DOCTYPE HTML PUBLIC \"-//W3C//" \ + "DTD HTML 4.0//EN\"\n" \ + "\"http://www.w3.org/TR/REC-html40/strict.dtd\">\n" +/** HTML 4.0 Transitional Doctype */ +#define DOCTYPE_HTML_4_0T "<!DOCTYPE HTML PUBLIC \"-//W3C//" \ + "DTD HTML 4.0 Transitional//EN\"\n" \ + "\"http://www.w3.org/TR/REC-html40/loose.dtd\">\n" +/** HTML 4.0 Frameset Doctype */ +#define DOCTYPE_HTML_4_0F "<!DOCTYPE HTML PUBLIC \"-//W3C//" \ + "DTD HTML 4.0 Frameset//EN\"\n" \ + "\"http://www.w3.org/TR/REC-html40/frameset.dtd\">\n" +/** XHTML 1.0 Strict Doctype */ +#define DOCTYPE_XHTML_1_0S "<!DOCTYPE html PUBLIC \"-//W3C//" \ + "DTD XHTML 1.0 Strict//EN\"\n" \ + "\"http://www.w3.org/TR/xhtml1/DTD/" \ + "xhtml1-strict.dtd\">\n" +/** XHTML 1.0 Transitional Doctype */ +#define DOCTYPE_XHTML_1_0T "<!DOCTYPE html PUBLIC \"-//W3C//" \ + "DTD XHTML 1.0 Transitional//EN\"\n" \ + "\"http://www.w3.org/TR/xhtml1/DTD/" \ + "xhtml1-transitional.dtd\">\n" +/** XHTML 1.0 Frameset Doctype */ +#define DOCTYPE_XHTML_1_0F "<!DOCTYPE html PUBLIC \"-//W3C//" \ + "DTD XHTML 1.0 Frameset//EN\"\n" \ + "\"http://www.w3.org/TR/xhtml1/DTD/" \ + "xhtml1-frameset.dtd\">" + +/** Internal representation for a HTTP protocol number, e.g., HTTP/1.1 */ + +#define HTTP_VERSION(major,minor) (1000*(major)+(minor)) +/** Major part of HTTP protocol */ +#define HTTP_VERSION_MAJOR(number) ((number)/1000) +/** Minor part of HTTP protocol */ +#define HTTP_VERSION_MINOR(number) ((number)%1000) + +/* -------------- Port number for server running standalone --------------- */ + +/** default HTTP Port */ +#define DEFAULT_HTTP_PORT 80 +/** default HTTPS Port */ +#define DEFAULT_HTTPS_PORT 443 +/** + * Check whether @a port is the default port for the request @a r. + * @param port The port number + * @param r The request + * @see #ap_default_port + */ +#define ap_is_default_port(port,r) ((port) == ap_default_port(r)) +/** + * Get the default port for a request (which depends on the scheme). + * @param r The request + */ +#define ap_default_port(r) ap_run_default_port(r) +/** + * Get the scheme for a request. + * @param r The request + * @bug This should be called ap_http_scheme! + */ +#define ap_http_method(r) ap_run_http_method(r) + +/** The default string lengths */ +#define MAX_STRING_LEN HUGE_STRING_LEN +#define HUGE_STRING_LEN 8192 + +/** The size of the server's internal read-write buffers */ +#define AP_IOBUFSIZE 8192 + +/** The max number of regex captures that can be expanded by ap_pregsub */ +#define AP_MAX_REG_MATCH 10 + +/** + * APR_HAS_LARGE_FILES introduces the problem of spliting sendfile into + * mutiple buckets, no greater than MAX(apr_size_t), and more granular + * than that in case the brigade code/filters attempt to read it directly. + * ### 16mb is an invention, no idea if it is reasonable. + */ +#define AP_MAX_SENDFILE 16777216 /* 2^24 */ + +/** + * Special Apache error codes. These are basically used + * in http_main.c so we can keep track of various errors. + * + */ +/** a normal exit */ +#define APEXIT_OK 0x0 +/** A fatal error arising during the server's init sequence */ +#define APEXIT_INIT 0x2 +/** The child died during its init sequence */ +#define APEXIT_CHILDINIT 0x3 +/** + * The child exited due to a resource shortage. + * The parent should limit the rate of forking until + * the situation is resolved. + */ +#define APEXIT_CHILDSICK 0x7 +/** + * A fatal error, resulting in the whole server aborting. + * If a child exits with this error, the parent process + * considers this a server-wide fatal error and aborts. + */ +#define APEXIT_CHILDFATAL 0xf + +#ifndef AP_DECLARE +/** + * Stuff marked #AP_DECLARE is part of the API, and intended for use + * by modules. Its purpose is to allow us to add attributes that + * particular platforms or compilers require to every exported function. + */ +# define AP_DECLARE(type) type +#endif + +#ifndef AP_DECLARE_NONSTD +/** + * Stuff marked #AP_DECLARE_NONSTD is part of the API, and intended for + * use by modules. The difference between #AP_DECLARE and + * #AP_DECLARE_NONSTD is that the latter is required for any functions + * which use varargs or are used via indirect function call. This + * is to accomodate the two calling conventions in windows dlls. + */ +# define AP_DECLARE_NONSTD(type) type +#endif +#ifndef AP_DECLARE_DATA +# define AP_DECLARE_DATA +#endif + +#ifndef AP_MODULE_DECLARE +# define AP_MODULE_DECLARE(type) type +#endif +#ifndef AP_MODULE_DECLARE_NONSTD +# define AP_MODULE_DECLARE_NONSTD(type) type +#endif +#ifndef AP_MODULE_DECLARE_DATA +# define AP_MODULE_DECLARE_DATA +#endif + +/** + * @internal + * modules should not used functions marked AP_CORE_DECLARE + */ +#ifndef AP_CORE_DECLARE +# define AP_CORE_DECLARE AP_DECLARE +#endif +/** + * @internal + * modules should not used functions marked AP_CORE_DECLARE_NONSTD + */ + +#ifndef AP_CORE_DECLARE_NONSTD +# define AP_CORE_DECLARE_NONSTD AP_DECLARE_NONSTD +#endif + +/** + * The numeric version information is broken out into fields within this + * structure. + */ +typedef struct { + int major; /**< major number */ + int minor; /**< minor number */ + int patch; /**< patch number */ + const char *add_string; /**< additional string like "-dev" */ +} ap_version_t; + +/** + * Return httpd's version information in a numeric form. + * + * @param version Pointer to a version structure for returning the version + * information. + */ +AP_DECLARE(void) ap_get_server_revision(ap_version_t *version); + +/** + * Get the server version string + * @return The server version string + */ +AP_DECLARE(const char *) ap_get_server_version(void); + +/** + * Add a component to the version string + * @param pconf The pool to allocate the component from + * @param component The string to add + */ +AP_DECLARE(void) ap_add_version_component(apr_pool_t *pconf, const char *component); + +/** + * Get the date a time that the server was built + * @return The server build time string + */ +AP_DECLARE(const char *) ap_get_server_built(void); + +#define DECLINED -1 /**< Module declines to handle */ +#define DONE -2 /**< Module has served the response completely + * - it's safe to die() with no more output + */ +#define OK 0 /**< Module has handled this stage. */ + + +/** + * @defgroup HTTP_Status HTTP Status Codes + * @{ + */ +/** + * The size of the static array in http_protocol.c for storing + * all of the potential response status-lines (a sparse table). + * A future version should dynamically generate the apr_table_t at startup. + */ +#define RESPONSE_CODES 57 + +#define HTTP_CONTINUE 100 +#define HTTP_SWITCHING_PROTOCOLS 101 +#define HTTP_PROCESSING 102 +#define HTTP_OK 200 +#define HTTP_CREATED 201 +#define HTTP_ACCEPTED 202 +#define HTTP_NON_AUTHORITATIVE 203 +#define HTTP_NO_CONTENT 204 +#define HTTP_RESET_CONTENT 205 +#define HTTP_PARTIAL_CONTENT 206 +#define HTTP_MULTI_STATUS 207 +#define HTTP_MULTIPLE_CHOICES 300 +#define HTTP_MOVED_PERMANENTLY 301 +#define HTTP_MOVED_TEMPORARILY 302 +#define HTTP_SEE_OTHER 303 +#define HTTP_NOT_MODIFIED 304 +#define HTTP_USE_PROXY 305 +#define HTTP_TEMPORARY_REDIRECT 307 +#define HTTP_BAD_REQUEST 400 +#define HTTP_UNAUTHORIZED 401 +#define HTTP_PAYMENT_REQUIRED 402 +#define HTTP_FORBIDDEN 403 +#define HTTP_NOT_FOUND 404 +#define HTTP_METHOD_NOT_ALLOWED 405 +#define HTTP_NOT_ACCEPTABLE 406 +#define HTTP_PROXY_AUTHENTICATION_REQUIRED 407 +#define HTTP_REQUEST_TIME_OUT 408 +#define HTTP_CONFLICT 409 +#define HTTP_GONE 410 +#define HTTP_LENGTH_REQUIRED 411 +#define HTTP_PRECONDITION_FAILED 412 +#define HTTP_REQUEST_ENTITY_TOO_LARGE 413 +#define HTTP_REQUEST_URI_TOO_LARGE 414 +#define HTTP_UNSUPPORTED_MEDIA_TYPE 415 +#define HTTP_RANGE_NOT_SATISFIABLE 416 +#define HTTP_EXPECTATION_FAILED 417 +#define HTTP_UNPROCESSABLE_ENTITY 422 +#define HTTP_LOCKED 423 +#define HTTP_FAILED_DEPENDENCY 424 +#define HTTP_UPGRADE_REQUIRED 426 +#define HTTP_INTERNAL_SERVER_ERROR 500 +#define HTTP_NOT_IMPLEMENTED 501 +#define HTTP_BAD_GATEWAY 502 +#define HTTP_SERVICE_UNAVAILABLE 503 +#define HTTP_GATEWAY_TIME_OUT 504 +#define HTTP_VERSION_NOT_SUPPORTED 505 +#define HTTP_VARIANT_ALSO_VARIES 506 +#define HTTP_INSUFFICIENT_STORAGE 507 +#define HTTP_NOT_EXTENDED 510 + +/** is the status code informational */ +#define ap_is_HTTP_INFO(x) (((x) >= 100)&&((x) < 200)) +/** is the status code OK ?*/ +#define ap_is_HTTP_SUCCESS(x) (((x) >= 200)&&((x) < 300)) +/** is the status code a redirect */ +#define ap_is_HTTP_REDIRECT(x) (((x) >= 300)&&((x) < 400)) +/** is the status code a error (client or server) */ +#define ap_is_HTTP_ERROR(x) (((x) >= 400)&&((x) < 600)) +/** is the status code a client error */ +#define ap_is_HTTP_CLIENT_ERROR(x) (((x) >= 400)&&((x) < 500)) +/** is the status code a server error */ +#define ap_is_HTTP_SERVER_ERROR(x) (((x) >= 500)&&((x) < 600)) + +/** should the status code drop the connection */ +#define ap_status_drops_connection(x) \ + (((x) == HTTP_BAD_REQUEST) || \ + ((x) == HTTP_REQUEST_TIME_OUT) || \ + ((x) == HTTP_LENGTH_REQUIRED) || \ + ((x) == HTTP_REQUEST_ENTITY_TOO_LARGE) || \ + ((x) == HTTP_REQUEST_URI_TOO_LARGE) || \ + ((x) == HTTP_INTERNAL_SERVER_ERROR) || \ + ((x) == HTTP_SERVICE_UNAVAILABLE) || \ + ((x) == HTTP_NOT_IMPLEMENTED)) +/** @} */ +/** + * @defgroup Methods List of Methods recognized by the server + * @{ + */ +/** + * Methods recognized (but not necessarily handled) by the server. + * These constants are used in bit shifting masks of size int, so it is + * unsafe to have more methods than bits in an int. HEAD == M_GET. + * This list must be tracked by the list in http_protocol.c in routine + * ap_method_name_of(). + */ +#define M_GET 0 /* RFC 2616: HTTP */ +#define M_PUT 1 /* : */ +#define M_POST 2 +#define M_DELETE 3 +#define M_CONNECT 4 +#define M_OPTIONS 5 +#define M_TRACE 6 /* RFC 2616: HTTP */ +#define M_PATCH 7 /* no rfc(!) ### remove this one? */ +#define M_PROPFIND 8 /* RFC 2518: WebDAV */ +#define M_PROPPATCH 9 /* : */ +#define M_MKCOL 10 +#define M_COPY 11 +#define M_MOVE 12 +#define M_LOCK 13 +#define M_UNLOCK 14 /* RFC 2518: WebDAV */ +#define M_VERSION_CONTROL 15 /* RFC 3253: WebDAV Versioning */ +#define M_CHECKOUT 16 /* : */ +#define M_UNCHECKOUT 17 +#define M_CHECKIN 18 +#define M_UPDATE 19 +#define M_LABEL 20 +#define M_REPORT 21 +#define M_MKWORKSPACE 22 +#define M_MKACTIVITY 23 +#define M_BASELINE_CONTROL 24 +#define M_MERGE 25 +#define M_INVALID 26 /* RFC 3253: WebDAV Versioning */ + +/** + * METHODS needs to be equal to the number of bits + * we are using for limit masks. + */ +#define METHODS 64 + +/** + * The method mask bit to shift for anding with a bitmask. + */ +#define AP_METHOD_BIT ((apr_int64_t)1) +/** @} */ + + +/** + * Structure for handling HTTP methods. Methods known to the server are + * accessed via a bitmask shortcut; extension methods are handled by + * an array. + */ +typedef struct ap_method_list_t ap_method_list_t; +struct ap_method_list_t { + /* The bitmask used for known methods */ + apr_int64_t method_mask; + /* the array used for extension methods */ + apr_array_header_t *method_list; +}; +/** + * @defgroup module_magic Module Magic mime types + * @{ + */ +/** Magic for mod_cgi[d] */ +#define CGI_MAGIC_TYPE "application/x-httpd-cgi" +/** Magic for mod_include */ +#define INCLUDES_MAGIC_TYPE "text/x-server-parsed-html" +/** Magic for mod_include */ +#define INCLUDES_MAGIC_TYPE3 "text/x-server-parsed-html3" +/** Magic for mod_dir */ +#define DIR_MAGIC_TYPE "httpd/unix-directory" + +/** @} */ +/* Just in case your linefeed isn't the one the other end is expecting. */ +#if !APR_CHARSET_EBCDIC +/** linefeed */ +#define LF 10 +/** carrige return */ +#define CR 13 +/** carrige return /Line Feed Combo */ +#define CRLF "\015\012" +#else /* APR_CHARSET_EBCDIC */ +/* For platforms using the EBCDIC charset, the transition ASCII->EBCDIC is done + * in the buff package (bread/bputs/bwrite). Everywhere else, we use + * "native EBCDIC" CR and NL characters. These are therefore + * defined as + * '\r' and '\n'. + */ +#define CR '\r' +#define LF '\n' +#define CRLF "\r\n" +#endif /* APR_CHARSET_EBCDIC */ + +/** + * @defgroup values_request_rec_body Possible values for request_rec.read_body + * @{ + * Possible values for request_rec.read_body (set by handling module): + */ + +/** Send 413 error if message has any body */ +#define REQUEST_NO_BODY 0 +/** Send 411 error if body without Content-Length */ +#define REQUEST_CHUNKED_ERROR 1 +/** If chunked, remove the chunks for me. */ +#define REQUEST_CHUNKED_DECHUNK 2 +/** @} */ + +/** + * @defgroup values_request_rec_used_path_info Possible values for request_rec.used_path_info + * @{ + * Possible values for request_rec.used_path_info: + */ + +/** Accept the path_info from the request */ +#define AP_REQ_ACCEPT_PATH_INFO 0 +/** Return a 404 error if path_info was given */ +#define AP_REQ_REJECT_PATH_INFO 1 +/** Module may chose to use the given path_info */ +#define AP_REQ_DEFAULT_PATH_INFO 2 +/** @} */ + +/* + * Things which may vary per file-lookup WITHIN a request --- + * e.g., state of MIME config. Basically, the name of an object, info + * about the object, and any other info we may ahve which may need to + * change as we go poking around looking for it (e.g., overridden by + * .htaccess files). + * + * Note how the default state of almost all these things is properly + * zero, so that allocating it with pcalloc does the right thing without + * a whole lot of hairy initialization... so long as we are willing to + * make the (fairly) portable assumption that the bit pattern of a NULL + * pointer is, in fact, zero. + */ + +/** + * This represents the result of calling htaccess; these are cached for + * each request. + */ +struct htaccess_result { + /** the directory to which this applies */ + const char *dir; + /** the overrides allowed for the .htaccess file */ + int override; + /** the configuration directives */ + struct ap_conf_vector_t *htaccess; + /** the next one, or NULL if no more; N.B. never change this */ + const struct htaccess_result *next; +}; + +/* The following four types define a hierarchy of activities, so that + * given a request_rec r you can write r->connection->server->process + * to get to the process_rec. While this reduces substantially the + * number of arguments that various hooks require beware that in + * threaded versions of the server you must consider multiplexing + * issues. */ + + +/** A structure that represents one process */ +typedef struct process_rec process_rec; +/** A structure that represents a virtual server */ +typedef struct server_rec server_rec; +/** A structure that represents one connection */ +typedef struct conn_rec conn_rec; +/** A structure that represents the current request */ +typedef struct request_rec request_rec; + +/* ### would be nice to not include this from httpd.h ... */ +/* This comes after we have defined the request_rec type */ +#include "apr_uri.h" + +/** A structure that represents one process */ +struct process_rec { + /** Global pool. Cleared upon normal exit */ + apr_pool_t *pool; + /** Configuration pool. Cleared upon restart */ + apr_pool_t *pconf; + /** Number of command line arguments passed to the program */ + int argc; + /** The command line arguments */ + const char * const *argv; + /** The program name used to execute the program */ + const char *short_name; +}; + +/** A structure that represents the current request */ +struct request_rec { + /** The pool associated with the request */ + apr_pool_t *pool; + /** The connection to the client */ + conn_rec *connection; + /** The virtual host for this request */ + server_rec *server; + + /** Pointer to the redirected request if this is an external redirect */ + request_rec *next; + /** Pointer to the previous request if this is an internal redirect */ + request_rec *prev; + + /** Pointer to the main request if this is a sub-request + * (see http_request.h) */ + request_rec *main; + + /* Info about the request itself... we begin with stuff that only + * protocol.c should ever touch... + */ + /** First line of request */ + char *the_request; + /** HTTP/0.9, "simple" request (e.g. GET /foo\n w/no headers) */ + int assbackwards; + /** A proxy request (calculated during post_read_request/translate_name) + * possible values PROXYREQ_NONE, PROXYREQ_PROXY, PROXYREQ_REVERSE, + * PROXYREQ_RESPONSE + */ + int proxyreq; + /** HEAD request, as opposed to GET */ + int header_only; + /** Protocol string, as given to us, or HTTP/0.9 */ + char *protocol; + /** Protocol version number of protocol; 1.1 = 1001 */ + int proto_num; + /** Host, as set by full URI or Host: */ + const char *hostname; + + /** Time when the request started */ + apr_time_t request_time; + + /** Status line, if set by script */ + const char *status_line; + /** Status line */ + int status; + + /* Request method, two ways; also, protocol, etc.. Outside of protocol.c, + * look, but don't touch. + */ + + /** Request method (eg. GET, HEAD, POST, etc.) */ + const char *method; + /** M_GET, M_POST, etc. */ + int method_number; + + /** + * 'allowed' is a bitvector of the allowed methods. + * + * A handler must ensure that the request method is one that + * it is capable of handling. Generally modules should DECLINE + * any request methods they do not handle. Prior to aborting the + * handler like this the handler should set r->allowed to the list + * of methods that it is willing to handle. This bitvector is used + * to construct the "Allow:" header required for OPTIONS requests, + * and HTTP_METHOD_NOT_ALLOWED and HTTP_NOT_IMPLEMENTED status codes. + * + * Since the default_handler deals with OPTIONS, all modules can + * usually decline to deal with OPTIONS. TRACE is always allowed, + * modules don't need to set it explicitly. + * + * Since the default_handler will always handle a GET, a + * module which does *not* implement GET should probably return + * HTTP_METHOD_NOT_ALLOWED. Unfortunately this means that a Script GET + * handler can't be installed by mod_actions. + */ + apr_int64_t allowed; + /** Array of extension methods */ + apr_array_header_t *allowed_xmethods; + /** List of allowed methods */ + ap_method_list_t *allowed_methods; + + /** byte count in stream is for body */ + apr_off_t sent_bodyct; + /** body byte count, for easy access */ + apr_off_t bytes_sent; + /** Last modified time of the requested resource */ + apr_time_t mtime; + + /* HTTP/1.1 connection-level features */ + + /** sending chunked transfer-coding */ + int chunked; + /** The Range: header */ + const char *range; + /** The "real" content length */ + apr_off_t clength; + + /** Remaining bytes left to read from the request body */ + apr_off_t remaining; + /** Number of bytes that have been read from the request body */ + apr_off_t read_length; + /** Method for reading the request body + * (eg. REQUEST_CHUNKED_ERROR, REQUEST_NO_BODY, + * REQUEST_CHUNKED_DECHUNK, etc...) */ + int read_body; + /** reading chunked transfer-coding */ + int read_chunked; + /** is client waiting for a 100 response? */ + unsigned expecting_100; + + /* MIME header environments, in and out. Also, an array containing + * environment variables to be passed to subprocesses, so people can + * write modules to add to that environment. + * + * The difference between headers_out and err_headers_out is that the + * latter are printed even on error, and persist across internal redirects + * (so the headers printed for ErrorDocument handlers will have them). + * + * The 'notes' apr_table_t is for notes from one module to another, with no + * other set purpose in mind... + */ + + /** MIME header environment from the request */ + apr_table_t *headers_in; + /** MIME header environment for the response */ + apr_table_t *headers_out; + /** MIME header environment for the response, printed even on errors and + * persist across internal redirects */ + apr_table_t *err_headers_out; + /** Array of environment variables to be used for sub processes */ + apr_table_t *subprocess_env; + /** Notes from one module to another */ + apr_table_t *notes; + + /* content_type, handler, content_encoding, and all content_languages + * MUST be lowercased strings. They may be pointers to static strings; + * they should not be modified in place. + */ + /** The content-type for the current request */ + const char *content_type; /* Break these out --- we dispatch on 'em */ + /** The handler string that we use to call a handler function */ + const char *handler; /* What we *really* dispatch on */ + + /** How to encode the data */ + const char *content_encoding; + /** Array of strings representing the content languages */ + apr_array_header_t *content_languages; + + /** variant list validator (if negotiated) */ + char *vlist_validator; + + /** If an authentication check was made, this gets set to the user name. */ + char *user; + /** If an authentication check was made, this gets set to the auth type. */ + char *ap_auth_type; + + /** This response can not be cached */ + int no_cache; + /** There is no local copy of this response */ + int no_local_copy; + + /* What object is being requested (either directly, or via include + * or content-negotiation mapping). + */ + + /** The URI without any parsing performed */ + char *unparsed_uri; + /** The path portion of the URI, or "/" if no path provided */ + char *uri; + /** The filename on disk corresponding to this response */ + char *filename; + /* XXX: What does this mean? Please define "canonicalize" -aaron */ + /** The true filename, we canonicalize r->filename if these don't match */ + char *canonical_filename; + /** The PATH_INFO extracted from this request */ + char *path_info; + /** The QUERY_ARGS extracted from this request */ + char *args; + /** finfo.protection (st_mode) set to zero if no such file */ + apr_finfo_t finfo; + /** A struct containing the components of URI */ + apr_uri_t parsed_uri; + + /** + * Flag for the handler to accept or reject path_info on + * the current request. All modules should respect the + * AP_REQ_ACCEPT_PATH_INFO and AP_REQ_REJECT_PATH_INFO + * values, while AP_REQ_DEFAULT_PATH_INFO indicates they + * may follow existing conventions. This is set to the + * user's preference upon HOOK_VERY_FIRST of the fixups. + */ + int used_path_info; + + /* Various other config info which may change with .htaccess files + * These are config vectors, with one void* pointer for each module + * (the thing pointed to being the module's business). + */ + + /** Options set in config files, etc. */ + struct ap_conf_vector_t *per_dir_config; + /** Notes on *this* request */ + struct ap_conf_vector_t *request_config; + + /** + * A linked list of the .htaccess configuration directives + * accessed by this request. + * N.B. always add to the head of the list, _never_ to the end. + * that way, a sub request's list can (temporarily) point to a parent's list + */ + const struct htaccess_result *htaccess; + + /** A list of output filters to be used for this request */ + struct ap_filter_t *output_filters; + /** A list of input filters to be used for this request */ + struct ap_filter_t *input_filters; + + /** A list of protocol level output filters to be used for this + * request */ + struct ap_filter_t *proto_output_filters; + /** A list of protocol level input filters to be used for this + * request */ + struct ap_filter_t *proto_input_filters; + + /** A flag to determine if the eos bucket has been sent yet */ + int eos_sent; + +/* Things placed at the end of the record to avoid breaking binary + * compatibility. It would be nice to remember to reorder the entire + * record to improve 64bit alignment the next time we need to break + * binary compatibility for some other reason. + */ +}; + +/** + * @defgroup ProxyReq Proxy request types + * + * Possible values of request_rec->proxyreq. A request could be normal, + * proxied or reverse proxied. Normally proxied and reverse proxied are + * grouped together as just "proxied", but sometimes it's necessary to + * tell the difference between the two, such as for authentication. + * @{ + */ + +#define PROXYREQ_NONE 0 /**< No proxy */ +#define PROXYREQ_PROXY 1 /**< Standard proxy */ +#define PROXYREQ_REVERSE 2 /**< Reverse proxy */ +#define PROXYREQ_RESPONSE 3 /**< Origin response */ + +/* @} */ + +typedef enum { + AP_CONN_UNKNOWN, + AP_CONN_CLOSE, + AP_CONN_KEEPALIVE +} ap_conn_keepalive_e; + +/** Structure to store things which are per connection */ +struct conn_rec { + /** Pool associated with this connection */ + apr_pool_t *pool; + /** Physical vhost this conn came in on */ + server_rec *base_server; + /** used by http_vhost.c */ + void *vhost_lookup_data; + + /* Information about the connection itself */ + /** local address */ + apr_sockaddr_t *local_addr; + /** remote address */ + apr_sockaddr_t *remote_addr; + + /** Client's IP address */ + char *remote_ip; + /** Client's DNS name, if known. NULL if DNS hasn't been checked, + * "" if it has and no address was found. N.B. Only access this though + * get_remote_host() */ + char *remote_host; + /** Only ever set if doing rfc1413 lookups. N.B. Only access this through + * get_remote_logname() */ + char *remote_logname; + + /** Are we still talking? */ + unsigned aborted:1; + + /** Are we going to keep the connection alive for another request? + * @see ap_conn_keepalive_e */ + ap_conn_keepalive_e keepalive; + + /** have we done double-reverse DNS? -1 yes/failure, 0 not yet, + * 1 yes/success */ + signed int double_reverse:2; + + /** How many times have we used it? */ + int keepalives; + /** server IP address */ + char *local_ip; + /** used for ap_get_server_name when UseCanonicalName is set to DNS + * (ignores setting of HostnameLookups) */ + char *local_host; + + /** ID of this connection; unique at any point in time */ + long id; + /** Config vector containing pointers to connections per-server + * config structures. */ + struct ap_conf_vector_t *conn_config; + /** Notes on *this* connection: send note from one module to + * another. must remain valid for all requests on this conn */ + apr_table_t *notes; + /** A list of input filters to be used for this connection */ + struct ap_filter_t *input_filters; + /** A list of output filters to be used for this connection */ + struct ap_filter_t *output_filters; + /** handle to scoreboard information for this connection */ + void *sbh; + /** The bucket allocator to use for all bucket/brigade creations */ + struct apr_bucket_alloc_t *bucket_alloc; +}; + +/* Per-vhost config... */ + +/** + * The address 255.255.255.255, when used as a virtualhost address, + * will become the "default" server when the ip doesn't match other vhosts. + */ +#define DEFAULT_VHOST_ADDR 0xfffffffful + + +/** A structure to be used for Per-vhost config */ +typedef struct server_addr_rec server_addr_rec; +struct server_addr_rec { + /** The next server in the list */ + server_addr_rec *next; + /** The bound address, for this server */ + apr_sockaddr_t *host_addr; + /** The bound port, for this server */ + apr_port_t host_port; + /** The name given in <VirtualHost> */ + char *virthost; +}; + +/** A structure to store information for each virtual server */ +struct server_rec { + /** The process this server is running in */ + process_rec *process; + /** The next server in the list */ + server_rec *next; + + /** The name of the server */ + const char *defn_name; + /** The line of the config file that the server was defined on */ + unsigned defn_line_number; + + /* Contact information */ + + /** The admin's contact information */ + char *server_admin; + /** The server hostname */ + char *server_hostname; + /** for redirects, etc. */ + apr_port_t port; + + /* Log files --- note that transfer log is now in the modules... */ + + /** The name of the error log */ + char *error_fname; + /** A file descriptor that references the error log */ + apr_file_t *error_log; + /** The log level for this server */ + int loglevel; + + /* Module-specific configuration for server, and defaults... */ + + /** true if this is the virtual server */ + int is_virtual; + /** Config vector containing pointers to modules' per-server config + * structures. */ + struct ap_conf_vector_t *module_config; + /** MIME type info, etc., before we start checking per-directory info */ + struct ap_conf_vector_t *lookup_defaults; + + /* Transaction handling */ + + /** I haven't got a clue */ + server_addr_rec *addrs; + /** Timeout, as an apr interval, before we give up */ + apr_interval_time_t timeout; + /** The apr interval we will wait for another request */ + apr_interval_time_t keep_alive_timeout; + /** Maximum requests per connection */ + int keep_alive_max; + /** Use persistent connections? */ + int keep_alive; + + /** Pathname for ServerPath */ + const char *path; + /** Length of path */ + int pathlen; + + /** Normal names for ServerAlias servers */ + apr_array_header_t *names; + /** Wildcarded names for ServerAlias servers */ + apr_array_header_t *wild_names; + + /** limit on size of the HTTP request line */ + int limit_req_line; + /** limit on size of any request header field */ + int limit_req_fieldsize; + /** limit on number of request header fields */ + int limit_req_fields; +}; + +typedef struct core_output_filter_ctx { + apr_bucket_brigade *b; + apr_pool_t *deferred_write_pool; /* subpool of c->pool used for resources + * which may outlive the request + */ +} core_output_filter_ctx_t; + +typedef struct core_filter_ctx { + apr_bucket_brigade *b; + apr_bucket_brigade *tmpbb; +} core_ctx_t; + +typedef struct core_net_rec { + /** Connection to the client */ + apr_socket_t *client_socket; + + /** connection record */ + conn_rec *c; + + core_output_filter_ctx_t *out_ctx; + core_ctx_t *in_ctx; +} core_net_rec; + +/** + * Examine a field value (such as a media-/content-type) string and return + * it sans any parameters; e.g., strip off any ';charset=foo' and the like. + * @param p Pool to allocate memory from + * @param intype The field to examine + * @return A copy of the field minus any parameters + */ +AP_DECLARE(char *) ap_field_noparam(apr_pool_t *p, const char *intype); + +/** + * Convert a time from an integer into a string in a specified format + * @param p The pool to allocate memory from + * @param t The time to convert + * @param fmt The format to use for the conversion + * @param gmt Convert the time for GMT? + * @return The string that represents the specified time + */ +AP_DECLARE(char *) ap_ht_time(apr_pool_t *p, apr_time_t t, const char *fmt, int gmt); + +/* String handling. The *_nc variants allow you to use non-const char **s as + arguments (unfortunately C won't automatically convert a char ** to a const + char **) */ + +/** + * Get the characters until the first occurance of a specified character + * @param p The pool to allocate memory from + * @param line The string to get the characters from + * @param stop The character to stop at + * @return A copy of the characters up to the first stop character + */ +AP_DECLARE(char *) ap_getword(apr_pool_t *p, const char **line, char stop); +/** + * Get the characters until the first occurance of a specified character + * @param p The pool to allocate memory from + * @param line The string to get the characters from + * @param stop The character to stop at + * @return A copy of the characters up to the first stop character + * @note This is the same as ap_getword(), except it doesn't use const char **. + */ +AP_DECLARE(char *) ap_getword_nc(apr_pool_t *p, char **line, char stop); + +/** + * Get the first word from a given string. A word is defined as all characters + * up to the first whitespace. + * @param p The pool to allocate memory from + * @param line The string to traverse + * @return The first word in the line + */ +AP_DECLARE(char *) ap_getword_white(apr_pool_t *p, const char **line); +/** + * Get the first word from a given string. A word is defined as all characters + * up to the first whitespace. + * @param p The pool to allocate memory from + * @param line The string to traverse + * @return The first word in the line + * @note The same as ap_getword_white(), except it doesn't use const char **. + */ +AP_DECLARE(char *) ap_getword_white_nc(apr_pool_t *p, char **line); + +/** + * Get all characters from the first occurance of @a stop to the first '\0' + * @param p The pool to allocate memory from + * @param line The line to traverse + * @param stop The character to start at + * @return A copy of all caracters after the first occurance of the specified + * character + */ +AP_DECLARE(char *) ap_getword_nulls(apr_pool_t *p, const char **line, + char stop); +/** + * Get all characters from the first occurance of @a stop to the first '\0' + * @param p The pool to allocate memory from + * @param line The line to traverse + * @param stop The character to start at + * @return A copy of all caracters after the first occurance of the specified + * character + * @note The same as ap_getword_nulls(), except it doesn't use const char **. + */ +AP_DECLARE(char *) ap_getword_nulls_nc(apr_pool_t *p, char **line, char stop); + +/** + * Get the second word in the string paying attention to quoting + * @param p The pool to allocate from + * @param line The line to traverse + * @return A copy of the string + */ +AP_DECLARE(char *) ap_getword_conf(apr_pool_t *p, const char **line); +/** + * Get the second word in the string paying attention to quoting + * @param p The pool to allocate from + * @param line The line to traverse + * @return A copy of the string + * @note The same as ap_getword_conf(), except it doesn't use const char **. + */ +AP_DECLARE(char *) ap_getword_conf_nc(apr_pool_t *p, char **line); + +/** + * Check a string for any ${ENV} environment variable construct and replace + * each them by the value of that environment variable, if it exists. If the + * environment value does not exist, leave the ${ENV} construct alone; it + * means something else. + * @param p The pool to allocate from + * @param word The string to check + * @return The string with the replaced environment variables + */ +AP_DECLARE(const char *) ap_resolve_env(apr_pool_t *p, const char * word); + +/** + * Size an HTTP header field list item, as separated by a comma. + * @param field The field to size + * @param len The length of the field + * @return The return value is a pointer to the beginning of the non-empty + * list item within the original string (or NULL if there is none) and the + * address of field is shifted to the next non-comma, non-whitespace + * character. len is the length of the item excluding any beginning whitespace. + */ +AP_DECLARE(const char *) ap_size_list_item(const char **field, int *len); + +/** + * Retrieve an HTTP header field list item, as separated by a comma, + * while stripping insignificant whitespace and lowercasing anything not in + * a quoted string or comment. + * @param p The pool to allocate from + * @param field The field to retrieve + * @return The return value is a new string containing the converted list + * item (or NULL if none) and the address pointed to by field is + * shifted to the next non-comma, non-whitespace. + */ +AP_DECLARE(char *) ap_get_list_item(apr_pool_t *p, const char **field); + +/** + * Find an item in canonical form (lowercase, no extra spaces) within + * an HTTP field value list. + * @param p The pool to allocate from + * @param line The field value list to search + * @param tok The token to search for + * @return 1 if found, 0 if not found. + */ +AP_DECLARE(int) ap_find_list_item(apr_pool_t *p, const char *line, const char *tok); + +/** + * Retrieve a token, spacing over it and returning a pointer to + * the first non-white byte afterwards. Note that these tokens + * are delimited by semis and commas and can also be delimited + * by whitespace at the caller's option. + * @param p The pool to allocate from + * @param accept_line The line to retrieve the token from + * @param accept_white Is it delimited by whitespace + * @return the first non-white byte after the token + */ +AP_DECLARE(char *) ap_get_token(apr_pool_t *p, const char **accept_line, int accept_white); + +/** + * Find http tokens, see the definition of token from RFC2068 + * @param p The pool to allocate from + * @param line The line to find the token + * @param tok The token to find + * @return 1 if the token is found, 0 otherwise + */ +AP_DECLARE(int) ap_find_token(apr_pool_t *p, const char *line, const char *tok); + +/** + * find http tokens from the end of the line + * @param p The pool to allocate from + * @param line The line to find the token + * @param tok The token to find + * @return 1 if the token is found, 0 otherwise + */ +AP_DECLARE(int) ap_find_last_token(apr_pool_t *p, const char *line, const char *tok); + +/** + * Check for an Absolute URI syntax + * @param u The string to check + * @return 1 if URI, 0 otherwise + */ +AP_DECLARE(int) ap_is_url(const char *u); + +/** + * Unescape a URL + * @param url The url to unescape + * @return 0 on success, non-zero otherwise + */ +AP_DECLARE(int) ap_unescape_url(char *url); +/** + * Unescape a URL, but leaving %2f (slashes) escaped + * @param url The url to unescape + * @return 0 on success, non-zero otherwise + */ +AP_DECLARE(int) ap_unescape_url_keep2f(char *url); +/** + * Convert all double slashes to single slashes + * @param name The string to convert + */ +AP_DECLARE(void) ap_no2slash(char *name); + +/** + * Remove all ./ and xx/../ substrings from a file name. Also remove + * any leading ../ or /../ substrings. + * @param name the file name to parse + */ +AP_DECLARE(void) ap_getparents(char *name); + +/** + * Escape a path segment, as defined in RFC 1808 + * @param p The pool to allocate from + * @param s The path to convert + * @return The converted URL + */ +AP_DECLARE(char *) ap_escape_path_segment(apr_pool_t *p, const char *s); +/** + * convert an OS path to a URL in an OS dependant way. + * @param p The pool to allocate from + * @param path The path to convert + * @param partial if set, assume that the path will be appended to something + * with a '/' in it (and thus does not prefix "./") + * @return The converted URL + */ +AP_DECLARE(char *) ap_os_escape_path(apr_pool_t *p, const char *path, int partial); +/** @see ap_os_escape_path */ +#define ap_escape_uri(ppool,path) ap_os_escape_path(ppool,path,1) + +/** + * Escape an html string + * @param p The pool to allocate from + * @param s The html to escape + * @return The escaped string + */ +AP_DECLARE(char *) ap_escape_html(apr_pool_t *p, const char *s); + +/** + * Escape a string for logging + * @param p The pool to allocate from + * @param str The string to escape + * @return The escaped string + */ +AP_DECLARE(char *) ap_escape_logitem(apr_pool_t *p, const char *str); + +/** + * Escape a string for logging into the error log (without a pool) + * @param dest The buffer to write to + * @param source The string to escape + * @param buflen The buffer size for the escaped string (including \0) + * @return The len of the escaped string (always < maxlen) + */ +AP_DECLARE(apr_size_t) ap_escape_errorlog_item(char *dest, const char *source, + apr_size_t buflen); + +/** + * Construct a full hostname + * @param p The pool to allocate from + * @param hostname The hostname of the server + * @param port The port the server is running on + * @param r The current request + * @return The server's hostname + */ +AP_DECLARE(char *) ap_construct_server(apr_pool_t *p, const char *hostname, + apr_port_t port, const request_rec *r); +/** + * Escape a shell command + * @param p The pool to allocate from + * @param s The command to escape + * @return The escaped shell command + */ +AP_DECLARE(char *) ap_escape_shell_cmd(apr_pool_t *p, const char *s); + +/** + * Count the number of directories in a path + * @param path The path to count + * @return The number of directories + */ +AP_DECLARE(int) ap_count_dirs(const char *path); + +/** + * Copy at most @a n leading directories of @a s into @a d. @a d + * should be at least as large as @a s plus 1 extra byte + * + * @param d The location to copy to + * @param s The location to copy from + * @param n The number of directories to copy + * @return value is the ever useful pointer to the trailing \0 of d + * @note on platforms with drive letters, n = 0 returns the "/" root, + * whereas n = 1 returns the "d:/" root. On all other platforms, n = 0 + * returns the empty string. */ +AP_DECLARE(char *) ap_make_dirstr_prefix(char *d, const char *s, int n); + +/** + * Return the parent directory name (including trailing /) of the file + * @a s + * @param p The pool to allocate from + * @param s The file to get the parent of + * @return A copy of the file's parent directory + */ +AP_DECLARE(char *) ap_make_dirstr_parent(apr_pool_t *p, const char *s); + +/** + * Given a directory and filename, create a single path from them. This + * function is smart enough to ensure that there is a sinlge '/' between the + * directory and file names + * @param a The pool to allocate from + * @param dir The directory name + * @param f The filename + * @return A copy of the full path + * @tip Never consider using this function if you are dealing with filesystem + * names that need to remain canonical, unless you are merging an apr_dir_read + * path and returned filename. Otherwise, the result is not canonical. + */ +AP_DECLARE(char *) ap_make_full_path(apr_pool_t *a, const char *dir, const char *f); + +/** + * Test if the given path has an an absolute path. + * @param p The pool to allocate from + * @param dir The directory name + * @tip The converse is not necessarily true, some OS's (Win32/OS2/Netware) have + * multiple forms of absolute paths. This only reports if the path is absolute + * in a canonical sense. + */ +AP_DECLARE(int) ap_os_is_path_absolute(apr_pool_t *p, const char *dir); + +/** + * Does the provided string contain wildcard characters? This is useful + * for determining if the string should be passed to strcmp_match or to strcmp. + * The only wildcard characters recognized are '?' and '*' + * @param str The string to check + * @return 1 if the string has wildcards, 0 otherwise + */ +AP_DECLARE(int) ap_is_matchexp(const char *str); + +/** + * Determine if a string matches a patterm containing the wildcards '?' or '*' + * @param str The string to check + * @param expected The pattern to match against + * @return 1 if the two strings match, 0 otherwise + */ +AP_DECLARE(int) ap_strcmp_match(const char *str, const char *expected); +/** + * Determine if a string matches a patterm containing the wildcards '?' or '*', + * ignoring case + * @param str The string to check + * @param expected The pattern to match against + * @return 1 if the two strings match, 0 otherwise + */ +AP_DECLARE(int) ap_strcasecmp_match(const char *str, const char *expected); + +/** + * Find the first occurrence of the substring s2 in s1, regardless of case + * @param s1 The string to search + * @param s2 The substring to search for + * @return A pointer to the beginning of the substring + * @remark See apr_strmatch() for a faster alternative + */ +AP_DECLARE(char *) ap_strcasestr(const char *s1, const char *s2); + +/** + * Return a pointer to the location inside of bigstring immediately after prefix + * @param bigstring The input string + * @param prefix The prefix to strip away + * @return A pointer relative to bigstring after prefix + */ +AP_DECLARE(const char *) ap_stripprefix(const char *bigstring, + const char *prefix); + +/** + * Decode a base64 encoded string into memory allocated from a pool + * @param p The pool to allocate from + * @param bufcoded The encoded string + * @return The decoded string + */ +AP_DECLARE(char *) ap_pbase64decode(apr_pool_t *p, const char *bufcoded); + +/** + * Encode a string into memory allocated from a pool in base 64 format + * @param p The pool to allocate from + * @param strin The plaintext string + * @return The encoded string + */ +AP_DECLARE(char *) ap_pbase64encode(apr_pool_t *p, char *string); + + +/** + * Compile a regular expression to be used later + * @param p The pool to allocate from + * @param pattern the regular expression to compile + * @param cflags The bitwise or of one or more of the following: + * @li #REG_EXTENDED - Use POSIX extended Regular Expressions + * @li #REG_ICASE - Ignore case + * @li #REG_NOSUB - Support for substring addressing of matches + * not required + * @li #REG_NEWLINE - Match-any-character operators don't match new-line + * @return The compiled regular expression + */ +AP_DECLARE(regex_t *) ap_pregcomp(apr_pool_t *p, const char *pattern, + int cflags); + +/** + * Free the memory associated with a compiled regular expression + * @param p The pool the regex was allocated from + * @param reg The regular expression to free + */ +AP_DECLARE(void) ap_pregfree(apr_pool_t *p, regex_t *reg); + +/** + * Match a null-terminated string against a pre-compiled regex. + * @param preg The pre-compiled regex + * @param string The string to match + * @param nmatch Provide information regarding the location of any matches + * @param pmatch Provide information regarding the location of any matches + * @param eflags Bitwise or of any of: + * @li #REG_NOTBOL - match-beginning-of-line operator always + * fails to match + * @li #REG_NOTEOL - match-end-of-line operator always fails to match + * @return 0 for successful match, #REG_NOMATCH otherwise + */ +AP_DECLARE(int) ap_regexec(regex_t *preg, const char *string, + size_t nmatch, regmatch_t pmatch[], int eflags); + +/** + * Return the error code returned by regcomp or regexec into error messages + * @param errcode the error code returned by regexec or regcomp + * @param preg The precompiled regex + * @param errbuf A buffer to store the error in + * @param errbuf_size The size of the buffer + */ +AP_DECLARE(size_t) ap_regerror(int errcode, const regex_t *preg, + char *errbuf, size_t errbuf_size); + +/** + * After performing a successful regex match, you may use this function to + * perform a series of string substitutions based on subexpressions that were + * matched during the call to ap_regexec + * @param p The pool to allocate from + * @param input An arbitrary string containing $1 through $9. These are + * replaced with the corresponding matched sub-expressions + * @param source The string that was originally matched to the regex + * @param nmatch the nmatch returned from ap_pregex + * @param pmatch the pmatch array returned from ap_pregex + */ +AP_DECLARE(char *) ap_pregsub(apr_pool_t *p, const char *input, const char *source, + size_t nmatch, regmatch_t pmatch[]); + +/** + * We want to downcase the type/subtype for comparison purposes + * but nothing else because ;parameter=foo values are case sensitive. + * @param s The content-type to convert to lowercase + */ +AP_DECLARE(void) ap_content_type_tolower(char *s); + +/** + * convert a string to all lowercase + * @param s The string to convert to lowercase + */ +AP_DECLARE(void) ap_str_tolower(char *s); + +/** + * Search a string from left to right for the first occurrence of a + * specific character + * @param str The string to search + * @param c The character to search for + * @return The index of the first occurrence of c in str + */ +AP_DECLARE(int) ap_ind(const char *str, char c); /* Sigh... */ + +/** + * Search a string from right to left for the first occurrence of a + * specific character + * @param str The string to search + * @param c The character to search for + * @return The index of the first occurrence of c in str + */ +AP_DECLARE(int) ap_rind(const char *str, char c); + +/** + * Given a string, replace any bare " with \" . + * @param p The pool to allocate memory from + * @param instring The string to search for " + * @return A copy of the string with escaped quotes + */ +AP_DECLARE(char *) ap_escape_quotes(apr_pool_t *p, const char *instring); + +/* Misc system hackery */ +/** + * Given the name of an object in the file system determine if it is a directory + * @param p The pool to allocate from + * @param name The name of the object to check + * @return 1 if it is a directory, 0 otherwise + */ +AP_DECLARE(int) ap_is_rdirectory(apr_pool_t *p, const char *name); + +/** + * Given the name of an object in the file system determine if it is a directory - this version is symlink aware + * @param p The pool to allocate from + * @param name The name of the object to check + * @return 1 if it is a directory, 0 otherwise + */ +AP_DECLARE(int) ap_is_directory(apr_pool_t *p, const char *name); + +#ifdef _OSD_POSIX +extern const char *os_set_account(apr_pool_t *p, const char *account); +extern int os_init_job_environment(server_rec *s, const char *user_name, int one_process); +#endif /* _OSD_POSIX */ + +/** + * Determine the local host name for the current machine + * @param p The pool to allocate from + * @return A copy of the local host name + */ +char *ap_get_local_host(apr_pool_t *p); + +/** + * Log an assertion to the error log + * @param szExp The assertion that failed + * @param szFile The file the assertion is in + * @param nLine The line the assertion is defined on + */ +AP_DECLARE(void) ap_log_assert(const char *szExp, const char *szFile, int nLine) + __attribute__((noreturn)); + +/** @internal */ +#define ap_assert(exp) ((exp) ? (void)0 : ap_log_assert(#exp,__FILE__,__LINE__)) + +/** + * Redefine assert() to something more useful for an Apache... + * + * Use ap_assert() if the condition should always be checked. + * Use AP_DEBUG_ASSERT() if the condition should only be checked when AP_DEBUG + * is defined. + */ + +#ifdef AP_DEBUG +#define AP_DEBUG_ASSERT(exp) ap_assert(exp) +#else +#define AP_DEBUG_ASSERT(exp) ((void)0) +#endif + +/** + * @defgroup stopsignal flags which indicate places where the sever should stop for debugging. + * @{ + * A set of flags which indicate places where the server should raise(SIGSTOP). + * This is useful for debugging, because you can then attach to that process + * with gdb and continue. This is important in cases where one_process + * debugging isn't possible. + */ +/** stop on a Detach */ +#define SIGSTOP_DETACH 1 +/** stop making a child process */ +#define SIGSTOP_MAKE_CHILD 2 +/** stop spawning a child process */ +#define SIGSTOP_SPAWN_CHILD 4 +/** stop spawning a child process with a piped log */ +#define SIGSTOP_PIPED_LOG_SPAWN 8 +/** stop spawning a CGI child process */ +#define SIGSTOP_CGI_CHILD 16 + +/** Macro to get GDB started */ +#ifdef DEBUG_SIGSTOP +extern int raise_sigstop_flags; +#define RAISE_SIGSTOP(x) do { \ + if (raise_sigstop_flags & SIGSTOP_##x) raise(SIGSTOP);\ + } while (0) +#else +#define RAISE_SIGSTOP(x) +#endif +/** @} */ +/** + * Get HTML describing the address and (optionally) admin of the server. + * @param prefix Text which is prepended to the return value + * @param r The request_rec + * @return HTML describing the server, allocated in @a r's pool. + */ +AP_DECLARE(const char *) ap_psignature(const char *prefix, request_rec *r); + +/** strtoul does not exist on sunos4. */ +#ifdef strtoul +#undef strtoul +#endif +#define strtoul strtoul_is_not_a_portable_function_use_strtol_instead + + /* The C library has functions that allow const to be silently dropped ... + these macros detect the drop in maintainer mode, but use the native + methods for normal builds + + Note that on some platforms (e.g., AIX with gcc, Solaris with gcc), string.h needs + to be included before the macros are defined or compilation will fail. + */ +#include <string.h> + +AP_DECLARE(char *) ap_strchr(char *s, int c); +AP_DECLARE(const char *) ap_strchr_c(const char *s, int c); +AP_DECLARE(char *) ap_strrchr(char *s, int c); +AP_DECLARE(const char *) ap_strrchr_c(const char *s, int c); +AP_DECLARE(char *) ap_strstr(char *s, const char *c); +AP_DECLARE(const char *) ap_strstr_c(const char *s, const char *c); + +#ifdef AP_DEBUG + +#undef strchr +# define strchr(s, c) ap_strchr(s,c) +#undef strrchr +# define strrchr(s, c) ap_strrchr(s,c) +#undef strstr +# define strstr(s, c) ap_strstr(s,c) + +#else + +/** use this instead of strchr */ +# define ap_strchr(s, c) strchr(s, c) +/** use this instead of strchr */ +# define ap_strchr_c(s, c) strchr(s, c) +/** use this instead of strrchr */ +# define ap_strrchr(s, c) strrchr(s, c) +/** use this instead of strrchr */ +# define ap_strrchr_c(s, c) strrchr(s, c) +/** use this instead of strrstr*/ +# define ap_strstr(s, c) strstr(s, c) +/** use this instead of strrstr*/ +# define ap_strstr_c(s, c) strstr(s, c) + +#endif + +#define AP_NORESTART APR_OS_START_USEERR + 1 + +#ifdef __cplusplus +} +#endif + +#endif /* !APACHE_HTTPD_H */ diff --git a/rubbos/app/httpd-2.0.64/include/mpm_common.h b/rubbos/app/httpd-2.0.64/include/mpm_common.h new file mode 100644 index 00000000..68ead5f7 --- /dev/null +++ b/rubbos/app/httpd-2.0.64/include/mpm_common.h @@ -0,0 +1,298 @@ +/* Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* The purpose of this file is to store the code that MOST mpm's will need + * this does not mean a function only goes into this file if every MPM needs + * it. It means that if a function is needed by more than one MPM, and + * future maintenance would be served by making the code common, then the + * function belongs here. + * + * This is going in src/main because it is not platform specific, it is + * specific to multi-process servers, but NOT to Unix. Which is why it + * does not belong in src/os/unix + */ + +#ifndef APACHE_MPM_COMMON_H +#define APACHE_MPM_COMMON_H + +#include "ap_config.h" + +#if APR_HAVE_NETINET_TCP_H +#include <netinet/tcp.h> /* for TCP_NODELAY */ +#endif + +#include "mpm.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @package Multi-Processing Modules functions + */ + +/* The maximum length of the queue of pending connections, as defined + * by listen(2). Under some systems, it should be increased if you + * are experiencing a heavy TCP SYN flood attack. + * + * It defaults to 511 instead of 512 because some systems store it + * as an 8-bit datatype; 512 truncated to 8-bits is 0, while 511 is + * 255 when truncated. + */ +#ifndef DEFAULT_LISTENBACKLOG +#define DEFAULT_LISTENBACKLOG 511 +#endif + +/** + * Make sure all child processes that have been spawned by the parent process + * have died. This includes process registered as "other_children". + * @warning This is only defined if the MPM defines + * AP_MPM_WANT_RECLAIM_CHILD_PROCESSES + * @param terminate Either 1 or 0. If 1, send the child processes SIGTERM + * each time through the loop. If 0, give the process time to die + * on its own before signalling it. + * @tip This function requires that some macros are defined by the MPM: <pre> + * MPM_CHILD_PID -- Get the pid from the specified spot in the scoreboard + * MPM_NOTE_CHILD_KILLED -- Note the child died in the scoreboard + * </pre> + * @tip The MPM child processes which are reclaimed are those listed + * in the scoreboard as well as those currently registered via + * ap_register_extra_mpm_process(). + */ +#ifdef AP_MPM_WANT_RECLAIM_CHILD_PROCESSES +void ap_reclaim_child_processes(int terminate); +#endif + +/** + * Tell ap_reclaim_child_processes() about an MPM child process which has no + * entry in the scoreboard. + * @warning This is only defined if the MPM defines + * AP_MPM_WANT_RECLAIM_CHILD_PROCESSES + * @param pid The process id of an MPM child process which should be + * reclaimed when ap_reclaim_child_processes() is called. + * @tip If an extra MPM child process terminates prior to calling + * ap_reclaim_child_processes(), remove it from the list of such processes + * by calling ap_unregister_extra_mpm_process(). + */ +#ifdef AP_MPM_WANT_RECLAIM_CHILD_PROCESSES +void ap_register_extra_mpm_process(pid_t pid); +#endif + +/** + * Unregister an MPM child process which was previously registered by a + * call to ap_register_extra_mpm_process(). + * @warning This is only defined if the MPM defines + * AP_MPM_WANT_RECLAIM_CHILD_PROCESSES + * @param pid The process id of an MPM child process which no longer needs to + * be reclaimed. + * @return 1 if the process was found and removed, 0 otherwise + */ +#ifdef AP_MPM_WANT_RECLAIM_CHILD_PROCESSES +int ap_unregister_extra_mpm_process(pid_t pid); +#endif + +/** + * Determine if any child process has died. If no child process died, then + * this process sleeps for the amount of time specified by the MPM defined + * macro SCOREBOARD_MAINTENANCE_INTERVAL. + * @param status The return code if a process has died + * @param ret The process id of the process that died + * @param p The pool to allocate out of + */ +#ifdef AP_MPM_WANT_WAIT_OR_TIMEOUT +void ap_wait_or_timeout(apr_exit_why_e *status, int *exitcode, apr_proc_t *ret, + apr_pool_t *p); +#endif + +/** + * Log why a child died to the error log, if the child died without the + * parent signalling it. + * @param pid The child that has died + * @param status The status returned from ap_wait_or_timeout + * @return 0 on success, APEXIT_CHILDFATAL if MPM should terminate + */ +#ifdef AP_MPM_WANT_PROCESS_CHILD_STATUS +int ap_process_child_status(apr_proc_t *pid, apr_exit_why_e why, int status); +#endif + +#if defined(TCP_NODELAY) && !defined(MPE) && !defined(TPF) +/** + * Turn off the nagle algorithm for the specified socket. The nagle algorithm + * says that we should delay sending partial packets in the hopes of getting + * more data. There are bad interactions between persistent connections and + * Nagle's algorithm that have severe performance penalties. + * @param s The socket to disable nagle for. + */ +void ap_sock_disable_nagle(apr_socket_t *s); +#else +#define ap_sock_disable_nagle(s) /* NOOP */ +#endif + +#ifdef HAVE_GETPWNAM +/** + * Convert a username to a numeric ID + * @param name The name to convert + * @return The user id corresponding to a name + * @deffunc uid_t ap_uname2id(const char *name) + */ +AP_DECLARE(uid_t) ap_uname2id(const char *name); +#endif + +#ifdef HAVE_GETGRNAM +/** + * Convert a group name to a numeric ID + * @param name The name to convert + * @return The group id corresponding to a name + * @deffunc gid_t ap_gname2id(const char *name) + */ +AP_DECLARE(gid_t) ap_gname2id(const char *name); +#endif + +#define AP_MPM_HARD_LIMITS_FILE APACHE_MPM_DIR "/mpm_default.h" + +#ifdef AP_MPM_USES_POD + +typedef struct ap_pod_t ap_pod_t; + +struct ap_pod_t { + apr_file_t *pod_in; + apr_file_t *pod_out; + apr_pool_t *p; + apr_sockaddr_t *sa; +}; + +/** + * Open the pipe-of-death. The pipe of death is used to tell all child + * processes that it is time to die gracefully. + * @param p The pool to use for allocating the pipe + */ +AP_DECLARE(apr_status_t) ap_mpm_pod_open(apr_pool_t *p, ap_pod_t **pod); + +/** + * Check the pipe to determine if the process has been signalled to die. + */ +AP_DECLARE(apr_status_t) ap_mpm_pod_check(ap_pod_t *pod); + +/** + * Close the pipe-of-death + */ +AP_DECLARE(apr_status_t) ap_mpm_pod_close(ap_pod_t *pod); + +/** + * Write data to the pipe-of-death, signalling that one child process + * should die. + * @param p The pool to use when allocating any required structures. + */ +AP_DECLARE(apr_status_t) ap_mpm_pod_signal(ap_pod_t *pod); + +/** + * Write data to the pipe-of-death, signalling that all child process + * should die. + * @param p The pool to use when allocating any required structures. + * @param num The number of child processes to kill + */ +AP_DECLARE(void) ap_mpm_pod_killpg(ap_pod_t *pod, int num); +#endif + +/* + * These data members are common to all mpms. Each new mpm + * should either use the appropriate ap_mpm_set_* function + * in their command table or create their own for custom or + * OS specific needs. These should work for most. + */ + +/** + * The maximum number of requests each child thread or + * process handles before dying off + */ +#ifdef AP_MPM_WANT_SET_MAX_REQUESTS +extern int ap_max_requests_per_child; +const char *ap_mpm_set_max_requests(cmd_parms *cmd, void *dummy, + const char *arg); +#endif + +/** + * The filename used to store the process id. + */ +#ifdef AP_MPM_WANT_SET_PIDFILE +extern const char *ap_pid_fname; +const char *ap_mpm_set_pidfile(cmd_parms *cmd, void *dummy, + const char *arg); +#endif + +/** + * The name of lockfile used when Apache needs to lock the accept() call. + */ +#ifdef AP_MPM_WANT_SET_LOCKFILE +extern const char *ap_lock_fname; +const char *ap_mpm_set_lockfile(cmd_parms *cmd, void *dummy, + const char *arg); +#endif + +/** + * The system mutex implementation to use for the accept mutex. + */ +#ifdef AP_MPM_WANT_SET_ACCEPT_LOCK_MECH +extern apr_lockmech_e ap_accept_lock_mech; +extern const char ap_valid_accept_mutex_string[]; +const char *ap_mpm_set_accept_lock_mech(cmd_parms *cmd, void *dummy, + const char *arg); +#endif + +/* + * Set the scorboard file. + */ +#ifdef AP_MPM_WANT_SET_SCOREBOARD +const char *ap_mpm_set_scoreboard(cmd_parms *cmd, void *dummy, + const char *arg); +#endif + +/* + * The directory that the server changes directory to dump core. + */ +#ifdef AP_MPM_WANT_SET_COREDUMPDIR +extern char ap_coredump_dir[MAX_STRING_LEN]; +extern int ap_coredumpdir_configured; +const char *ap_mpm_set_coredumpdir(cmd_parms *cmd, void *dummy, + const char *arg); +#endif + +#ifdef AP_MPM_WANT_SIGNAL_SERVER +int ap_signal_server(int *, apr_pool_t *); +void ap_mpm_rewrite_args(process_rec *); +#endif + +#ifdef AP_MPM_WANT_SET_MAX_MEM_FREE +extern apr_uint32_t ap_max_mem_free; +extern const char *ap_mpm_set_max_mem_free(cmd_parms *cmd, void *dummy, + const char *arg); +#endif + +#ifdef AP_MPM_WANT_FATAL_SIGNAL_HANDLER +extern apr_status_t ap_fatal_signal_setup(server_rec *s, apr_pool_t *pconf); +extern apr_status_t ap_fatal_signal_child_setup(server_rec *s); +#endif + +#if AP_ENABLE_EXCEPTION_HOOK +extern const char *ap_mpm_set_exception_hook(cmd_parms *cmd, void *dummy, + const char *arg); +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* !APACHE_MPM_COMMON_H */ diff --git a/rubbos/app/httpd-2.0.64/include/pcreposix.h b/rubbos/app/httpd-2.0.64/include/pcreposix.h new file mode 100644 index 00000000..a847421f --- /dev/null +++ b/rubbos/app/httpd-2.0.64/include/pcreposix.h @@ -0,0 +1,99 @@ +/************************************************* +* Perl-Compatible Regular Expressions * +*************************************************/ + +/* Copyright (c) 1997-2000 University of Cambridge */ + +/** + * @file include/pcreposix.h + * @brief PCRE definitions + */ + +#ifndef _PCREPOSIX_H +#define _PCREPOSIX_H + +/* This is the header for the POSIX wrapper interface to the PCRE Perl- +Compatible Regular Expression library. It defines the things POSIX says should +be there. I hope. */ + +/* Have to include stdlib.h in order to ensure that size_t is defined. */ + +#include <stdlib.h> + +/* Allow for C++ users */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Options defined by POSIX. */ + + /** Ignore case */ +#define REG_ICASE 0x01 + /** Don't match newlines with wildcards */ +#define REG_NEWLINE 0x02 + /** Don't match BOL */ +#define REG_NOTBOL 0x04 + /** Don't match EOL */ +#define REG_NOTEOL 0x08 + +/* These are not used by PCRE, but by defining them we make it easier +to slot PCRE into existing programs that make POSIX calls. */ + + /** UNUSED! */ +#define REG_EXTENDED 0 + /** UNUSED! */ +#define REG_NOSUB 0 + +/* Error values. Not all these are relevant or used by the wrapper. */ + +enum { + REG_ASSERT = 1, /* internal error ? */ + REG_BADBR, /* invalid repeat counts in {} */ + REG_BADPAT, /* pattern error */ + REG_BADRPT, /* ? * + invalid */ + REG_EBRACE, /* unbalanced {} */ + REG_EBRACK, /* unbalanced [] */ + REG_ECOLLATE, /* collation error - not relevant */ + REG_ECTYPE, /* bad class */ + REG_EESCAPE, /* bad escape sequence */ + REG_EMPTY, /* empty expression */ + REG_EPAREN, /* unbalanced () */ + REG_ERANGE, /* bad range inside [] */ + REG_ESIZE, /* expression too big */ + REG_ESPACE, /* failed to get memory */ + REG_ESUBREG, /* bad back reference */ + REG_INVARG, /* bad argument */ + REG_NOMATCH /* match failed */ +}; + + +/* The structure representing a compiled regular expression. */ + +typedef struct { + void *re_pcre; + size_t re_nsub; + size_t re_erroffset; +} regex_t; + +/* The structure in which a captured offset is returned. */ + +typedef int regoff_t; + +typedef struct { + regoff_t rm_so; + regoff_t rm_eo; +} regmatch_t; + +/* The functions */ + +extern int regcomp(regex_t *, const char *, int); +extern int regexec(regex_t *, const char *, size_t, regmatch_t *, int); +extern size_t regerror(int, const regex_t *, char *, size_t); +extern void regfree(regex_t *); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* End of pcreposix.h */ diff --git a/rubbos/app/httpd-2.0.64/include/rfc1413.h b/rubbos/app/httpd-2.0.64/include/rfc1413.h new file mode 100644 index 00000000..a4ffdf11 --- /dev/null +++ b/rubbos/app/httpd-2.0.64/include/rfc1413.h @@ -0,0 +1,42 @@ +/* Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef APACHE_RFC1413_H +#define APACHE_RFC1413_H + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @package RFC1413 package + */ + +/** + * Retrieve the remote user name, given socket structures. This implements + * RFC1413, which involves querying the client's identd or auth daemon. + * @param conn The current connection + * @param srv The current server + * @return The remote user name + * @deffunc char *ap_rfc1413(conn_rec *conn, server_rec *srv) + */ +extern char *ap_rfc1413(conn_rec *conn, server_rec *srv); + +#ifdef __cplusplus +} +#endif + +#endif /* !APACHE_RFC1413_H */ diff --git a/rubbos/app/httpd-2.0.64/include/scoreboard.h b/rubbos/app/httpd-2.0.64/include/scoreboard.h new file mode 100644 index 00000000..6ca18582 --- /dev/null +++ b/rubbos/app/httpd-2.0.64/include/scoreboard.h @@ -0,0 +1,197 @@ +/* Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef APACHE_SCOREBOARD_H +#define APACHE_SCOREBOARD_H + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef HAVE_SYS_TIMES_H +#include <sys/time.h> +#include <sys/times.h> +#elif defined(TPF) +#include <time.h> +#endif + +#include "ap_config.h" +#include "apr_hooks.h" +#include "apr_thread_proc.h" +#include "apr_portable.h" +#include "apr_shm.h" + +/* Scoreboard file, if there is one */ +#ifndef DEFAULT_SCOREBOARD +#define DEFAULT_SCOREBOARD "logs/apache_runtime_status" +#endif + +/* Scoreboard info on a process is, for now, kept very brief --- + * just status value and pid (the latter so that the caretaker process + * can properly update the scoreboard when a process dies). We may want + * to eventually add a separate set of long_score structures which would + * give, for each process, the number of requests serviced, and info on + * the current, or most recent, request. + * + * Status values: + */ + +#define SERVER_DEAD 0 +#define SERVER_STARTING 1 /* Server Starting up */ +#define SERVER_READY 2 /* Waiting for connection (or accept() lock) */ +#define SERVER_BUSY_READ 3 /* Reading a client request */ +#define SERVER_BUSY_WRITE 4 /* Processing a client request */ +#define SERVER_BUSY_KEEPALIVE 5 /* Waiting for more requests via keepalive */ +#define SERVER_BUSY_LOG 6 /* Logging the request */ +#define SERVER_BUSY_DNS 7 /* Looking up a hostname */ +#define SERVER_CLOSING 8 /* Closing the connection */ +#define SERVER_GRACEFUL 9 /* server is gracefully finishing request */ +#define SERVER_IDLE_KILL 10 /* Server is cleaning up idle children. */ +#define SERVER_NUM_STATUS 11 /* number of status settings */ + +/* Type used for generation indicies. Startup and every restart cause a + * new generation of children to be spawned. Children within the same + * generation share the same configuration information -- pointers to stuff + * created at config time in the parent are valid across children. However, + * this can't work effectively with non-forked architectures. So while the + * arrays in the scoreboard never change between the parent and forked + * children, so they do not require shm storage, the contents of the shm + * may contain no pointers. + */ +typedef int ap_generation_t; + +/* Is the scoreboard shared between processes or not? + * Set by the MPM when the scoreboard is created. + */ +typedef enum { + SB_NOT_SHARED = 1, + SB_SHARED = 2 +} ap_scoreboard_e; + +#define SB_WORKING 0 /* The server is busy and the child is useful. */ +#define SB_IDLE_DIE 1 /* The server is idle and the child is superfluous. */ + /* The child should check for this and exit gracefully. */ + +/* stuff which is worker specific */ +/***********************WARNING***************************************/ +/* These are things that are used by mod_status. Do not put anything */ +/* in here that you cannot live without. This structure will not */ +/* be available if mod_status is not loaded. */ +/*********************************************************************/ +typedef struct worker_score worker_score; + +struct worker_score { + int thread_num; +#if APR_HAS_THREADS + apr_os_thread_t tid; +#endif + unsigned char status; + unsigned long access_count; + apr_off_t bytes_served; + unsigned long my_access_count; + apr_off_t my_bytes_served; + apr_off_t conn_bytes; + unsigned short conn_count; + apr_time_t start_time; + apr_time_t stop_time; +#ifdef HAVE_TIMES + struct tms times; +#endif + apr_time_t last_used; + char client[32]; /* Keep 'em small... */ + char request[64]; /* We just want an idea... */ + char vhost[32]; /* What virtual host is being accessed? */ +}; + +typedef struct { + int server_limit; + int thread_limit; + ap_scoreboard_e sb_type; + ap_generation_t running_generation; /* the generation of children which + * should still be serving requests. */ + apr_time_t restart_time; +} global_score; + +/* stuff which the parent generally writes and the children rarely read */ +typedef struct process_score process_score; +struct process_score{ + pid_t pid; + ap_generation_t generation; /* generation of this child */ + ap_scoreboard_e sb_type; + int quiescing; /* the process whose pid is stored above is + * going down gracefully + */ +}; + +/* Scoreboard is now in 'local' memory, since it isn't updated once created, + * even in forked architectures. Child created-processes (non-fork) will + * set up these indicies into the (possibly relocated) shmem records. + */ +typedef struct { + global_score *global; + process_score *parent; + worker_score **servers; +} scoreboard; + +typedef struct ap_sb_handle_t ap_sb_handle_t; + +AP_DECLARE(int) ap_exists_scoreboard_image(void); +AP_DECLARE(void) ap_increment_counts(ap_sb_handle_t *sbh, request_rec *r); + +int ap_create_scoreboard(apr_pool_t *p, ap_scoreboard_e t); +apr_status_t ap_reopen_scoreboard(apr_pool_t *p, apr_shm_t **shm, int detached); +void ap_init_scoreboard(void *shared_score); +AP_DECLARE(int) ap_calc_scoreboard_size(void); +apr_status_t ap_cleanup_scoreboard(void *d); + +AP_DECLARE(void) ap_create_sb_handle(ap_sb_handle_t **new_sbh, apr_pool_t *p, + int child_num, int thread_num); + +AP_DECLARE(int) find_child_by_pid(apr_proc_t *pid); +AP_DECLARE(int) ap_update_child_status(ap_sb_handle_t *sbh, int status, request_rec *r); +AP_DECLARE(int) ap_update_child_status_from_indexes(int child_num, int thread_num, + int status, request_rec *r); +void ap_time_process_request(ap_sb_handle_t *sbh, int status); + +AP_DECLARE(worker_score *) ap_get_scoreboard_worker(int x, int y); +AP_DECLARE(process_score *) ap_get_scoreboard_process(int x); +AP_DECLARE(global_score *) ap_get_scoreboard_global(void); + +AP_DECLARE_DATA extern scoreboard *ap_scoreboard_image; +AP_DECLARE_DATA extern const char *ap_scoreboard_fname; +AP_DECLARE_DATA extern int ap_extended_status; + +AP_DECLARE_DATA extern ap_generation_t volatile ap_my_generation; + +/* Hooks */ +/** + * Hook for post scoreboard creation, pre mpm. + * @param p Apache pool to allocate from. + * @param sb_type + * @ingroup hooks + * @return OK or DECLINE on success; anything else is a error + */ +AP_DECLARE_HOOK(int, pre_mpm, (apr_pool_t *p, ap_scoreboard_e sb_type)) + +/* for time_process_request() in http_main.c */ +#define START_PREQUEST 1 +#define STOP_PREQUEST 2 + +#ifdef __cplusplus +} +#endif + +#endif /* !APACHE_SCOREBOARD_H */ diff --git a/rubbos/app/httpd-2.0.64/include/util_cfgtree.h b/rubbos/app/httpd-2.0.64/include/util_cfgtree.h new file mode 100644 index 00000000..a23330bc --- /dev/null +++ b/rubbos/app/httpd-2.0.64/include/util_cfgtree.h @@ -0,0 +1,79 @@ +/* Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef AP_CONFTREE_H +#define AP_CONFTREE_H + +#include "ap_config.h" + +/** + * @package Config Tree Package + */ + +typedef struct ap_directive_t ap_directive_t; + +/** + * Structure used to build the config tree. The config tree only stores + * the directives that will be active in the running server. Directives + * that contain other directions, such as <Directory ...> cause a sub-level + * to be created, where the included directives are stored. The closing + * directive (</Directory>) is not stored in the tree. + */ +struct ap_directive_t { + /** The current directive */ + const char *directive; + /** The arguments for the current directive, stored as a space + * separated list */ + const char *args; + /** The next directive node in the tree + * @defvar ap_directive_t *next */ + struct ap_directive_t *next; + /** The first child node of this directive + * @defvar ap_directive_t *first_child */ + struct ap_directive_t *first_child; + /** The parent node of this directive + * @defvar ap_directive_t *parent */ + struct ap_directive_t *parent; + + /** directive's module can store add'l data here */ + void *data; + + /* ### these may go away in the future, but are needed for now */ + /** The name of the file this directive was found in */ + const char *filename; + /** The line number the directive was on */ + int line_num; +}; + +/** + * The root of the configuration tree + * @defvar ap_directive_t *conftree + */ +AP_DECLARE_DATA extern ap_directive_t *ap_conftree; + +/** + * Add a node to the configuration tree. + * @param parent The current parent node. If the added node is a first_child, + then this is changed to the current node + * @param current The current node + * @param toadd The node to add to the tree + * @param child Is the node to add a child node + * @return the added node + */ +ap_directive_t *ap_add_node(ap_directive_t **parent, ap_directive_t *current, + ap_directive_t *toadd, int child); + +#endif diff --git a/rubbos/app/httpd-2.0.64/include/util_charset.h b/rubbos/app/httpd-2.0.64/include/util_charset.h new file mode 100644 index 00000000..449a8700 --- /dev/null +++ b/rubbos/app/httpd-2.0.64/include/util_charset.h @@ -0,0 +1,54 @@ +/* Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef APACHE_UTIL_CHARSET_H +#define APACHE_UTIL_CHARSET_H + +#ifdef APACHE_XLATE + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @package charset conversion + */ +#include "apr_xlate.h" + +/** On EBCDIC machine this is a translation handle used to translate the + * headers from the local machine format to ASCII for network transmission. + * On an ASCII machine this is NULL */ +extern apr_xlate_t *ap_hdrs_to_ascii; +/** On EBCDIC machine this is a translation handle used to translate the + * headers from ASCII to the local machine format after network transmission. + * On an ASCII machine this is NULL */ +extern apr_xlate_t *ap_hdrs_from_ascii; +/** On EBCDIC machine this is a translation handle used to translate the + * content from the local machine format to ASCII for network transmission. + * On an ASCII machine this is NULL */ +extern apr_xlate_t *ap_locale_to_ascii; +/** On EBCDIC machine this is a translation handle used to translate the + * content from ASCII to the local machine format after network transmission. + * On an ASCII machine this is NULL */ +extern apr_xlate_t *ap_locale_from_ascii; + +#ifdef __cplusplus +} +#endif + +#endif /* APACHE_XLATE */ + +#endif /* !APACHE_UTIL_CHARSET_H */ diff --git a/rubbos/app/httpd-2.0.64/include/util_ebcdic.h b/rubbos/app/httpd-2.0.64/include/util_ebcdic.h new file mode 100644 index 00000000..0cd54cee --- /dev/null +++ b/rubbos/app/httpd-2.0.64/include/util_ebcdic.h @@ -0,0 +1,78 @@ +/* Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef APACHE_UTIL_EBCDIC_H +#define APACHE_UTIL_EBCDIC_H + + +#ifdef __cplusplus +extern "C" { +#endif + +#include "apr_xlate.h" +#include "httpd.h" +#include "util_charset.h" + +/** + * @package Utilities for EBCDIC conversion + */ + +#if APR_CHARSET_EBCDIC + +/** + * Setup all of the global translation handlers + * @param pool pool to allocate out of + */ +apr_status_t ap_init_ebcdic(apr_pool_t *pool); + +/** + * Convert protocol data from the implementation character + * set to ASCII. + * @param buffer buffer to translate + * @param len number of bytes to translate + */ +void ap_xlate_proto_to_ascii(char *buffer, apr_size_t len); + +/** + * Convert protocol data to the implementation character + * set from ASCII. + * @param buffer buffer to translate + * @param len number of bytes to translate + */ +void ap_xlate_proto_from_ascii(char *buffer, apr_size_t len); + +/** + * Convert protocol data from the implementation charater + * set to ASCII, then send it. + * @param r the current request + * @param ... the strings to write, followed by a NULL pointer + */ +int ap_rvputs_proto_in_ascii(request_rec *r, ...); + +#else /* APR_CHARSET_EBCDIC */ + +#define ap_xlate_proto_to_ascii(x,y) /* NOOP */ +#define ap_xlate_proto_from_ascii(x,y) /* NOOP */ + +#define ap_rvputs_proto_in_ascii ap_rvputs + +#endif /* APR_CHARSET_EBCDIC */ + +#ifdef __cplusplus +} +#endif + +#endif /* !APACHE_UTIL_EBCDIC_H */ diff --git a/rubbos/app/httpd-2.0.64/include/util_filter.h b/rubbos/app/httpd-2.0.64/include/util_filter.h new file mode 100644 index 00000000..a5c9802a --- /dev/null +++ b/rubbos/app/httpd-2.0.64/include/util_filter.h @@ -0,0 +1,516 @@ +/* Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef AP_FILTER_H +#define AP_FILTER_H + +#include "apr.h" +#include "apr_buckets.h" + +#include "httpd.h" + +#if APR_HAVE_STDARG_H +#include <stdarg.h> +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @file util_filter.h + * @brief Apache filter library + */ + +/** Returned by the bottom-most filter if no data was written. + * @see ap_pass_brigade(). */ +#define AP_NOBODY_WROTE -1 +/** Returned by the bottom-most filter if no data was read. + * @see ap_get_brigade(). */ +#define AP_NOBODY_READ -2 +/** Returned when?? @bug find out when! */ +#define AP_FILTER_ERROR -3 + +/** + * input filtering modes + */ +typedef enum { + /** The filter should return at most readbytes data. */ + AP_MODE_READBYTES, + /** The filter should return at most one line of CRLF data. + * (If a potential line is too long or no CRLF is found, the + * filter may return partial data). + */ + AP_MODE_GETLINE, + /** The filter should implicitly eat any CRLF pairs that it sees. */ + AP_MODE_EATCRLF, + /** The filter read should be treated as speculative and any returned + * data should be stored for later retrieval in another mode. */ + AP_MODE_SPECULATIVE, + /** The filter read should be exhaustive and read until it can not + * read any more. + * Use this mode with extreme caution. + */ + AP_MODE_EXHAUSTIVE, + /** The filter should initialize the connection if needed, + * NNTP or FTP over SSL for example. + */ + AP_MODE_INIT +} ap_input_mode_t; + +/** + * @defgroup filter FILTER CHAIN + * + * Filters operate using a "chaining" mechanism. The filters are chained + * together into a sequence. When output is generated, it is passed through + * each of the filters on this chain, until it reaches the end (or "bottom") + * and is placed onto the network. + * + * The top of the chain, the code generating the output, is typically called + * a "content generator." The content generator's output is fed into the + * filter chain using the standard Apache output mechanisms: ap_rputs(), + * ap_rprintf(), ap_rwrite(), etc. + * + * Each filter is defined by a callback. This callback takes the output from + * the previous filter (or the content generator if there is no previous + * filter), operates on it, and passes the result to the next filter in the + * chain. This pass-off is performed using the ap_fc_* functions, such as + * ap_fc_puts(), ap_fc_printf(), ap_fc_write(), etc. + * + * When content generation is complete, the system will pass an "end of + * stream" marker into the filter chain. The filters will use this to flush + * out any internal state and to detect incomplete syntax (for example, an + * unterminated SSI directive). + */ + +/* forward declare the filter type */ +typedef struct ap_filter_t ap_filter_t; + +/** + * @name Filter callbacks + * + * This function type is used for filter callbacks. It will be passed a + * pointer to "this" filter, and a "bucket" containing the content to be + * filtered. + * + * In filter->ctx, the callback will find its context. This context is + * provided here, so that a filter may be installed multiple times, each + * receiving its own per-install context pointer. + * + * Callbacks are associated with a filter definition, which is specified + * by name. See ap_register_input_filter() and ap_register_output_filter() + * for setting the association between a name for a filter and its + * associated callback (and other information). + * + * If the initialization function argument passed to the registration + * functions is non-NULL, it will be called iff the filter is in the input + * or output filter chains and before any data is generated to allow the + * filter to prepare for processing. + * + * The *bucket structure (and all those referenced by ->next and ->prev) + * should be considered "const". The filter is allowed to modify the + * next/prev to insert/remove/replace elements in the bucket list, but + * the types and values of the individual buckets should not be altered. + * + * For the input and output filters, the return value of a filter should be + * an APR status value. For the init function, the return value should + * be an HTTP error code or OK if it was successful. + * + * @ingroup filter + * @{ + */ +typedef apr_status_t (*ap_out_filter_func)(ap_filter_t *f, + apr_bucket_brigade *b); +typedef apr_status_t (*ap_in_filter_func)(ap_filter_t *f, + apr_bucket_brigade *b, + ap_input_mode_t mode, + apr_read_type_e block, + apr_off_t readbytes); +typedef int (*ap_init_filter_func)(ap_filter_t *f); + +typedef union ap_filter_func { + ap_out_filter_func out_func; + ap_in_filter_func in_func; +} ap_filter_func; + +/** @} */ + +/** + * Filters have different types/classifications. These are used to group + * and sort the filters to properly sequence their operation. + * + * The types have a particular sort order, which allows us to insert them + * into the filter chain in a determistic order. Within a particular grouping, + * the ordering is equivalent to the order of calls to ap_add_*_filter(). + */ +typedef enum { + /** These filters are used to alter the content that is passed through + * them. Examples are SSI or PHP. */ + AP_FTYPE_RESOURCE = 10, + /** These filters are used to alter the content as a whole, but after all + * AP_FTYPE_RESOURCE filters are executed. These filters should not + * change the content-type. An example is deflate. */ + AP_FTYPE_CONTENT_SET = 20, + /** These filters are used to handle the protocol between server and + * client. Examples are HTTP and POP. */ + AP_FTYPE_PROTOCOL = 30, + /** These filters implement transport encodings (e.g., chunking). */ + AP_FTYPE_TRANSCODE = 40, + /** These filters will alter the content, but in ways that are + * more strongly associated with the connection. Examples are + * splitting an HTTP connection into multiple requests and + * buffering HTTP responses across multiple requests. + * + * It is important to note that these types of filters are not + * allowed in a sub-request. A sub-request's output can certainly + * be filtered by ::AP_FTYPE_RESOURCE filters, but all of the "final + * processing" is determined by the main request. */ + AP_FTYPE_CONNECTION = 50, + /** These filters don't alter the content. They are responsible for + * sending/receiving data to/from the client. */ + AP_FTYPE_NETWORK = 60 +} ap_filter_type; + +/** + * This is the request-time context structure for an installed filter (in + * the output filter chain). It provides the callback to use for filtering, + * the request this filter is associated with (which is important when + * an output chain also includes sub-request filters), the context for this + * installed filter, and the filter ordering/chaining fields. + * + * Filter callbacks are free to use ->ctx as they please, to store context + * during the filter process. Generally, this is superior over associating + * the state directly with the request. A callback should not change any of + * the other fields. + */ + +typedef struct ap_filter_rec_t ap_filter_rec_t; + +/** + * This structure is used for recording information about the + * registered filters. It associates a name with the filter's callback + * and filter type. + * + * At the moment, these are simply linked in a chain, so a ->next pointer + * is available. + */ +struct ap_filter_rec_t { + /** The registered name for this filter */ + const char *name; + /** The function to call when this filter is invoked. */ + ap_filter_func filter_func; + /** The function to call before the handlers are invoked. Notice + * that this function is called only for filters participating in + * the http protocol. Filters for other protocols are to be + * initiliazed by the protocols themselves. */ + ap_init_filter_func filter_init_func; + /** The type of filter, either AP_FTYPE_CONTENT or AP_FTYPE_CONNECTION. + * An AP_FTYPE_CONTENT filter modifies the data based on information + * found in the content. An AP_FTYPE_CONNECTION filter modifies the + * data based on the type of connection. + */ + ap_filter_type ftype; + + /** The next filter_rec in the list */ + struct ap_filter_rec_t *next; +}; + +/** + * The representation of a filter chain. Each request has a list + * of these structures which are called in turn to filter the data. Sub + * requests get an exact copy of the main requests filter chain. + */ +struct ap_filter_t { + /** The internal representation of this filter. This includes + * the filter's name, type, and the actual function pointer. + */ + ap_filter_rec_t *frec; + + /** A place to store any data associated with the current filter */ + void *ctx; + + /** The next filter in the chain */ + ap_filter_t *next; + + /** The request_rec associated with the current filter. If a sub-request + * adds filters, then the sub-request is the request associated with the + * filter. + */ + request_rec *r; + + /** The conn_rec associated with the current filter. This is analogous + * to the request_rec, except that it is used for input filtering. + */ + conn_rec *c; +}; + +/** + * Get the current bucket brigade from the next filter on the filter + * stack. The filter returns an apr_status_t value. If the bottom-most + * filter doesn't read from the network, then ::AP_NOBODY_READ is returned. + * The bucket brigade will be empty when there is nothing left to get. + * @param filter The next filter in the chain + * @param bucket The current bucket brigade. The original brigade passed + * to ap_get_brigade() must be empty. + * @param mode The way in which the data should be read + * @param block How the operations should be performed + * ::APR_BLOCK_READ, ::APR_NONBLOCK_READ + * @param readbytes How many bytes to read from the next filter. + */ +AP_DECLARE(apr_status_t) ap_get_brigade(ap_filter_t *filter, + apr_bucket_brigade *bucket, + ap_input_mode_t mode, + apr_read_type_e block, + apr_off_t readbytes); + +/** + * Pass the current bucket brigade down to the next filter on the filter + * stack. The filter returns an apr_status_t value. If the bottom-most + * filter doesn't write to the network, then ::AP_NOBODY_WROTE is returned. + * The caller relinquishes ownership of the brigade. + * @param filter The next filter in the chain + * @param bucket The current bucket brigade + */ +AP_DECLARE(apr_status_t) ap_pass_brigade(ap_filter_t *filter, + apr_bucket_brigade *bucket); + +/** + * This function is used to register an input filter with the system. + * After this registration is performed, then a filter may be added + * into the filter chain by using ap_add_input_filter() and simply + * specifying the name. + * + * @param name The name to attach to the filter function + * @param filter_func The filter function to name + * @param filter_init The function to call before the filter handlers + are invoked + * @param ftype The type of filter function, either ::AP_FTYPE_CONTENT or + * ::AP_FTYPE_CONNECTION + * @see add_input_filter() + */ +AP_DECLARE(ap_filter_rec_t *) ap_register_input_filter(const char *name, + ap_in_filter_func filter_func, + ap_init_filter_func filter_init, + ap_filter_type ftype); +/** + * This function is used to register an output filter with the system. + * After this registration is performed, then a filter may be added + * into the filter chain by using ap_add_output_filter() and simply + * specifying the name. + * + * @param name The name to attach to the filter function + * @param filter_func The filter function to name + * @param filter_init The function to call before the filter handlers + * are invoked + * @param ftype The type of filter function, either ::AP_FTYPE_CONTENT or + * ::AP_FTYPE_CONNECTION + * @see ap_add_output_filter() + */ +AP_DECLARE(ap_filter_rec_t *) ap_register_output_filter(const char *name, + ap_out_filter_func filter_func, + ap_init_filter_func filter_init, + ap_filter_type ftype); + +/** + * Adds a named filter into the filter chain on the specified request record. + * The filter will be installed with the specified context pointer. + * + * Filters added in this way will always be placed at the end of the filters + * that have the same type (thus, the filters have the same order as the + * calls to ap_add_filter). If the current filter chain contains filters + * from another request, then this filter will be added before those other + * filters. + * + * To re-iterate that last comment. This function is building a FIFO + * list of filters. Take note of that when adding your filter to the chain. + * + * @param name The name of the filter to add + * @param ctx Context data to provide to the filter + * @param r The request to add this filter for (or NULL if it isn't associated with a request) + * @param c The connection to add the fillter for + */ +AP_DECLARE(ap_filter_t *) ap_add_input_filter(const char *name, void *ctx, + request_rec *r, conn_rec *c); + +/** + * Variant of ap_add_input_filter() that accepts a registered filter handle + * (as returned by ap_register_input_filter()) rather than a filter name + * + * @param f The filter handle to add + * @param ctx Context data to provide to the filter + * @param r The request to add this filter for (or NULL if it isn't associated with a request) + * @param c The connection to add the fillter for + */ +AP_DECLARE(ap_filter_t *) ap_add_input_filter_handle(ap_filter_rec_t *f, + void *ctx, + request_rec *r, + conn_rec *c); + +/** + * Returns the filter handle for use with ap_add_input_filter_handle. + * + * @param name The filter name to look up + */ +AP_DECLARE(ap_filter_rec_t *) ap_get_input_filter_handle(const char *name); + +/** + * Add a filter to the current request. Filters are added in a FIFO manner. + * The first filter added will be the first filter called. + * @param name The name of the filter to add + * @param ctx Context data to set in the filter + * @param r The request to add this filter for (or NULL if it isn't associated with a request) + * @param c The connection to add this filter for + */ +AP_DECLARE(ap_filter_t *) ap_add_output_filter(const char *name, void *ctx, + request_rec *r, conn_rec *c); + +/** + * Variant of ap_add_output_filter() that accepts a registered filter handle + * (as returned by ap_register_output_filter()) rather than a filter name + * + * @param f The filter handle to add + * @param r The request to add this filter for (or NULL if it isn't associated with a request) + * @param c The connection to add the fillter for + */ +AP_DECLARE(ap_filter_t *) ap_add_output_filter_handle(ap_filter_rec_t *f, + void *ctx, + request_rec *r, + conn_rec *c); + +/** + * Returns the filter handle for use with ap_add_output_filter_handle. + * + * @param name The filter name to look up + */ +AP_DECLARE(ap_filter_rec_t *) ap_get_output_filter_handle(const char *name); + +/** + * Remove an input filter from either the request or connection stack + * it is associated with. + * @param f The filter to remove + */ + +AP_DECLARE(void) ap_remove_input_filter(ap_filter_t *f); + +/** + * Remove an output filter from either the request or connection stack + * it is associated with. + * @param f The filter to remove + */ + +AP_DECLARE(void) ap_remove_output_filter(ap_filter_t *f); + +/* The next two filters are for abstraction purposes only. They could be + * done away with, but that would require that we break modules if we ever + * want to change our filter registration method. The basic idea, is that + * all filters have a place to store data, the ctx pointer. These functions + * fill out that pointer with a bucket brigade, and retrieve that data on + * the next call. The nice thing about these functions, is that they + * automatically concatenate the bucket brigades together for you. This means + * that if you have already stored a brigade in the filters ctx pointer, then + * when you add more it will be tacked onto the end of that brigade. When + * you retrieve data, if you pass in a bucket brigade to the get function, + * it will append the current brigade onto the one that you are retrieving. + */ + +/** + * prepare a bucket brigade to be setaside. If a different brigade was + * set-aside earlier, then the two brigades are concatenated together. + * @param f The current filter + * @param save_to The brigade that was previously set-aside. Regardless, the + * new bucket brigade is returned in this location. + * @param b The bucket brigade to save aside. This brigade is always empty + * on return + * @param p Ensure that all data in the brigade lives as long as this pool + */ +AP_DECLARE(apr_status_t) ap_save_brigade(ap_filter_t *f, + apr_bucket_brigade **save_to, + apr_bucket_brigade **b, apr_pool_t *p); + +/** + * Flush function for apr_brigade_* calls. This calls ap_pass_brigade + * to flush the brigade if the brigade buffer overflows. + * @param bb The brigade to flush + * @param ctx The filter to pass the brigade to + * @note this function has nothing to do with FLUSH buckets. It is simply + * a way to flush content out of a brigade and down a filter stack. + */ +AP_DECLARE_NONSTD(apr_status_t) ap_filter_flush(apr_bucket_brigade *bb, + void *ctx); + +/** + * Flush the current brigade down the filter stack. + * @param f The current filter + * @param bb The brigade to flush + */ +AP_DECLARE(apr_status_t) ap_fflush(ap_filter_t *f, apr_bucket_brigade *bb); + +/** + * Write a buffer for the current filter, buffering if possible. + * @param f the filter doing the writing + * @param bb The brigade to buffer into + * @param data The data to write + * @param nbyte The number of bytes in the data + */ +#define ap_fwrite(f, bb, data, nbyte) \ + apr_brigade_write(bb, ap_filter_flush, f, data, nbyte) + +/** + * Write a buffer for the current filter, buffering if possible. + * @param f the filter doing the writing + * @param bb The brigade to buffer into + * @param str The string to write + */ +#define ap_fputs(f, bb, str) \ + apr_brigade_puts(bb, ap_filter_flush, f, str) + +/** + * Write a character for the current filter, buffering if possible. + * @param f the filter doing the writing + * @param bb The brigade to buffer into + * @param c The character to write + */ +#define ap_fputc(f, bb, c) \ + apr_brigade_putc(bb, ap_filter_flush, f, c) + +/** + * Write an unspecified number of strings to the current filter + * @param f the filter doing the writing + * @param bb The brigade to buffer into + * @param ... The strings to write + */ +AP_DECLARE_NONSTD(apr_status_t) ap_fputstrs(ap_filter_t *f, + apr_bucket_brigade *bb, + ...); + +/** + * Output data to the filter in printf format + * @param f the filter doing the writing + * @param bb The brigade to buffer into + * @param fmt The format string + * @param ... The argumets to use to fill out the format string + */ +AP_DECLARE_NONSTD(apr_status_t) ap_fprintf(ap_filter_t *f, + apr_bucket_brigade *bb, + const char *fmt, + ...) + __attribute__((format(printf,3,4))); + +#ifdef __cplusplus +} +#endif + +#endif /* !AP_FILTER_H */ diff --git a/rubbos/app/httpd-2.0.64/include/util_ldap.h b/rubbos/app/httpd-2.0.64/include/util_ldap.h new file mode 100644 index 00000000..605f3b72 --- /dev/null +++ b/rubbos/app/httpd-2.0.64/include/util_ldap.h @@ -0,0 +1,318 @@ +/* Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef UTIL_LDAP_H +#define UTIL_LDAP_H + +#include <apr_ldap.h> + +/* this whole thing disappears if LDAP is not enabled */ +#ifdef APU_HAS_LDAP + +/* APR header files */ +#include <apr_thread_mutex.h> +#include <apr_thread_rwlock.h> +#include <apr_tables.h> +#include <apr_time.h> + +/* Apache header files */ +#include "ap_config.h" +#include "httpd.h" +#include "http_config.h" +#include "http_core.h" +#include "http_log.h" +#include "http_protocol.h" +#include "http_request.h" + +#if APR_HAS_SHARED_MEMORY +#include "apr_rmm.h" +#include "apr_shm.h" +#endif + +/* Create a set of LDAP_DECLARE(type), LDLDAP_DECLARE(type) and + * LDAP_DECLARE_DATA with appropriate export and import tags for the platform + */ +#if !defined(WIN32) +#define LDAP_DECLARE(type) type +#define LDAP_DECLARE_NONSTD(type) type +#define LDAP_DECLARE_DATA +#elif defined(LDAP_DECLARE_STATIC) +#define LDAP_DECLARE(type) type __stdcall +#define LDAP_DECLARE_NONSTD(type) type +#define LDAP_DECLARE_DATA +#elif defined(LDAP_DECLARE_EXPORT) +#define LDAP_DECLARE(type) __declspec(dllexport) type __stdcall +#define LDAP_DECLARE_NONSTD(type) __declspec(dllexport) type +#define LDAP_DECLARE_DATA __declspec(dllexport) +#else +#define LDAP_DECLARE(type) __declspec(dllimport) type __stdcall +#define LDAP_DECLARE_NONSTD(type) __declspec(dllimport) type +#define LDAP_DECLARE_DATA __declspec(dllimport) +#endif + +/* + * LDAP Connections + */ + +/* Values that the deref member can have */ +typedef enum { + never=LDAP_DEREF_NEVER, + searching=LDAP_DEREF_SEARCHING, + finding=LDAP_DEREF_FINDING, + always=LDAP_DEREF_ALWAYS +} deref_options; + +/* Structure representing an LDAP connection */ +typedef struct util_ldap_connection_t { + LDAP *ldap; + apr_pool_t *pool; /* Pool from which this connection is created */ +#if APR_HAS_THREADS + apr_thread_mutex_t *lock; /* Lock to indicate this connection is in use */ +#endif + int bound; /* Flag to indicate whether this connection is bound yet */ + + const char *host; /* Name of the LDAP server (or space separated list) */ + int port; /* Port of the LDAP server */ + deref_options deref; /* how to handle alias dereferening */ + + const char *binddn; /* DN to bind to server (can be NULL) */ + const char *bindpw; /* Password to bind to server (can be NULL) */ + + int secure; /* True if use SSL connection */ + + const char *reason; /* Reason for an error failure */ + + struct util_ldap_connection_t *next; +} util_ldap_connection_t; + +/* LDAP cache state information */ +typedef struct util_ldap_state_t { + apr_pool_t *pool; /* pool from which this state is allocated */ +#if APR_HAS_THREADS + apr_thread_mutex_t *mutex; /* mutex lock for the connection list */ +#endif + apr_global_mutex_t *util_ldap_cache_lock; + + apr_size_t cache_bytes; /* Size (in bytes) of shared memory cache */ + char *cache_file; /* filename for shm */ + long search_cache_ttl; /* TTL for search cache */ + long search_cache_size; /* Size (in entries) of search cache */ + long compare_cache_ttl; /* TTL for compare cache */ + long compare_cache_size; /* Size (in entries) of compare cache */ + + struct util_ldap_connection_t *connections; + char *cert_auth_file; + int cert_file_type; + int ssl_support; + +#if APR_HAS_SHARED_MEMORY + apr_shm_t *cache_shm; + apr_rmm_t *cache_rmm; +#endif + + /* cache ald */ + void *util_ldap_cache; + char *lock_file; /* filename for shm lock mutex */ + int connectionTimeout; + +} util_ldap_state_t; + + +/** + * Open a connection to an LDAP server + * @param ldc A structure containing the expanded details of the server + * to connect to. The handle to the LDAP connection is returned + * as ldc->ldap. + * @tip This function connects to the LDAP server and binds. It does not + * connect if already connected (ldc->ldap != NULL). Does not bind + * if already bound. + * @return If successful LDAP_SUCCESS is returned. + * @deffunc int util_ldap_connection_open(request_rec *r, + * util_ldap_connection_t *ldc) + */ +LDAP_DECLARE(int) util_ldap_connection_open(request_rec *r, + util_ldap_connection_t *ldc); + +/** + * Close a connection to an LDAP server + * @param ldc A structure containing the expanded details of the server + * that was connected. + * @tip This function unbinds from the LDAP server, and clears ldc->ldap. + * It is possible to rebind to this server again using the same ldc + * structure, using apr_ldap_open_connection(). + * @deffunc util_ldap_close_connection(util_ldap_connection_t *ldc) + */ +LDAP_DECLARE(void) util_ldap_connection_close(util_ldap_connection_t *ldc); + +/** + * Unbind a connection to an LDAP server + * @param ldc A structure containing the expanded details of the server + * that was connected. + * @tip This function unbinds the LDAP connection, and disconnects from + * the server. It is used during error conditions, to bring the LDAP + * connection back to a known state. + * @deffunc apr_status_t util_ldap_connection_unbind(util_ldap_connection_t *ldc) + */ +LDAP_DECLARE_NONSTD(apr_status_t) util_ldap_connection_unbind(void *param); + +/** + * Cleanup a connection to an LDAP server + * @param ldc A structure containing the expanded details of the server + * that was connected. + * @tip This function is registered with the pool cleanup to close down the + * LDAP connections when the server is finished with them. + * @deffunc apr_status_t util_ldap_connection_cleanup(util_ldap_connection_t *ldc) + */ +LDAP_DECLARE_NONSTD(apr_status_t) util_ldap_connection_cleanup(void *param); + +/** + * Find a connection in a list of connections + * @param r The request record + * @param host The hostname to connect to (multiple hosts space separated) + * @param port The port to connect to + * @param binddn The DN to bind with + * @param bindpw The password to bind with + * @param deref The dereferencing behavior + * @param secure use SSL on the connection + * @tip Once a connection is found and returned, a lock will be acquired to + * lock that particular connection, so that another thread does not try and + * use this connection while it is busy. Once you are finished with a connection, + * apr_ldap_connection_close() must be called to release this connection. + * @deffunc util_ldap_connection_t *util_ldap_connection_find(request_rec *r, const char *host, int port, + * const char *binddn, const char *bindpw, deref_options deref, + * int netscapessl, int starttls) + */ +LDAP_DECLARE(util_ldap_connection_t *) util_ldap_connection_find(request_rec *r, const char *host, int port, + const char *binddn, const char *bindpw, deref_options deref, + int secure); + + +/** + * Compare two DNs for sameness + * @param r The request record + * @param ldc The LDAP connection being used. + * @param url The URL of the LDAP connection - used for deciding which cache to use. + * @param dn The first DN to compare. + * @param reqdn The DN to compare the first DN to. + * @param compare_dn_on_server Flag to determine whether the DNs should be checked using + * LDAP calls or with a direct string comparision. A direct + * string comparison is faster, but not as accurate - false + * negative comparisons are possible. + * @tip Two DNs can be equal and still fail a string comparison. Eg "dc=example,dc=com" + * and "dc=example, dc=com". Use the compare_dn_on_server unless there are serious + * performance issues. + * @deffunc int util_ldap_cache_comparedn(request_rec *r, util_ldap_connection_t *ldc, + * const char *url, const char *dn, const char *reqdn, + * int compare_dn_on_server) + */ +LDAP_DECLARE(int) util_ldap_cache_comparedn(request_rec *r, util_ldap_connection_t *ldc, + const char *url, const char *dn, const char *reqdn, + int compare_dn_on_server); + +/** + * A generic LDAP compare function + * @param r The request record + * @param ldc The LDAP connection being used. + * @param url The URL of the LDAP connection - used for deciding which cache to use. + * @param dn The DN of the object in which we do the compare. + * @param attrib The attribute within the object we are comparing for. + * @param value The value of the attribute we are trying to compare for. + * @tip Use this function to determine whether an attribute/value pair exists within an + * object. Typically this would be used to determine LDAP group membership. + * @deffunc int util_ldap_cache_compare(request_rec *r, util_ldap_connection_t *ldc, + * const char *url, const char *dn, const char *attrib, const char *value) + */ +LDAP_DECLARE(int) util_ldap_cache_compare(request_rec *r, util_ldap_connection_t *ldc, + const char *url, const char *dn, const char *attrib, const char *value); + +/** + * Checks a username/password combination by binding to the LDAP server + * @param r The request record + * @param ldc The LDAP connection being used. + * @param url The URL of the LDAP connection - used for deciding which cache to use. + * @param basedn The Base DN to search for the user in. + * @param scope LDAP scope of the search. + * @param attrs LDAP attributes to return in search. + * @param filter The user to search for in the form of an LDAP filter. This filter must return + * exactly one user for the check to be successful. + * @param bindpw The user password to bind as. + * @param binddn The DN of the user will be returned in this variable. + * @param retvals The values corresponding to the attributes requested in the attrs array. + * @tip The filter supplied will be searched for. If a single entry is returned, an attempt + * is made to bind as that user. If this bind succeeds, the user is not validated. + * @deffunc int util_ldap_cache_checkuserid(request_rec *r, util_ldap_connection_t *ldc, + * char *url, const char *basedn, int scope, char **attrs, + * char *filter, char *bindpw, char **binddn, char ***retvals) + */ +LDAP_DECLARE(int) util_ldap_cache_checkuserid(request_rec *r, util_ldap_connection_t *ldc, + const char *url, const char *basedn, int scope, char **attrs, + const char *filter, const char *bindpw, const char **binddn, const char ***retvals); + +/** + * Retrieves the LDAP DN of the user without the need to know user password + * @param r The request record + * @param ldc The LDAP connection being used. + * @param url The URL of the LDAP connection - used for deciding which cache to use. + * @param basedn The Base DN to search for the user in. + * @param scope LDAP scope of the search. + * @param attrs LDAP attributes to return in search. + * @param filter The user to search for in the form of an LDAP filter. This filter must return + * exactly one user for the check to be successful. + * @param binddn The DN of the user will be returned in this variable. + * @param retvals The values corresponding to the attributes requested in the attrs array. + * @tip The filter supplied will be searched for. A single entry matching the search is returned. + * @deffunc int util_ldap_cache_getuserdn(request_rec *r, util_ldap_connection_t *ldc, + * char *url, const char *basedn, int scope, char **attrs, + * char *filter, char **binddn, char ***retvals) + */ +LDAP_DECLARE(int) util_ldap_cache_getuserdn(request_rec *r, util_ldap_connection_t *ldc, + const char *url, const char *basedn, int scope, char **attrs, + const char *filter, const char **binddn, const char ***retvals); + +/** + * Checks if SSL support is available in mod_ldap + * @deffunc int util_ldap_ssl_supported(request_rec *r) + */ +LDAP_DECLARE(int) util_ldap_ssl_supported(request_rec *r); + +/* from apr_ldap_cache.c */ + +/** + * Init the LDAP cache + * @param pool The pool to use to initialise the cache + * @param reqsize The size of the shared memory segement to request. A size + * of zero requests the max size possible from + * apr_shmem_init() + * @deffunc void util_ldap_cache_init(apr_pool_t *p, util_ldap_state_t *st) + * @return The status code returned is the status code of the + * apr_smmem_init() call. Regardless of the status, the cache + * will be set up at least for in-process or in-thread operation. + */ +apr_status_t util_ldap_cache_init(apr_pool_t *pool, util_ldap_state_t *st); + +/* from apr_ldap_cache_mgr.c */ + +/** + * Display formatted stats for cache + * @param The pool to allocate the returned string from + * @tip This function returns a string allocated from the provided pool that describes + * various stats about the cache. + * @deffunc char *util_ald_cache_display(apr_pool_t *pool, util_ldap_state_t *st) + */ +char *util_ald_cache_display(request_rec *r, util_ldap_state_t *st); + +#endif /* APU_HAS_LDAP */ +#endif /* UTIL_LDAP_H */ diff --git a/rubbos/app/httpd-2.0.64/include/util_md5.h b/rubbos/app/httpd-2.0.64/include/util_md5.h new file mode 100644 index 00000000..6c5299de --- /dev/null +++ b/rubbos/app/httpd-2.0.64/include/util_md5.h @@ -0,0 +1,70 @@ +/* Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef APACHE_UTIL_MD5_H +#define APACHE_UTIL_MD5_H + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @package Apache MD5 library + */ + +#include "apr_md5.h" + +/** + * Create an MD5 checksum of a given string + * @param a Pool to allocate out of + * @param string String to get the checksum of + * @return The checksum + * @deffunc char *ap_md5(apr_pool_t *a, const unsigned char *string) + */ +AP_DECLARE(char *) ap_md5(apr_pool_t *a, const unsigned char *string); + +/** + * Create an MD5 checksum of a string of binary data + * @param a Pool to allocate out of + * @param buf Buffer to generate checksum for + * @param len The length of the buffer + * @return The checksum + * @deffunc char *ap_md5_binary(apr_pool_t *a, const unsigned char *buf, int len) + */ +AP_DECLARE(char *) ap_md5_binary(apr_pool_t *a, const unsigned char *buf, int len); + +/** + * Convert an MD5 checksum into a base64 encoding + * @param p The pool to allocate out of + * @param context The context to convert + * @return The converted encoding + * @deffunc char *ap_md5contextTo64(apr_pool_t *p, apr_md5_ctx_t *context) + */ +AP_DECLARE(char *) ap_md5contextTo64(apr_pool_t *p, apr_md5_ctx_t *context); + +/** + * Create an MD5 Digest for a given file + * @param p The pool to allocate out of + * @param infile The file to create the digest for + * @deffunc char *ap_md5digest(apr_pool_t *p, apr_file_t *infile) + */ +AP_DECLARE(char *) ap_md5digest(apr_pool_t *p, apr_file_t *infile); + +#ifdef __cplusplus +} +#endif + +#endif /* !APACHE_UTIL_MD5_H */ diff --git a/rubbos/app/httpd-2.0.64/include/util_script.h b/rubbos/app/httpd-2.0.64/include/util_script.h new file mode 100644 index 00000000..c68b81d9 --- /dev/null +++ b/rubbos/app/httpd-2.0.64/include/util_script.h @@ -0,0 +1,142 @@ +/* Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef APACHE_UTIL_SCRIPT_H +#define APACHE_UTIL_SCRIPT_H + +#include "apr_buckets.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @package Apache script tools + */ + +#ifndef APACHE_ARG_MAX +#ifdef _POSIX_ARG_MAX +#define APACHE_ARG_MAX _POSIX_ARG_MAX +#else +#define APACHE_ARG_MAX 512 +#endif +#endif + +/** + * Create an environment variable out of an Apache table of key-value pairs + * @param p pool to allocate out of + * @param t Apache table of key-value pairs + * @return An array containing the same key-value pairs suitable for + * use with an exec call. + * @deffunc char **ap_create_environment(apr_pool_t *p, apr_table_t *t) + */ +AP_DECLARE(char **) ap_create_environment(apr_pool_t *p, apr_table_t *t); + +/** + * This "cute" little function comes about because the path info on + * filenames and URLs aren't always the same. So we take the two, + * and find as much of the two that match as possible. + * @param uri The uri we are currently parsing + * @param path_info The current path info + * @return The length of the path info + * @deffunc int ap_find_path_info(const char *uri, const char *path_info) + */ +AP_DECLARE(int) ap_find_path_info(const char *uri, const char *path_info); + +/** + * Add CGI environment variables required by HTTP/1.1 to the request's + * environment table + * @param r the current request + * @deffunc void ap_add_cgi_vars(request_rec *r) + */ +AP_DECLARE(void) ap_add_cgi_vars(request_rec *r); + +/** + * Add common CGI environment variables to the requests environment table + * @param r The current request + * @deffunc void ap_add_common_vars(request_rec *r) + */ +AP_DECLARE(void) ap_add_common_vars(request_rec *r); + +/** + * Read headers output from a script, ensuring that the output is valid. If + * the output is valid, then the headers are added to the headers out of the + * current request + * @param r The current request + * @param f The file to read from + * @param buffer Empty when calling the function. On output, if there was an + * error, the string that cause the error is stored here. + * @return HTTP_OK on success, HTTP_INTERNAL_SERVER_ERROR otherwise + * @deffunc int ap_scan_script_header_err(request_rec *r, apr_file_t *f, char *buffer) + */ +AP_DECLARE(int) ap_scan_script_header_err(request_rec *r, apr_file_t *f, char *buffer); + +/** + * Read headers output from a script, ensuring that the output is valid. If + * the output is valid, then the headers are added to the headers out of the + * current request + * @param r The current request + * @param bb The brigade from which to read + * @param buffer Empty when calling the function. On output, if there was an + * error, the string that cause the error is stored here. + * @return HTTP_OK on success, HTTP_INTERNAL_SERVER_ERROR otherwise + * @deffunc int ap_scan_script_header_err_brigade(request_rec *r, apr_bucket_brigade *bb, char *buffer) + */ +AP_DECLARE(int) ap_scan_script_header_err_brigade(request_rec *r, + apr_bucket_brigade *bb, + char *buffer); + +/** + * Read headers strings from a script, ensuring that the output is valid. If + * the output is valid, then the headers are added to the headers out of the + * current request + * @param r The current request + * @param buffer Empty when calling the function. On output, if there was an + * error, the string that cause the error is stored here. + * @param termch Pointer to the last character parsed. + * @param termarg Pointer to an int to capture the last argument parsed. + * @param args String arguments to parse consecutively for headers, + * a NULL argument terminates the list. + * @return HTTP_OK on success, HTTP_INTERNAL_SERVER_ERROR otherwise + * @deffunc int ap_scan_script_header_err_core(request_rec *r, char *buffer, int (*getsfunc)(char *, int, void *), void *getsfunc_data) + */ +AP_DECLARE_NONSTD(int) ap_scan_script_header_err_strs(request_rec *r, + char *buffer, + const char **termch, + int *termarg, ...); + +/** + * Read headers output from a script, ensuring that the output is valid. If + * the output is valid, then the headers are added to the headers out of the + * current request + * @param r The current request + * @param buffer Empty when calling the function. On output, if there was an + * error, the string that cause the error is stored here. + * @param getsfunc Function to read the headers from. This function should + act like gets() + * @param getsfunc_data The place to read from + * @return HTTP_OK on success, HTTP_INTERNAL_SERVER_ERROR otherwise + * @deffunc int ap_scan_script_header_err_core(request_rec *r, char *buffer, int (*getsfunc)(char *, int, void *), void *getsfunc_data) + */ +AP_DECLARE(int) ap_scan_script_header_err_core(request_rec *r, char *buffer, + int (*getsfunc) (char *, int, void *), + void *getsfunc_data); + +#ifdef __cplusplus +} +#endif + +#endif /* !APACHE_UTIL_SCRIPT_H */ diff --git a/rubbos/app/httpd-2.0.64/include/util_time.h b/rubbos/app/httpd-2.0.64/include/util_time.h new file mode 100644 index 00000000..5e8e394f --- /dev/null +++ b/rubbos/app/httpd-2.0.64/include/util_time.h @@ -0,0 +1,85 @@ +/* Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef APACHE_UTIL_TIME_H +#define APACHE_UTIL_TIME_H + +#include "apr.h" +#include "apr_time.h" +#include "httpd.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @package Apache date-time handling functions + */ + +/* Maximum delta from the current time, in seconds, for a past time + * to qualify as "recent" for use in the ap_explode_recent_*() functions: + * (Must be a power of two minus one!) + */ +#define AP_TIME_RECENT_THRESHOLD 15 + +/** + * convert a recent time to its human readable components in local timezone + * @param tm the exploded time + * @param t the time to explode: MUST be within the last + * AP_TIME_RECENT_THRESHOLD seconds + * @note This is a faster alternative to apr_explode_localtime that uses + * a cache of pre-exploded time structures. It is useful for things + * that need to explode the current time multiple times per second, + * like loggers. + * @return APR_SUCCESS iff successful + */ +AP_DECLARE(apr_status_t) ap_explode_recent_localtime(apr_time_exp_t *tm, + apr_time_t t); + +/** + * convert a recent time to its human readable components in GMT timezone + * @param tm the exploded time + * @param t the time to explode: MUST be within the last + * AP_TIME_RECENT_THRESHOLD seconds + * @note This is a faster alternative to apr_time_exp_gmt that uses + * a cache of pre-exploded time structures. It is useful for things + * that need to explode the current time multiple times per second, + * like loggers. + * @return APR_SUCCESS iff successful + */ +AP_DECLARE(apr_status_t) ap_explode_recent_gmt(apr_time_exp_t *tm, + apr_time_t t); + + +/** + * format a recent timestamp in the ctime() format. + * @param date_str String to write to. + * @param t the time to convert + */ +AP_DECLARE(apr_status_t) ap_recent_ctime(char *date_str, apr_time_t t); + +/** + * format a recent timestamp in the RFC822 format + * @param date_str String to write to (must have length >= APR_RFC822_DATE_LEN) + * @param t the time to convert + */ +AP_DECLARE(apr_status_t) ap_recent_rfc822_date(char *date_str, apr_time_t t); + +#ifdef __cplusplus +} +#endif + +#endif /* !APACHE_UTIL_TIME_H */ diff --git a/rubbos/app/httpd-2.0.64/include/util_xml.h b/rubbos/app/httpd-2.0.64/include/util_xml.h new file mode 100644 index 00000000..4965b14e --- /dev/null +++ b/rubbos/app/httpd-2.0.64/include/util_xml.h @@ -0,0 +1,46 @@ +/* Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef UTIL_XML_H +#define UTIL_XML_H + +#include "apr_xml.h" + +#include "httpd.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @package Apache XML library + */ + +/** + * Get XML post data and parse it + * @param r The current request + * @param pdoc The XML post data + * @return HTTP status code + * @deffunc int ap_xml_parse_input(request_rec *r, apr_xml_doc **pdoc) + */ +AP_DECLARE(int) ap_xml_parse_input(request_rec *r, apr_xml_doc **pdoc); + + +#ifdef __cplusplus +} +#endif + +#endif /* UTIL_XML_H */ |