summaryrefslogtreecommitdiff
path: root/packages/httpd22/src
diff options
context:
space:
mode:
Diffstat (limited to 'packages/httpd22/src')
-rw-r--r--packages/httpd22/src/ap_config.inc255
-rw-r--r--packages/httpd22/src/ap_mmn.inc141
-rw-r--r--packages/httpd22/src/ap_mpm.inc180
-rw-r--r--packages/httpd22/src/ap_provider.inc68
-rw-r--r--packages/httpd22/src/ap_regex.inc138
-rw-r--r--packages/httpd22/src/ap_release.inc66
-rw-r--r--packages/httpd22/src/apr/apr.pas249
-rw-r--r--packages/httpd22/src/apr/apr_allocator.inc165
-rw-r--r--packages/httpd22/src/apr/apr_buckets.inc1483
-rw-r--r--packages/httpd22/src/apr/apr_dso.inc95
-rw-r--r--packages/httpd22/src/apr/apr_errno.inc1205
-rw-r--r--packages/httpd22/src/apr/apr_file_info.inc433
-rw-r--r--packages/httpd22/src/apr/apr_file_io.inc842
-rw-r--r--packages/httpd22/src/apr/apr_general.inc219
-rw-r--r--packages/httpd22/src/apr/apr_hash.inc232
-rw-r--r--packages/httpd22/src/apr/apr_lib.inc223
-rw-r--r--packages/httpd22/src/apr/apr_network_io.inc851
-rw-r--r--packages/httpd22/src/apr/apr_poll.inc193
-rw-r--r--packages/httpd22/src/apr/apr_pools.inc702
-rw-r--r--packages/httpd22/src/apr/apr_portable.inc538
-rw-r--r--packages/httpd22/src/apr/apr_signal.inc103
-rw-r--r--packages/httpd22/src/apr/apr_strings.inc379
-rw-r--r--packages/httpd22/src/apr/apr_tables.inc447
-rw-r--r--packages/httpd22/src/apr/apr_thread_proc.inc865
-rw-r--r--packages/httpd22/src/apr/apr_time.inc244
-rw-r--r--packages/httpd22/src/apr/apr_user.inc161
-rw-r--r--packages/httpd22/src/apr/apr_version.inc141
-rw-r--r--packages/httpd22/src/apriconv/api_version.inc99
-rw-r--r--packages/httpd22/src/apriconv/apr_iconv.inc113
-rw-r--r--packages/httpd22/src/apriconv/apriconv.pas59
-rw-r--r--packages/httpd22/src/aprutil/apr_md5.inc162
-rw-r--r--packages/httpd22/src/aprutil/apr_uri.inc170
-rw-r--r--packages/httpd22/src/aprutil/apr_xlate.inc155
-rw-r--r--packages/httpd22/src/aprutil/apr_xml.inc367
-rw-r--r--packages/httpd22/src/aprutil/aprutil.pas64
-rw-r--r--packages/httpd22/src/http_config.inc1206
-rw-r--r--packages/httpd22/src/http_connection.inc167
-rw-r--r--packages/httpd22/src/http_core.inc741
-rw-r--r--packages/httpd22/src/http_log.inc349
-rw-r--r--packages/httpd22/src/http_main.inc54
-rw-r--r--packages/httpd22/src/http_protocol.inc824
-rw-r--r--packages/httpd22/src/http_request.inc460
-rw-r--r--packages/httpd22/src/http_vhost.inc114
-rw-r--r--packages/httpd22/src/httpd.inc1783
-rw-r--r--packages/httpd22/src/httpd.pas170
-rw-r--r--packages/httpd22/src/util_cfgtree.inc77
-rw-r--r--packages/httpd22/src/util_filter.inc603
-rw-r--r--packages/httpd22/src/util_md5.inc66
-rw-r--r--packages/httpd22/src/util_script.inc140
-rw-r--r--packages/httpd22/src/util_time.inc78
50 files changed, 18639 insertions, 0 deletions
diff --git a/packages/httpd22/src/ap_config.inc b/packages/httpd22/src/ap_config.inc
new file mode 100644
index 0000000000..b29227050e
--- /dev/null
+++ b/packages/httpd22/src/ap_config.inc
@@ -0,0 +1,255 @@
+{ 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.
+ }
+
+{#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(SUNOS) or defined(IRIX) or defined(NEXT) or defined(AUX)
+ or defined (UW) or defined(LYNXOS) or 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. }
+{$ifdef APR_HAS_OTHER_CHILD}
+{$define AP_HAVE_RELIABLE_PIPED_LOGS}
+{$endif}
+
+{ Presume that the compiler supports C99-style designated
+ * initializers if using GCC (but not G++), or for any other compiler
+ * which claims C99 support. }
+//#if (defined(__GNUC__) && !defined(__cplusplus)) \
+// || (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L)
+//#define AP_HAVE_DESIGNATED_INITIALIZER
+{.$endif}
diff --git a/packages/httpd22/src/ap_mmn.inc b/packages/httpd22/src/ap_mmn.inc
new file mode 100644
index 0000000000..b456f768c5
--- /dev/null
+++ b/packages/httpd22/src/ap_mmn.inc
@@ -0,0 +1,141 @@
+{ 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.
+ }
+
+{
+ * @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.1 (2.1.0-dev) allow_encoded_slashes added to core_dir_config
+ * 20020903.2 (2.0.46-dev) add ap_escape_logitem
+ * 20030213.1 (2.1.0-dev) changed log_writer optional fn's to return previous
+ * handler
+ * 20030821 (2.1.0-dev) bumped mod_include's entire API
+ * 20030821.1 (2.1.0-dev) added XHTML doctypes
+ * 20030821.2 (2.1.0-dev) added ap_escape_errorlog_item
+ * 20030821.3 (2.1.0-dev) added ap_get_server_revision / ap_version_t
+ * 20040425 (2.1.0-dev) removed ap_add_named_module API
+ * changed ap_add_module, ap_add_loaded_module,
+ * ap_setup_prelinked_modules, ap_process_resource_config
+ * 20040425.1 (2.1.0-dev) Added ap_module_symbol_t and ap_prelinked_module_symbols
+ * 20050101.0 (2.1.2-dev) Axed misnamed http_method for http_scheme (which it was!)
+ * 20050127.0 (2.1.3-dev) renamed regex_t->ap_regex_t, regmatch_t->ap_regmatch_t,
+ * REG_*->AP_REG_*, removed reg* in place of ap_reg*;
+ * added ap_regex.h
+ * 20050217.0 (2.1.3-dev) Axed find_child_by_pid, mpm_*_completion_context (winnt mpm)
+ * symbols from the public sector, and decorated real_exit_code
+ * with ap_ in the win32 os.h.
+ * 20050305.0 (2.1.4-dev) added pid and generation fields to worker_score
+ * 20050305.1 (2.1.5-dev) added ap_vhost_iterate_given_conn.
+ * 20050305.2 (2.1.5-dev) added AP_INIT_TAKE_ARGV.
+ * 20050305.3 (2.1.5-dev) added Protocol Framework.
+ * 20050701.0 (2.1.7-dev) Bump MODULE_MAGIC_COOKIE to "AP21"!
+ * 20050701.1 (2.1.7-dev) trace_enable member added to core server_config
+ * 20050708.0 (2.1.7-dev) Bump MODULE_MAGIC_COOKIE to "AP22"!
+ * 20050708.1 (2.1.7-dev) add proxy request_status hook (minor)
+ * 20051006.0 (2.1.8-dev) NET_TIME filter eliminated
+ * 20051115.0 (2.1.10-dev/2.2.0) add use_canonical_phys_port to core_dir_config
+ * 20051115.1 (2.2.1) flush_packets and flush_wait members added to
+ * proxy_server (minor)
+ * 20051115.2 (2.2.2) added inreslist member to proxy_conn_rec (minor)
+ * 20051115.3 (2.2.3) Added server_scheme member to server_rec (minor)
+ }
+const
+
+ MODULE_MAGIC_COOKIE = $41503232; { "AP22" }
+
+ MODULE_MAGIC_NUMBER_MAJOR = 20051115; { For 2.2.3 }
+
+ MODULE_MAGIC_NUMBER_MINOR = 3; // 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 }
+ MODULE_MAGIC_NUMBER = MODULE_MAGIC_NUMBER_MAJOR;
+//#define MODULE_MAGIC_AT_LEAST old_broken_macro_we_hope_you_are_not_using
+
diff --git a/packages/httpd22/src/ap_mpm.inc b/packages/httpd22/src/ap_mpm.inc
new file mode 100644
index 0000000000..ed6a1bb32f
--- /dev/null
+++ b/packages/httpd22/src/ap_mpm.inc
@@ -0,0 +1,180 @@
+{ 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.
+ }
+
+//#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)
+ }
+function ap_mpm_run(pconf, plog: Papr_pool_t; server_conf: Pserver_rec): Integer;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_mpm_run' + LibSuff12;
+
+{
+ * 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)
+ }
+function ap_graceful_stop_signalled: Integer;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_graceful_stop_signalled' + LibSuff0;
+
+{
+ * 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.
+ }
+function ap_os_create_privileged_process(
+ const r: Prequest_rec;
+ newproc: Papr_proc_t;
+ const progname, args, env: PChar;
+ attr: Papr_procattr_t; p: Papr_pool_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_os_create_privileged_process' + LibSuff28;
+
+const
+{ Subtypes/Values for AP_MPMQ_IS_THREADED and AP_MPMQ_IS_FORKED }
+ AP_MPMQ_NOT_SUPPORTED = 0; { This value specifies whether }
+ { an MPM is capable of }
+ { threading or forking. }
+ AP_MPMQ_STATIC = 1; { This value specifies whether }
+ { an MPM is using a static # }
+ { threads or daemons. }
+ AP_MPMQ_DYNAMIC = 2; { This value specifies whether }
+ { an MPM is using a dynamic # }
+ { threads or daemons. }
+
+{ Values returned for AP_MPMQ_MPM_STATE }
+ AP_MPMQ_STARTING = 0;
+ AP_MPMQ_RUNNING = 1;
+ AP_MPMQ_STOPPING = 2;
+
+ AP_MPMQ_MAX_DAEMON_USED = 1; { Max # of daemons used so far }
+ AP_MPMQ_IS_THREADED = 2; { MPM can do threading }
+ AP_MPMQ_IS_FORKED = 3; { MPM can do forking }
+ AP_MPMQ_HARD_LIMIT_DAEMONS = 4; { The compiled max # daemons }
+ AP_MPMQ_HARD_LIMIT_THREADS = 5; { The compiled max # threads }
+ AP_MPMQ_MAX_THREADS = 6; { # of threads/child by config }
+ AP_MPMQ_MIN_SPARE_DAEMONS = 7; { Min # of spare daemons }
+ AP_MPMQ_MIN_SPARE_THREADS = 8; { Min # of spare threads }
+ AP_MPMQ_MAX_SPARE_DAEMONS = 9; { Max # of spare daemons }
+ AP_MPMQ_MAX_SPARE_THREADS = 10; { Max # of spare threads }
+ AP_MPMQ_MAX_REQUESTS_DAEMON = 11; { Max # of requests per daemon }
+ AP_MPMQ_MAX_DAEMONS = 12; { Max # of daemons by config }
+ AP_MPMQ_MPM_STATE = 13; { starting, running, stopping }
+ AP_MPMQ_IS_ASYNC = 14; { MPM can process async connections }
+
+{
+ * 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)
+ }
+function ap_mpm_query(query_code: Integer; result: PInteger): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_mpm_query' + LibSuff8;
+
+{ 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}
+
+{$ifdef AP_ENABLE_EXCEPTION_HOOK}
+type
+ ap_exception_info_t = record
+ sig: Integer;
+ pid: pid_t;
+ end;
+
+AP_DECLARE_HOOK(int,fatal_exception,(ap_exception_info_t *ei))
+{$endif} {AP_ENABLE_EXCEPTION_HOOK}
+
diff --git a/packages/httpd22/src/ap_provider.inc b/packages/httpd22/src/ap_provider.inc
new file mode 100644
index 0000000000..4fa67202f7
--- /dev/null
+++ b/packages/httpd22/src/ap_provider.inc
@@ -0,0 +1,68 @@
+{ 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.
+ }
+
+{
+ * @package Provider API
+ }
+
+//#include "ap_config.h"
+
+type
+ ap_list_provider_names_t = record
+ provider_name: PChar;
+ end;
+
+{
+ * 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
+ }
+function ap_register_provider(pool: Papr_pool_t;
+ const provider_group, provider_name, provider_version: PChar;
+ const provider: Pointer): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_register_provider' + LibSuff20;
+
+{
+ * 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
+ }
+function ap_lookup_provider(provider_group, provider_name, provider_version: PChar): Pointer;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_lookup_provider' + LibSuff12;
+
+{
+ * This function is used to retrieve a list (array) of provider
+ * names from the specified group with the specified version.
+ * @param pool The pool to create any storage from
+ * @param provider_group The group to look for this provider in
+ * @param provider_version The version for the provider
+ * @return pointer to array of ap_list_provider_names_t of provider names (could be empty)
+ }
+function ap_list_provider_names(pool: Papr_pool_t;
+ const provider_group, provider_version: PChar): Papr_array_header_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_list_provider_names' + LibSuff12;
+
diff --git a/packages/httpd22/src/ap_regex.inc b/packages/httpd22/src/ap_regex.inc
new file mode 100644
index 0000000000..dc870f1420
--- /dev/null
+++ b/packages/httpd22/src/ap_regex.inc
@@ -0,0 +1,138 @@
+{ 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.
+ }
+
+{ Derived from PCRE's pcreposix.h.
+
+ Copyright (c) 1997-2004 University of Cambridge
+
+-----------------------------------------------------------------------------
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ * Neither the name of the University of Cambridge nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+-----------------------------------------------------------------------------
+}
+
+{
+ * @file ap_regex.h
+ * @brief Apache Regex defines
+ }
+
+//#include "apr.h"
+
+{ Options for ap_regexec: }
+
+const
+ AP_REG_ICASE = $01; { use a case-insensitive match }
+ AP_REG_NEWLINE = $02; { don't match newlines against '.' etc }
+ AP_REG_NOTBOL = $04; { ^ will not match against start-of-string }
+ AP_REG_NOTEOL = $08; { $ will not match against end-of-string }
+
+ AP_REG_EXTENDED = (0); { unused }
+ AP_REG_NOSUB = (0); { unused }
+
+{ Error values: }
+
+ AP_REG_ASSERT = 1; { internal error ? }
+ AP_REG_ESPACE = 2; { failed to get memory }
+ AP_REG_INVARG = 3; { invalid argument }
+ AP_REG_NOMATCH = 4; { match failed }
+
+{ The structure representing a compiled regular expression. }
+type
+ Pap_regex_t = ^ap_regex_t;
+
+ ap_regex_t = record
+ re_pcre: Pointer;
+ re_nsub: apr_size_t;
+ re_erroffset: apr_size_t;
+ end;
+
+{ The structure in which a captured offset is returned. }
+ Pap_regmatch_t = ^ap_regmatch_t;
+
+ ap_regmatch_t = record
+ rm_so: Integer;
+ rm_eo: Integer;
+ end;
+
+{ The functions }
+
+{
+ * Compile a regular expression.
+ * @param preg Returned compiled regex
+ * @param regex The regular expression string
+ * @param cflags Must be zero (currently).
+ * @return Zero on success or non-zero on error
+ }
+function ap_regcomp(preg: Pap_regex_t; const regex: PChar; cflags: Integer): Integer;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_regcomp' + LibSuff12;
+
+{
+ * Match a NUL-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 AP_REG_* flags
+ * @return 0 for successful match, #REG_NOMATCH otherwise
+ }
+function ap_regexec(const preg: Pap_regex_t; const string_: PChar;
+ nmatch: apr_size_t; pmatch: Pap_regmatch_t; eflags: Integer): Integer;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_regexec' + LibSuff20;
+
+{
+ * 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
+ }
+function ap_regerror(errcord: Integer; const preg: Pap_regex_t;
+ errbuf: PChar; errbuf_size: apr_size_t): apr_size_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_regerror' + LibSuff16;
+
+{ Destroy a pre-compiled regex.
+ * @param preg The pre-compiled regex to free.
+ }
+procedure ap_regfree(preg: Pap_regex_t);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_regfree' + LibSuff4;
+
diff --git a/packages/httpd22/src/ap_release.inc b/packages/httpd22/src/ap_release.inc
new file mode 100644
index 0000000000..727e0abeee
--- /dev/null
+++ b/packages/httpd22/src/ap_release.inc
@@ -0,0 +1,66 @@
+{ 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.
+ }
+
+//#include "apr_general.h" /* stringify */
+
+const
+ AP_SERVER_COPYRIGHT =
+ 'Copyright 2006 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"
+ }
+ AP_SERVER_BASEVENDOR = 'Apache Software Foundation';
+ AP_SERVER_BASEPROJECT = 'Apache HTTP Server';
+ AP_SERVER_BASEPRODUCT = 'Apache';
+
+ AP_SERVER_MAJORVERSION_NUMBER = 2;
+ AP_SERVER_MINORVERSION_NUMBER = 2;
+ AP_SERVER_PATCHLEVEL_NUMBER = 3;
+ AP_SERVER_DEVBUILD_BOOLEAN = 0;
+
+{$ifdef AP_SERVER_DEVBUILD_BOOLEAN}
+ AP_SERVER_ADD_STRING = '-dev';
+{$else}
+ AP_SERVER_ADD_STRING = '';
+{$endif}
+
+{ 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
+
+/* macro for Win32 .rc files using numeric csv representation */
+#define AP_SERVER_PATCHLEVEL_CSV AP_SERVER_MAJORVERSION_NUMBER ##, \
+ ##AP_SERVER_MINORVERSION_NUMBER ##, \
+ ##AP_SERVER_PATCHLEVEL_NUMBER
+}
+
diff --git a/packages/httpd22/src/apr/apr.pas b/packages/httpd22/src/apr/apr.pas
new file mode 100644
index 0000000000..d0faf92d35
--- /dev/null
+++ b/packages/httpd22/src/apr/apr.pas
@@ -0,0 +1,249 @@
+{
+ apr.pas
+
+ Copyright (C) 2006 Felipe Monteiro de Carvalho
+
+ This unit is a pascal binding for the Apache 2.0.58 headers.
+ The headers were released under the following copyright:
+}
+{ Copyright 2000-2005 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed 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.
+ }
+unit apr;
+
+interface
+
+{$ifdef fpc}
+ {$mode delphi}{$H+}
+{$endif}
+
+{$IFNDEF FPC}
+ {$DEFINE WINDOWS}
+{$ENDIF}
+
+{$IFDEF WIN32}
+ {$DEFINE WINDOWS}
+{$ENDIF}
+
+{$ifdef Unix}
+ {$PACKRECORDS C}
+{$endif}
+
+uses
+{$ifdef WINDOWS}
+ Windows, winsock,
+{$ELSE}
+ UnixType,
+{$ENDIF}
+ SysUtils, ctypes;
+
+const
+{$IFDEF WINDOWS}
+ LibAPR = 'libapr-1.dll';
+{$ELSE}
+ LibAPR = '';
+{$ENDIF}
+
+{$IFDEF WINDOWS}
+ LibNamePrefix = '_';
+ LibSuff0 = '@0';
+ LibSuff4 = '@4';
+ LibSuff8 = '@8';
+ LibSuff12 = '@12';
+ LibSuff16 = '@16';
+ LibSuff20 = '@20';
+ LibSuff24 = '@24';
+ LibSuff28 = '@28';
+ LibSuff32 = '@32';
+{$ELSE}
+ LibNamePrefix = '';
+ LibSuff0 = '';
+ LibSuff4 = '';
+ LibSuff8 = '';
+ LibSuff12 = '';
+ LibSuff16 = '';
+ LibSuff20 = '';
+ LibSuff24 = '';
+ LibSuff28 = '';
+ LibSuff32 = '';
+{$ENDIF}
+
+type
+ uid_t = Integer;
+ gid_t = Integer;
+ time_t = LongInt;
+ size_t = Integer;
+ pid_t = Integer;
+ Ppid_t = ^pid_t;
+ apr_uint16_t = Word;
+ apr_uint32_t = Cardinal;
+ apr_int64_t = Int64;
+ apr_uint64_t = Int64;
+ apr_socklen_t = Integer;
+ apr_byte_t = Byte;
+
+ apr_uint32_tso_handle_t = cuint;
+
+type
+ {$IFDEF WINDOWS}
+ apr_off_t = Int64;
+ {$ENDIF}
+ {$IFDEF UNIX}
+ {$ifdef CPU64}
+ apr_off_t = int64;
+ {$else}
+ apr_off_t = Integer;
+ {$endif}
+ {$ENDIF}
+
+ apr_int32_t = Integer;
+ Papr_int32_t = ^Integer;
+ apr_size_t = size_t;
+ Papr_size_t = ^apr_size_t;
+ apr_int16_t = SmallInt;
+ Papr_int16_t = ^SmallInt;
+
+ // Network structures
+
+ sockaddr = record
+ sa_family: cushort; // address family, AF_xxx
+ sa_data: array [1..14] of Char; // (NBO) 14 bytes of protocol address
+ end;
+
+ in_addr = record
+ s_addr: culong; // load with inet_aton()
+ end;
+
+{$ifndef windows}
+
+ va_list = Pointer;
+
+ sockaddr_in = record
+ sin_family: cshort; // e.g. AF_INET
+ sin_port: cushort; // e.g. htons(3490)
+ sin_addr: in_addr; // see struct in_addr, below
+ sin_zero: array [1..8] of Char; // zero this if you want to
+ end;
+
+{$endif}
+
+ in6_addr = record
+ Case Integer of
+ 1: (u6_addr8: array [1..16] of Byte);
+ 2: (u6_addr16: array [1..8] of Word);
+ 3: (u6_addr32: array [1..4] of Cardinal);
+ end;
+//#define s6_addr in6_u.u6_addr8
+//#define s6_addr16 in6_u.u6_addr16
+//#define s6_addr32 in6_u.u6_addr32
+
+ sockaddr_in6 = record
+ sin6_family: cushort;
+ sin6_port: Word;
+ sin6_flowinfo: Cardinal;
+ sin6_addr: in6_addr;
+ sin6_scope_id: Cardinal;
+ end;
+
+ // TEMPORARY
+
+ Papr_xml_ns_scope = Pointer;
+
+ Pap_method_list_t = Pointer;
+ Pcore_output_filter_ctx_t = Pointer;
+ Pap_directive_t = Pointer;
+ Pap_filter_t = Pointer;
+ Papr_file_t = Pointer;
+ Papr_off_t = Pointer;
+
+ iovec = record
+ /// byte count to read/write
+ iov_len: culong;
+ /// data to be read/written
+ iov_base: PChar;
+ end;
+
+ Piovec = ^iovec;
+
+{$include apr_errno.inc}
+{$include apr_pools.inc}
+{$include apr_general.inc}
+{$include apr_dso.inc}
+{$include apr_user.inc}
+{$include apr_time.inc}
+{$include apr_tables.inc}
+{$include apr_file_info.inc}
+{$include apr_file_io.inc}
+{$include apr_strings.inc}
+{$include apr_lib.inc}
+{$include apr_signal.inc}
+{$include apr_network_io.inc}
+{.$include apr_portable.inc}
+
+{.$include ../aprutils/apr_uri.inc}
+
+{$include apr_thread_proc.inc}
+{$include apr_version.inc}
+{$include apr_poll.inc}
+
+implementation
+
+{
+ Macros transformed into functions in the translation
+}
+
+{ apr_pools.inc }
+
+{$ifndef DOXYGEN}
+function apr_pool_create(newpool: PPapr_pool_t; parent: Papr_pool_t): apr_status_t;
+begin
+ Result := apr_pool_create_ex(newpool, parent, nil, nil);
+end;
+{$endif}
+
+function apr_pool_sub_make(newpool: PPapr_pool_t; parent: Papr_pool_t;
+ abort_fn: apr_abortfunc_t): apr_status_t;
+begin
+ Result := apr_pool_create_ex(newpool, parent, abort_fn, nil);
+end;
+
+{ apr_lib.inc }
+
+function apr_tolower(c: Char): Char;
+var
+ buf: array[0..1] of Char;
+begin
+ buf[0] := c;
+ buf[1] := #0;
+
+ buf := StrLower(@buf[0]);
+
+ Result := buf[0];
+end;
+
+function apr_toupper(c: Char): Char;
+var
+ buf: array[0..1] of Char;
+begin
+ buf[0] := c;
+ buf[1] := #0;
+
+ buf := StrUpper(@buf[0]);
+
+ Result := buf[0];
+end;
+
+end.
+
diff --git a/packages/httpd22/src/apr/apr_allocator.inc b/packages/httpd22/src/apr/apr_allocator.inc
new file mode 100644
index 0000000000..b2a2e2e656
--- /dev/null
+++ b/packages/httpd22/src/apr/apr_allocator.inc
@@ -0,0 +1,165 @@
+{ Copyright 2000-2005 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed 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.
+ }
+
+{
+ * @file apr_allocator.h
+ * @brief APR Internal Memory Allocation
+ }
+
+{#include "apr.h"
+#include "apr_errno.h"
+#define APR_WANT_MEMFUNC < For no good reason?
+#include "apr_want.h"}
+
+{
+ * @defgroup apr_allocator Internal Memory Allocation
+ * @ingroup APR
+ }
+
+type
+{ the allocator structure }
+
+ apr_allocator_t = record end;
+ Papr_allocator_t = ^apr_allocator_t;
+ PPapr_allocator_t = ^Papr_allocator_t;
+
+{ the structure which holds information about the allocation }
+
+ Papr_memnode_t = ^apr_memnode_t;
+ PPapr_memnode_t = ^Papr_memnode_t;
+
+{ basic memory node structure
+ * @note The next, ref and first_avail fields are available for use by the
+ * caller of apr_allocator_alloc(), the remaining fields are read-only.
+ * The next field has to be used with caution and sensibly set when the
+ * memnode is passed back to apr_allocator_free(). See apr_allocator_free()
+ * for details.
+ * The ref and first_avail fields will be properly restored by
+ * apr_allocator_free().
+ }
+
+ apr_memnode_t = record
+ next: Papr_memnode_t; {< next memnode }
+ ref: PPapr_memnode_t; {< reference to self }
+ index: apr_uint32_t; {< size }
+ free_index: apr_uint32_t; {< how much free }
+ first_avail: PChar; {< pointer to first free memory }
+ endp: PChar; {< pointer to end of free memory }
+ end;
+
+{ The base size of a memory node - aligned. }
+//#define APR_MEMNODE_T_SIZE APR_ALIGN_DEFAULT(sizeof(apr_memnode_t))
+
+{ Symbolic constants }
+const
+ APR_ALLOCATOR_MAX_FREE_UNLIMITED = 0;
+
+{
+ * Create a new allocator
+ * @param allocator The allocator we have just created.
+ *
+ }
+function apr_allocator_create(allocator: PPapr_allocator_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_allocator_create' + LibSuff4;
+
+{
+ * Destroy an allocator
+ * @param allocator The allocator to be destroyed
+ * @remark Any memnodes not given back to the allocator prior to destroying
+ * will _not_ be free()d.
+ }
+procedure apr_allocator_destroy(allocator: Papr_allocator_t);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_allocator_destroy' + LibSuff4;
+
+{
+ * Allocate a block of mem from the allocator
+ * @param allocator The allocator to allocate from
+ * @param size The size of the mem to allocate (excluding the
+ * memnode structure)
+ }
+function apr_allocator_alloc(allocator: Papr_allocator_t;
+ size: apr_size_t): Papr_memnode_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_allocator_alloc' + LibSuff8;
+
+{
+ * Free a list of blocks of mem, giving them back to the allocator.
+ * The list is typically terminated by a memnode with its next field
+ * set to NULL.
+ * @param allocator The allocator to give the mem back to
+ * @param memnode The memory node to return
+ }
+procedure apr_allocator_free(allocator: Papr_allocator_t; memnode: Papr_memnode_t);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_allocator_free' + LibSuff8;
+
+//#include "apr_pools.h"
+
+{
+ * Set the owner of the allocator
+ * @param allocator The allocator to set the owner for
+ * @param pool The pool that is to own the allocator
+ * @remark Typically pool is the highest level pool using the allocator
+ }
+{
+ * XXX: see if we can come up with something a bit better. Currently
+ * you can make a pool an owner, but if the pool doesn't use the allocator
+ * the allocator will never be destroyed.
+ }
+procedure apr_allocator_owner_set(allocator: Papr_allocator_t; pool: Papr_pool_t);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_allocator_owner_set' + LibSuff8;
+
+{
+ * Get the current owner of the allocator
+ * @param allocator The allocator to get the owner from
+ }
+function apr_allocator_owner_get(allocator: Papr_allocator_t): Papr_pool_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_allocator_owner_get' + LibSuff4;
+
+{
+ * Set the current threshold at which the allocator should start
+ * giving blocks back to the system.
+ * @param allocator The allocator the set the threshold on
+ * @param size The threshold. 0 == unlimited.
+ }
+procedure apr_allocator_max_free_set(allocator: Papr_allocator_t; size: apr_size_t);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_allocator_max_free_set' + LibSuff8;
+
+{#include "apr_thread_mutex.h"}
+
+{$ifdef APR_HAS_THREADS}
+{
+ * Set a mutex for the allocator to use
+ * @param allocator The allocator to set the mutex for
+ * @param mutex The mutex
+ }
+APR_DECLARE(void) apr_allocator_mutex_set(apr_allocator_t *allocator,
+ apr_thread_mutex_t *mutex);
+
+{
+ * Get the mutex currently set for the allocator
+ * @param allocator The allocator
+ }
+APR_DECLARE(apr_thread_mutex_t *) apr_allocator_mutex_get(
+ apr_allocator_t *allocator);
+
+{$endif} { APR_HAS_THREADS }
+
diff --git a/packages/httpd22/src/apr/apr_buckets.inc b/packages/httpd22/src/apr/apr_buckets.inc
new file mode 100644
index 0000000000..2352133860
--- /dev/null
+++ b/packages/httpd22/src/apr/apr_buckets.inc
@@ -0,0 +1,1483 @@
+{ Copyright 2000-2005 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed 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.
+ }
+{
+ * @file apr_buckets.h
+ * @brief APR-UTIL Buckets/Bucket Brigades
+ }
+
+{#if defined(APR_BUCKET_DEBUG) && !defined(APR_RING_DEBUG)
+#define APR_RING_DEBUG
+#endif
+
+#include "apu.h"
+#include "apr_network_io.h"
+#include "apr_file_io.h"
+#include "apr_general.h"
+#include "apr_mmap.h"
+#include "apr_errno.h"
+#include "apr_ring.h"
+#include "apr.h"
+#if APR_HAVE_SYS_UIO_H
+#include <sys/uio.h> for struct iovec
+#endif
+#if APR_HAVE_STDARG_H
+#include <stdarg.h>
+#endif}
+
+{
+ * @defgroup APR_Util_Bucket_Brigades Bucket Brigades
+ * @ingroup APR_Util
+ }
+
+{ default bucket buffer size - 8KB minus room for memory allocator headers }
+const
+ APR_BUCKET_BUFF_SIZE = 8000;
+
+{ Determines how a bucket or brigade should be read }
+type
+ apr_read_type_e = (
+ APR_BLOCK_READ, {< block until data becomes available }
+ APR_NONBLOCK_READ {< return immediately if no data is available }
+ );
+
+{
+ * The one-sentence buzzword-laden overview: Bucket brigades represent
+ * a complex data stream that can be passed through a layered IO
+ * system without unnecessary copying. A longer overview follows...
+ *
+ * A bucket brigade is a doubly linked list (ring) of buckets, so we
+ * aren't limited to inserting at the front and removing at the end.
+ * Buckets are only passed around as members of a brigade, although
+ * singleton buckets can occur for short periods of time.
+ *
+ * Buckets are data stores of various types. They can refer to data in
+ * memory, or part of a file or mmap area, or the output of a process,
+ * etc. Buckets also have some type-dependent accessor functions:
+ * read, split, copy, setaside, and destroy.
+ *
+ * read returns the address and size of the data in the bucket. If the
+ * data isn't in memory then it is read in and the bucket changes type
+ * so that it can refer to the new location of the data. If all the
+ * data doesn't fit in the bucket then a new bucket is inserted into
+ * the brigade to hold the rest of it.
+ *
+ * split divides the data in a bucket into two regions. After a split
+ * the original bucket refers to the first part of the data and a new
+ * bucket inserted into the brigade after the original bucket refers
+ * to the second part of the data. Reference counts are maintained as
+ * necessary.
+ *
+ * setaside ensures that the data in the bucket has a long enough
+ * lifetime. Sometimes it is convenient to create a bucket referring
+ * to data on the stack in the expectation that it will be consumed
+ * (output to the network) before the stack is unwound. If that
+ * expectation turns out not to be valid, the setaside function is
+ * called to move the data somewhere safer.
+ *
+ * copy makes a duplicate of the bucket structure as long as it's
+ * possible to have multiple references to a single copy of the
+ * data itself. Not all bucket types can be copied.
+ *
+ * destroy maintains the reference counts on the resources used by a
+ * bucket and frees them if necessary.
+ *
+ * Note: all of the above functions have wrapper macros (apr_bucket_read(),
+ * apr_bucket_destroy(), etc), and those macros should be used rather
+ * than using the function pointers directly.
+ *
+ * To write a bucket brigade, they are first made into an iovec, so that we
+ * don't write too little data at one time. Currently we ignore compacting the
+ * buckets into as few buckets as possible, but if we really want good
+ * performance, then we need to compact the buckets before we convert to an
+ * iovec, or possibly while we are converting to an iovec.
+ }
+
+{
+ * Forward declaration of the main types.
+ }
+
+{ @see apr_bucket_brigade }
+ Papr_bucket_brigade = ^apr_bucket_brigade;
+ PPapr_bucket_brigade = ^Papr_bucket_brigade;
+{ @see apr_bucket }
+ Papr_bucket = ^apr_bucket;
+ PPapr_bucket = ^Papr_bucket;
+{ @see apr_bucket_alloc_t }
+ apr_bucket_alloc_t = record end;
+ Papr_bucket_alloc_t = ^apr_bucket_alloc_t;
+
+{ @see apr_bucket_type_t }
+ Papr_bucket_type_t = ^apr_bucket_type_t;
+
+ is_metadata = (
+ { This bucket type represents actual data to send to the client. }
+ APR_BUCKET_DATA = 0,
+ { This bucket type represents metadata. }
+ APR_BUCKET_METADATA = 1
+ );
+
+ destroy_t = procedure (data: Pointer);
+
+ read_t = function (b: Papr_bucket; const str: PPChar; len: Papr_size_t;
+ block: apr_read_type_e): apr_status_t;
+
+ setaside_t = function (e: Papr_bucket; pool: Papr_pool_t): apr_status_t;
+
+ split_t = function (e: Papr_bucket; point: apr_size_t): apr_status_t;
+
+ copy_t = function (e: Papr_bucket; c: PPapr_bucket): apr_status_t;
+{
+ * Basic bucket type
+ }
+ apr_bucket_type_t = record
+ {
+ * The name of the bucket type
+ }
+ name: PChar;
+ {
+ * The number of functions this bucket understands. Can not be less than
+ * five.
+ }
+ num_func: Integer;
+ {
+ * Whether the bucket contains metadata (ie, information that
+ * describes the regular contents of the brigade). The metadata
+ * is not returned by apr_bucket_read() and is not indicated by
+ * the ->length of the apr_bucket itself. In other words, an
+ * empty bucket is safe to arbitrarily remove if and only if it
+ * contains no metadata. In this sense, "data" is just raw bytes
+ * that are the "content" of the brigade and "metadata" describes
+ * that data but is not a proper part of it.
+ }
+
+ { Declaration moved up }
+
+ {
+ * Free the private data and any resources used by the bucket (if they
+ * aren't shared with another bucket). This function is required to be
+ * implemented for all bucket types, though it might be a no-op on some
+ * of them (namely ones that never allocate any private data structures).
+ * @param data The private data pointer from the bucket to be destroyed
+ }
+ destroy: destroy_t;
+
+ {
+ * Read the data from the bucket. This is required to be implemented
+ * for all bucket types.
+ * @param b The bucket to read from
+ * @param str A place to store the data read. Allocation should only be
+ * done if absolutely necessary.
+ * @param len The amount of data read.
+ * @param block Should this read function block if there is more data that
+ * cannot be read immediately.
+ }
+ read: read_t;
+
+ {
+ * Make it possible to set aside the data for at least as long as the
+ * given pool. Buckets containing data that could potentially die before
+ * this pool (e.g. the data resides on the stack, in a child pool of
+ * the given pool, or in a disjoint pool) must somehow copy, shift, or
+ * transform the data to have the proper lifetime.
+ * @param e The bucket to convert
+ * @remark Some bucket types contain data that will always outlive the
+ * bucket itself. For example no data (EOS and FLUSH), or the data
+ * resides in global, constant memory (IMMORTAL), or the data is on
+ * the heap (HEAP). For these buckets, apr_bucket_setaside_noop can
+ * be used.
+ }
+ setaside: setaside_t;
+
+ {
+ * Split one bucket in two at the specified position by duplicating
+ * the bucket structure (not the data) and modifying any necessary
+ * start/end/offset information. If it's not possible to do this
+ * for the bucket type (perhaps the length of the data is indeterminate,
+ * as with pipe and socket buckets), then APR_ENOTIMPL is returned.
+ * @param e The bucket to split
+ * @param point The offset of the first byte in the new bucket
+ }
+ split: split_t;
+
+ {
+ * Copy the bucket structure (not the data), assuming that this is
+ * possible for the bucket type. If it's not, APR_ENOTIMPL is returned.
+ * @param e The bucket to copy
+ * @param c Returns a pointer to the new bucket
+ }
+ copy: copy_t;
+ end;
+
+{
+ * apr_bucket structures are allocated on the malloc() heap and
+ * their lifetime is controlled by the parent apr_bucket_brigade
+ * structure. Buckets can move from one brigade to another e.g. by
+ * calling APR_BRIGADE_CONCAT(). In general the data in a bucket has
+ * the same lifetime as the bucket and is freed when the bucket is
+ * destroyed; if the data is shared by more than one bucket (e.g.
+ * after a split) the data is freed when the last bucket goes away.
+ }
+ free_t = procedure(e: Pointer);
+
+ link_t = record
+ next: Papr_bucket;
+ prev: Papr_bucket;
+ end;
+
+ apr_bucket = record
+ { Links to the rest of the brigade }
+ link: link_t;
+
+ { The type of bucket. }
+ type_: Papr_bucket_type_t;
+ { The length of the data in the bucket. This could have been implemented
+ * with a function, but this is an optimization, because the most
+ * common thing to do will be to get the length. If the length is unknown,
+ * the value of this field will be (apr_size_t)(-1).
+ }
+ length: apr_size_t;
+ { The start of the data in the bucket relative to the private base
+ * pointer. The vast majority of bucket types allow a fixed block of
+ * data to be referenced by multiple buckets, each bucket pointing to
+ * a different segment of the data. That segment starts at base+start
+ * and ends at base+start+length.
+ * If the length == (apr_size_t)(-1), then start == -1.
+ }
+ start: apr_off_t;
+ { type-dependent data hangs off this pointer }
+ data: Pointer;
+ {
+ * Pointer to function used to free the bucket. This function should
+ * always be defined and it should be consistent with the memory
+ * function used to allocate the bucket. For example, if malloc() is
+ * used to allocate the bucket, this pointer should point to free().
+ * @param e Pointer to the bucket being freed
+ }
+ free: free_t;
+ { The freelist from which this bucket was allocated }
+ list: Papr_bucket_alloc_t;
+ end;
+
+ { A list of buckets }
+
+ apr_bucket_list = record
+ next: Papr_bucket;
+ prev: Papr_bucket;
+ end;
+
+ apr_bucket_brigade = record
+ { The pool to associate the brigade with. The data is not allocated out
+ * of the pool, but a cleanup is registered with this pool. If the
+ * brigade is destroyed by some mechanism other than pool destruction,
+ * the destroying function is responsible for killing the cleanup.
+ }
+ p: Papr_pool_t;
+ { The buckets in the brigade are on this list. }
+ {
+ * The apr_bucket_list structure doesn't actually need a name tag
+ * because it has no existence independent of struct apr_bucket_brigade;
+ * the ring macros are designed so that you can leave the name tag
+ * argument empty in this situation but apparently the Windows compiler
+ * doesn't like that.
+ }
+ list: apr_bucket_list;
+ { The freelist from which this bucket was allocated }
+ bucket_alloc: Papr_bucket_alloc_t;
+ end;
+
+
+{
+ * Function called when a brigade should be flushed
+ }
+ apr_brigade_flush = function (bb: Papr_bucket_brigade; ctx: Pointer): apr_status_t;
+
+{
+ * define APR_BUCKET_DEBUG if you want your brigades to be checked for
+ * validity at every possible instant. this will slow your code down
+ * substantially but is a very useful debugging tool.
+ }
+{#ifdef APR_BUCKET_DEBUG
+
+#define APR_BRIGADE_CHECK_CONSISTENCY(b) \
+ APR_RING_CHECK_CONSISTENCY(&(b)->list, apr_bucket, link)
+
+#define APR_BUCKET_CHECK_CONSISTENCY(e) \
+ APR_RING_CHECK_ELEM_CONSISTENCY((e), apr_bucket, link)
+
+#else}
+{
+ * checks the ring pointers in a bucket brigade for consistency. an
+ * abort() will be triggered if any inconsistencies are found.
+ * note: this is a no-op unless APR_BUCKET_DEBUG is defined.
+ * @param b The brigade
+ }
+//#define APR_BRIGADE_CHECK_CONSISTENCY(b)
+{
+ * checks the brigade a bucket is in for ring consistency. an
+ * abort() will be triggered if any inconsistencies are found.
+ * note: this is a no-op unless APR_BUCKET_DEBUG is defined.
+ * @param e The bucket
+ }
+//#define APR_BUCKET_CHECK_CONSISTENCY(e)
+//#endif
+
+
+{
+ * Wrappers around the RING macros to reduce the verbosity of the code
+ * that handles bucket brigades.
+ }
+{
+ * The magic pointer value that indicates the head of the brigade
+ * @remark This is used to find the beginning and end of the brigade, eg:
+ * <pre>
+ * while (e != APR_BRIGADE_SENTINEL(b)) (
+ * ...
+ * e = APR_BUCKET_NEXT(e);
+ * )
+ * </pre>
+ * @param b The brigade
+ * @return The magic pointer value
+ }
+//#define APR_BRIGADE_SENTINEL(b) APR_RING_SENTINEL(&(b)->list, apr_bucket, link)
+
+{
+ * Determine if the bucket brigade is empty
+ * @param b The brigade to check
+ * @return true or false
+ }
+//#define APR_BRIGADE_EMPTY(b) APR_RING_EMPTY(&(b)->list, apr_bucket, link)
+
+{
+ * Return the first bucket in a brigade
+ * @param b The brigade to query
+ * @return The first bucket in the brigade
+ }
+//#define APR_BRIGADE_FIRST(b) APR_RING_FIRST(&(b)->list)
+{
+ * Return the last bucket in a brigade
+ * @param b The brigade to query
+ * @return The last bucket in the brigade
+ }
+//#define APR_BRIGADE_LAST(b) APR_RING_LAST(&(b)->list)
+
+{
+ * Insert a list of buckets at the front of a brigade
+ * @param b The brigade to add to
+ * @param e The first bucket in a list of buckets to insert
+ }
+{#define APR_BRIGADE_INSERT_HEAD(b, e) do ( \
+ apr_bucket *ap__b = (e); \
+ APR_RING_INSERT_HEAD(&(b)->list, ap__b, apr_bucket, link); \
+ APR_BRIGADE_CHECK_CONSISTENCY((b)); \
+ ) while (0)}
+
+{
+ * Insert a list of buckets at the end of a brigade
+ * @param b The brigade to add to
+ * @param e The first bucket in a list of buckets to insert
+ }
+{#define APR_BRIGADE_INSERT_TAIL(b, e) do begin \
+ apr_bucket *ap__b = (e); \
+ APR_RING_INSERT_TAIL(&(b)->list, ap__b, apr_bucket, link); \
+ APR_BRIGADE_CHECK_CONSISTENCY((b)); \
+ end while (0)}
+
+{
+ * Concatenate brigade b onto the end of brigade a, leaving brigade b empty
+ * @param a The first brigade
+ * @param b The second brigade
+ }
+{#define APR_BRIGADE_CONCAT(a, b) do begin
+ APR_RING_CONCAT(&(a)->list, &(b)->list, apr_bucket, link); \
+ APR_BRIGADE_CHECK_CONSISTENCY((a)); \
+ end while (0);}
+
+{
+ * Prepend brigade b onto the beginning of brigade a, leaving brigade b empty
+ * @param a The first brigade
+ * @param b The second brigade
+ }
+{#define APR_BRIGADE_PREPEND(a, b) do begin
+ APR_RING_PREPEND(&(a)->list, &(b)->list, apr_bucket, link); \
+ APR_BRIGADE_CHECK_CONSISTENCY((a)); \
+ end while (0)}
+
+{
+ * Insert a list of buckets before a specified bucket
+ * @param a The bucket to insert before
+ * @param b The buckets to insert
+ }
+{#define APR_BUCKET_INSERT_BEFORE(a, b) do begin
+ apr_bucket *ap__a = (a), *ap__b = (b); \
+ APR_RING_INSERT_BEFORE(ap__a, ap__b, link); \
+ APR_BUCKET_CHECK_CONSISTENCY(ap__a); \
+ end while (0)}
+
+{
+ * Insert a list of buckets after a specified bucket
+ * @param a The bucket to insert after
+ * @param b The buckets to insert
+ }
+{#define APR_BUCKET_INSERT_AFTER(a, b) do begin
+ apr_bucket *ap__a = (a), *ap__b = (b); \
+ APR_RING_INSERT_AFTER(ap__a, ap__b, link); \
+ APR_BUCKET_CHECK_CONSISTENCY(ap__a); \
+ end while (0)}
+
+{
+ * Get the next bucket in the list
+ * @param e The current bucket
+ * @return The next bucket
+ }
+//#define APR_BUCKET_NEXT(e) APR_RING_NEXT((e), link)
+{
+ * Get the previous bucket in the list
+ * @param e The current bucket
+ * @return The previous bucket
+ }
+//#define APR_BUCKET_PREV(e) APR_RING_PREV((e), link)
+
+{
+ * Remove a bucket from its bucket brigade
+ * @param e The bucket to remove
+ }
+//#define APR_BUCKET_REMOVE(e) APR_RING_REMOVE((e), link)
+
+{
+ * Initialize a new bucket's prev/next pointers
+ * @param e The bucket to initialize
+ }
+//#define APR_BUCKET_INIT(e) APR_RING_ELEM_INIT((e), link)
+
+{
+ * Determine if a bucket contains metadata. An empty bucket is
+ * safe to arbitrarily remove if and only if this is false.
+ * @param e The bucket to inspect
+ * @return true or false
+ }
+//#define APR_BUCKET_IS_METADATA(e) ((e)->type->is_metadata)
+
+{
+ * Determine if a bucket is a FLUSH bucket
+ * @param e The bucket to inspect
+ * @return true or false
+ }
+//#define APR_BUCKET_IS_FLUSH(e) ((e)->type == &apr_bucket_type_flush)
+{
+ * Determine if a bucket is an EOS bucket
+ * @param e The bucket to inspect
+ * @return true or false
+ }
+//#define APR_BUCKET_IS_EOS(e) ((e)->type == &apr_bucket_type_eos)
+{
+ * Determine if a bucket is a FILE bucket
+ * @param e The bucket to inspect
+ * @return true or false
+ }
+//#define APR_BUCKET_IS_FILE(e) ((e)->type == &apr_bucket_type_file)
+{
+ * Determine if a bucket is a PIPE bucket
+ * @param e The bucket to inspect
+ * @return true or false
+ }
+//#define APR_BUCKET_IS_PIPE(e) ((e)->type == &apr_bucket_type_pipe)
+{
+ * Determine if a bucket is a SOCKET bucket
+ * @param e The bucket to inspect
+ * @return true or false
+ }
+//#define APR_BUCKET_IS_SOCKET(e) ((e)->type == &apr_bucket_type_socket)
+{
+ * Determine if a bucket is a HEAP bucket
+ * @param e The bucket to inspect
+ * @return true or false
+ }
+//#define APR_BUCKET_IS_HEAP(e) ((e)->type == &apr_bucket_type_heap)
+{
+ * Determine if a bucket is a TRANSIENT bucket
+ * @param e The bucket to inspect
+ * @return true or false
+ }
+//#define APR_BUCKET_IS_TRANSIENT(e) ((e)->type == &apr_bucket_type_transient)
+{
+ * Determine if a bucket is a IMMORTAL bucket
+ * @param e The bucket to inspect
+ * @return true or false
+ }
+//#define APR_BUCKET_IS_IMMORTAL(e) ((e)->type == &apr_bucket_type_immortal)
+//#if APR_HAS_MMAP
+{
+ * Determine if a bucket is a MMAP bucket
+ * @param e The bucket to inspect
+ * @return true or false
+ }
+//#define APR_BUCKET_IS_MMAP(e) ((e)->type == &apr_bucket_type_mmap)
+//#endif
+{
+ * Determine if a bucket is a POOL bucket
+ * @param e The bucket to inspect
+ * @return true or false
+ }
+//#define APR_BUCKET_IS_POOL(e) ((e)->type == &apr_bucket_type_pool)
+
+{
+ * General-purpose reference counting for the various bucket types.
+ *
+ * Any bucket type that keeps track of the resources it uses (i.e.
+ * most of them except for IMMORTAL, TRANSIENT, and EOS) needs to
+ * attach a reference count to the resource so that it can be freed
+ * when the last bucket that uses it goes away. Resource-sharing may
+ * occur because of bucket splits or buckets that refer to globally
+ * cached data. }
+
+{ @see apr_bucket_refcount }
+ Papr_bucket_refcount = ^apr_bucket_refcount;
+{
+ * The structure used to manage the shared resource must start with an
+ * apr_bucket_refcount which is updated by the general-purpose refcount
+ * code. A pointer to the bucket-type-dependent private data structure
+ * can be cast to a pointer to an apr_bucket_refcount and vice versa.
+ }
+ apr_bucket_refcount = record
+ { The number of references to this bucket }
+ refcount: Integer;
+ end;
+
+{ ***** Reference-counted bucket types ***** }
+
+{ @see apr_bucket_heap }
+ Papr_bucket_heap = ^apr_bucket_heap;
+{
+ * A bucket referring to data allocated off the heap.
+ }
+ free_func_t = procedure (data: Pointer);
+
+ apr_bucket_heap = record
+ { Number of buckets using this memory }
+ refcount: apr_bucket_refcount;
+ { The start of the data actually allocated. This should never be
+ * modified, it is only used to free the bucket.
+ }
+ base: PChar;
+ { how much memory was allocated }
+ alloc_len: apr_size_t;
+ { function to use to delete the data }
+ free_func: free_func_t;
+ end;
+
+{ @see apr_bucket_pool }
+ Papr_bucket_pool = ^apr_bucket_pool;
+{
+ * A bucket referring to data allocated from a pool
+ }
+ apr_bucket_pool = record
+ { The pool bucket must be able to be easily morphed to a heap
+ * bucket if the pool gets cleaned up before all references are
+ * destroyed. This apr_bucket_heap structure is populated automatically
+ * when the pool gets cleaned up, and subsequent calls to pool_read()
+ * will result in the apr_bucket in question being morphed into a
+ * regular heap bucket. (To avoid having to do many extra refcount
+ * manipulations and b->data manipulations, the apr_bucket_pool
+ * struct actually *contains* the apr_bucket_heap struct that it
+ * will become as its first element; the two share their
+ * apr_bucket_refcount members.)
+ }
+ heap: apr_bucket_heap;
+ { The block of data actually allocated from the pool.
+ * Segments of this block are referenced by adjusting
+ * the start and length of the apr_bucket accordingly.
+ * This will be NULL after the pool gets cleaned up.
+ }
+ base: PChar;
+ { The pool the data was allocated from. When the pool
+ * is cleaned up, this gets set to NULL as an indicator
+ * to pool_read() that the data is now on the heap and
+ * so it should morph the bucket into a regular heap
+ * bucket before continuing.
+ }
+ pool: Papr_pool_t;
+ { The freelist this structure was allocated from, which is
+ * needed in the cleanup phase in order to allocate space on the heap
+ }
+ list: Papr_bucket_alloc_t;
+ end;
+
+{$ifdef APR_HAS_MMAP}
+{ @see apr_bucket_mmap }
+ Papr_bucket_mmap = ^apr_bucket_mmap;
+{
+ * A bucket referring to an mmap()ed file
+ }
+ apr_bucket_mmap = record
+ { Number of buckets using this memory }
+ refcount: apr_bucket_refcount;
+ { The mmap this sub_bucket refers to }
+ mmap: Papr_mmap_t;
+ end;
+{$endif}
+
+{ @see apr_bucket_file }
+ Papr_bucket_file = ^apr_bucket_file;
+{
+ * A bucket referring to an file
+ }
+ apr_bucket_file = record
+ { Number of buckets using this memory }
+ refcount: apr_bucket_refcount;
+ { The file this bucket refers to }
+ fd: Papr_file_t;
+ { The pool into which any needed structures should
+ * be created while reading from this file bucket }
+ readpool: Papr_pool_t;
+{$ifdef APR_HAS_MMAP}
+ { Whether this bucket should be memory-mapped if
+ * a caller tries to read from it }
+ can_mmap: Integer;
+{$endif} { APR_HAS_MMAP }
+ end;
+
+{ @see apr_bucket_structs }
+ Papr_bucket_structs = ^apr_bucket_structs;
+{
+ * A union of all bucket structures so we know what
+ * the max size is.
+ }
+ apr_bucket_structs = record
+ case Integer of
+ 0: (b: apr_bucket); {< Bucket }
+ 1: (heap: apr_bucket_heap); {< Heap }
+ 2: (pool: apr_bucket_pool); {< Pool }
+{$ifdef APR_HAS_MMAP}
+ 3: (mmap: apr_bucket_mmap); {< MMap }
+{$endif}
+ 4: (file_: apr_bucket_file); {< File }
+ end;
+
+{
+ * The amount that apr_bucket_alloc() should allocate in the common case.
+ * Note: this is twice as big as apr_bucket_structs to allow breathing
+ * room for third-party bucket types.
+ }
+//#define APR_BUCKET_ALLOC_SIZE APR_ALIGN_DEFAULT(2*sizeof(apr_bucket_structs))
+
+{ ***** Bucket Brigade Functions ***** }
+{
+ * Create a new bucket brigade. The bucket brigade is originally empty.
+ * @param p The pool to associate with the brigade. Data is not allocated out
+ * of the pool, but a cleanup is registered.
+ * @param list The bucket allocator to use
+ * @return The empty bucket brigade
+ }
+//APU_DECLARE(apr_bucket_brigade *) apr_brigade_create(apr_pool_t *p,
+// apr_bucket_alloc_t *list);
+
+{
+ * destroy an entire bucket brigade. This includes destroying all of the
+ * buckets within the bucket brigade's bucket list.
+ * @param b The bucket brigade to destroy
+ }
+//APU_DECLARE(apr_status_t) apr_brigade_destroy(apr_bucket_brigade *b);
+
+{
+ * empty out an entire bucket brigade. This includes destroying all of the
+ * buckets within the bucket brigade's bucket list. This is similar to
+ * apr_brigade_destroy(), except that it does not deregister the brigade's
+ * pool cleanup function.
+ * @param data The bucket brigade to clean up
+ * @remark Generally, you should use apr_brigade_destroy(). This function
+ * can be useful in situations where you have a single brigade that
+ * you wish to reuse many times by destroying all of the buckets in
+ * the brigade and putting new buckets into it later.
+ }
+//APU_DECLARE(apr_status_t) apr_brigade_cleanup(void *data);
+
+{
+ * Split a bucket brigade into two, such that the given bucket is the
+ * first in the new bucket brigade. This function is useful when a
+ * filter wants to pass only the initial part of a brigade to the next
+ * filter.
+ * @param b The brigade to split
+ * @param e The first element of the new brigade
+ * @return The new brigade
+ }
+//APU_DECLARE(apr_bucket_brigade *) apr_brigade_split(apr_bucket_brigade *b,
+// apr_bucket *e);
+
+{
+ * Partition a bucket brigade at a given offset (in bytes from the start of
+ * the brigade). This is useful whenever a filter wants to use known ranges
+ * of bytes from the brigade; the ranges can even overlap.
+ * @param b The brigade to partition
+ * @param point The offset at which to partition the brigade
+ * @param after_point Returns a pointer to the first bucket after the partition
+ * @return APR_SUCCESS on success, APR_INCOMPLETE if the contents of the
+ * brigade were shorter than @a point, or an error code.
+ * @remark if APR_INCOMPLETE is returned, @a after_point will be set to
+ * the brigade sentinel.
+ }
+//APU_DECLARE(apr_status_t) apr_brigade_partition(apr_bucket_brigade *b,
+// apr_off_t point,
+// apr_bucket **after_point);
+
+{
+ * Return the total length of the brigade.
+ * @param bb The brigade to compute the length of
+ * @param read_all Read unknown-length buckets to force a size
+ * @param length Returns the length of the brigade, or -1 if the brigade has
+ * buckets of indeterminate length and read_all is 0.
+ }
+{APU_DECLARE(apr_status_t) apr_brigade_length(apr_bucket_brigade *bb,
+ int read_all,
+ apr_off_t *length);
+}
+{
+ * Take a bucket brigade and store the data in a flat char*
+ * @param bb The bucket brigade to create the char* from
+ * @param c The char* to write into
+ * @param len The maximum length of the char array. On return, it is the
+ * actual length of the char array.
+ }
+{APU_DECLARE(apr_status_t) apr_brigade_flatten(apr_bucket_brigade *bb,
+ char *c,
+ apr_size_t *len);
+}
+{
+ * Creates a pool-allocated string representing a flat bucket brigade
+ * @param bb The bucket brigade to create the char array from
+ * @param c On return, the allocated char array
+ * @param len On return, the length of the char array.
+ * @param pool The pool to allocate the string from.
+ }
+{APU_DECLARE(apr_status_t) apr_brigade_pflatten(apr_bucket_brigade *bb,
+ char **c,
+ apr_size_t *len,
+ apr_pool_t *pool);
+}
+{
+ * Split a brigade to represent one LF line.
+ * @param bbOut The bucket brigade that will have the LF line appended to.
+ * @param bbIn The input bucket brigade to search for a LF-line.
+ * @param block The blocking mode to be used to split the line.
+ * @param maxbytes The maximum bytes to read. If this many bytes are seen
+ * without a LF, the brigade will contain a partial line.
+ }
+{APU_DECLARE(apr_status_t) apr_brigade_split_line(apr_bucket_brigade *bbOut,
+ apr_bucket_brigade *bbIn,
+ apr_read_type_e block,
+ apr_off_t maxbytes);
+}
+{
+ * create an iovec of the elements in a bucket_brigade... return number
+ * of elements used. This is useful for writing to a file or to the
+ * network efficiently.
+ * @param b The bucket brigade to create the iovec from
+ * @param vec The iovec to create
+ * @param nvec The number of elements in the iovec. On return, it is the
+ * number of iovec elements actually filled out.
+ }
+{APU_DECLARE(apr_status_t) apr_brigade_to_iovec(apr_bucket_brigade *b,
+ struct iovec *vec, int *nvec);
+}
+{
+ * This function writes a list of strings into a bucket brigade.
+ * @param b The bucket brigade to add to
+ * @param flush The flush function to use if the brigade is full
+ * @param ctx The structure to pass to the flush function
+ * @param va A list of strings to add
+ * @return APR_SUCCESS or error code.
+ }
+{APU_DECLARE(apr_status_t) apr_brigade_vputstrs(apr_bucket_brigade *b,
+ apr_brigade_flush flush,
+ void *ctx,
+ va_list va);
+}
+{
+ * This function writes a string into a bucket brigade.
+ * @param b The bucket brigade to add to
+ * @param flush The flush function to use if the brigade is full
+ * @param ctx The structure to pass to the flush function
+ * @param str The string to add
+ * @param nbyte The number of bytes to write
+ * @return APR_SUCCESS or error code
+ }
+{APU_DECLARE(apr_status_t) apr_brigade_write(apr_bucket_brigade *b,
+ apr_brigade_flush flush, void *ctx,
+ const char *str, apr_size_t nbyte);
+}
+{
+ * This function writes multiple strings into a bucket brigade.
+ * @param b The bucket brigade to add to
+ * @param flush The flush function to use if the brigade is full
+ * @param ctx The structure to pass to the flush function
+ * @param vec The strings to add (address plus length for each)
+ * @param nvec The number of entries in iovec
+ * @return APR_SUCCESS or error code
+ }
+{APU_DECLARE(apr_status_t) apr_brigade_writev(apr_bucket_brigade *b,
+ apr_brigade_flush flush,
+ void *ctx,
+ const struct iovec *vec,
+ apr_size_t nvec);
+}
+{
+ * This function writes a string into a bucket brigade.
+ * @param bb The bucket brigade to add to
+ * @param flush The flush function to use if the brigade is full
+ * @param ctx The structure to pass to the flush function
+ * @param str The string to add
+ * @return APR_SUCCESS or error code
+ }
+{APU_DECLARE(apr_status_t) apr_brigade_puts(apr_bucket_brigade *bb,
+ apr_brigade_flush flush, void *ctx,
+ const char *str);
+}
+{
+ * This function writes a character into a bucket brigade.
+ * @param b The bucket brigade to add to
+ * @param flush The flush function to use if the brigade is full
+ * @param ctx The structure to pass to the flush function
+ * @param c The character to add
+ * @return APR_SUCCESS or error code
+ }
+{APU_DECLARE(apr_status_t) apr_brigade_putc(apr_bucket_brigade *b,
+ apr_brigade_flush flush, void *ctx,
+ const char c);
+}
+{
+ * This function writes an unspecified number of strings into a bucket brigade.
+ * @param b The bucket brigade to add to
+ * @param flush The flush function to use if the brigade is full
+ * @param ctx The structure to pass to the flush function
+ * @param ... The strings to add
+ * @return APR_SUCCESS or error code
+ }
+{APU_DECLARE_NONSTD(apr_status_t) apr_brigade_putstrs(apr_bucket_brigade *b,
+ apr_brigade_flush flush,
+ void *ctx, ...);
+}
+{
+ * Evaluate a printf and put the resulting string at the end
+ * of the bucket brigade.
+ * @param b The brigade to write to
+ * @param flush The flush function to use if the brigade is full
+ * @param ctx The structure to pass to the flush function
+ * @param fmt The format of the string to write
+ * @param ... The arguments to fill out the format
+ * @return APR_SUCCESS or error code
+ }
+{APU_DECLARE_NONSTD(apr_status_t) apr_brigade_printf(apr_bucket_brigade *b,
+ apr_brigade_flush flush,
+ void *ctx,
+ const char *fmt, ...)
+ __attribute__((format(printf,4,5)));
+}
+{
+ * Evaluate a printf and put the resulting string at the end
+ * of the bucket brigade.
+ * @param b The brigade to write to
+ * @param flush The flush function to use if the brigade is full
+ * @param ctx The structure to pass to the flush function
+ * @param fmt The format of the string to write
+ * @param va The arguments to fill out the format
+ * @return APR_SUCCESS or error code
+ }
+{APU_DECLARE(apr_status_t) apr_brigade_vprintf(apr_bucket_brigade *b,
+ apr_brigade_flush flush,
+ void *ctx,
+ const char *fmt, va_list va);
+}
+
+{
+ * Utility function to insert a file (or a segment of a file) onto the
+ * end of the brigade. The file is split into multiple buckets if it
+ * is larger than the maximum size which can be represented by a
+ * single bucket.
+ * @param bb the brigade to insert into
+ * @param f the file to insert
+ * @param start the offset of the start of the segment
+ * @param len the length of the segment of the file to insert
+ * @param p pool from which file buckets are allocated
+ * @return the last bucket inserted
+ }
+{APU_DECLARE(apr_bucket *) apr_brigade_insert_file(apr_bucket_brigade *bb,
+ apr_file_t *f,
+ apr_off_t start,
+ apr_off_t len,
+ apr_pool_t *p);}
+
+{ ***** Bucket freelist functions ***** }
+{
+ * Create a bucket allocator.
+ * @param p This pool's underlying apr_allocator_t is used to allocate memory
+ * for the bucket allocator. When the pool is destroyed, the bucket
+ * allocator's cleanup routine will free all memory that has been
+ * allocated from it.
+ * @remark The reason the allocator gets its memory from the pool's
+ * apr_allocator_t rather than from the pool itself is because
+ * the bucket allocator will free large memory blocks back to the
+ * allocator when it's done with them, thereby preventing memory
+ * footprint growth that would occur if we allocated from the pool.
+ * @warning The allocator must never be used by more than one thread at a time.
+ }
+//APU_DECLARE_NONSTD(apr_bucket_alloc_t *) apr_bucket_alloc_create(apr_pool_t *p);
+
+{
+ * Create a bucket allocator.
+ * @param allocator This apr_allocator_t is used to allocate both the bucket
+ * allocator and all memory handed out by the bucket allocator. The
+ * caller is responsible for destroying the bucket allocator and the
+ * apr_allocator_t -- no automatic cleanups will happen.
+ * @warning The allocator must never be used by more than one thread at a time.
+ }
+//APU_DECLARE_NONSTD(apr_bucket_alloc_t *) apr_bucket_alloc_create_ex(apr_allocator_t *allocator);
+
+{
+ * Destroy a bucket allocator.
+ * @param list The allocator to be destroyed
+ }
+//APU_DECLARE_NONSTD(void) apr_bucket_alloc_destroy(apr_bucket_alloc_t *list);
+
+{
+ * Allocate memory for use by the buckets.
+ * @param size The amount to allocate.
+ * @param list The allocator from which to allocate the memory.
+ }
+//APU_DECLARE_NONSTD(void *) apr_bucket_alloc(apr_size_t size, apr_bucket_alloc_t *list);
+
+{
+ * Free memory previously allocated with apr_bucket_alloc().
+ * @param block The block of memory to be freed.
+ }
+//APU_DECLARE_NONSTD(void) apr_bucket_free(void *block);
+
+
+{ ***** Bucket Functions ***** }
+{
+ * Free the resources used by a bucket. If multiple buckets refer to
+ * the same resource it is freed when the last one goes away.
+ * @see apr_bucket_delete()
+ * @param e The bucket to destroy
+ }
+{#define apr_bucket_destroy(e) do begin
+ (e)->type->destroy((e)->data); \
+ (e)->free(e); \
+ end while (0)}
+
+{
+ * Delete a bucket by removing it from its brigade (if any) and then
+ * destroying it.
+ * @remark This mainly acts as an aid in avoiding code verbosity. It is
+ * the preferred exact equivalent to:
+ * <pre>
+ * APR_BUCKET_REMOVE(e);
+ * apr_bucket_destroy(e);
+ * </pre>
+ * @param e The bucket to delete
+ }
+{#define apr_bucket_delete(e) do begin
+ APR_BUCKET_REMOVE(e); \
+ apr_bucket_destroy(e); \
+ end while (0)}
+
+{
+ * read the data from the bucket
+ * @param e The bucket to read from
+ * @param str The location to store the data in
+ * @param len The amount of data read
+ * @param block Whether the read function blocks
+ }
+//#define apr_bucket_read(e,str,len,block) (e)->type->read(e, str, len, block)
+
+{
+ * Setaside data so that stack data is not destroyed on returning from
+ * the function
+ * @param e The bucket to setaside
+ * @param p The pool to setaside into
+ }
+//#define apr_bucket_setaside(e,p) (e)->type->setaside(e,p)
+
+{
+ * Split one bucket in two.
+ * @param e The bucket to split
+ * @param point The offset to split the bucket at
+ }
+//#define apr_bucket_split(e,point) (e)->type->split(e, point)
+
+{
+ * Copy a bucket.
+ * @param e The bucket to copy
+ * @param c Returns a pointer to the new bucket
+ }
+//#define apr_bucket_copy(e,c) (e)->type->copy(e, c)
+
+{ Bucket type handling }
+
+{
+ * This function simply returns APR_SUCCESS to denote that the bucket does
+ * not require anything to happen for its setaside() function. This is
+ * appropriate for buckets that have "immortal" data -- the data will live
+ * at least as long as the bucket.
+ * @param data The bucket to setaside
+ * @param pool The pool defining the desired lifetime of the bucket data
+ * @return APR_SUCCESS
+ }
+{APU_DECLARE_NONSTD(apr_status_t) apr_bucket_setaside_noop(apr_bucket *data,
+ apr_pool_t *pool);
+}
+{
+ * A place holder function that signifies that the setaside function was not
+ * implemented for this bucket
+ * @param data The bucket to setaside
+ * @param pool The pool defining the desired lifetime of the bucket data
+ * @return APR_ENOTIMPL
+ }
+{APU_DECLARE_NONSTD(apr_status_t) apr_bucket_setaside_notimpl(apr_bucket *data,
+ apr_pool_t *pool);
+}
+{
+ * A place holder function that signifies that the split function was not
+ * implemented for this bucket
+ * @param data The bucket to split
+ * @param point The location to split the bucket
+ * @return APR_ENOTIMPL
+ }
+{APU_DECLARE_NONSTD(apr_status_t) apr_bucket_split_notimpl(apr_bucket *data,
+ apr_size_t point);
+}
+{
+ * A place holder function that signifies that the copy function was not
+ * implemented for this bucket
+ * @param e The bucket to copy
+ * @param c Returns a pointer to the new bucket
+ * @return APR_ENOTIMPL
+ }
+{APU_DECLARE_NONSTD(apr_status_t) apr_bucket_copy_notimpl(apr_bucket *e,
+ apr_bucket **c);
+}
+{
+ * A place holder function that signifies that this bucket does not need
+ * to do anything special to be destroyed. That's only the case for buckets
+ * that either have no data (metadata buckets) or buckets whose data pointer
+ * points to something that's not a bucket-type-specific structure, as with
+ * simple buckets where data points to a string and pipe buckets where data
+ * points directly to the apr_file_t.
+ * @param data The bucket data to destroy
+ }
+//APU_DECLARE_NONSTD(void) apr_bucket_destroy_noop(void *data);
+
+{
+ * There is no apr_bucket_destroy_notimpl, because destruction is required
+ * to be implemented (it could be a noop, but only if that makes sense for
+ * the bucket type)
+ }
+
+{ There is no apr_bucket_read_notimpl, because it is a required function
+ }
+
+
+{ All of the bucket types implemented by the core }
+{
+ * The flush bucket type. This signifies that all data should be flushed to
+ * the next filter. The flush bucket should be sent with the other buckets.
+ }
+//APU_DECLARE_DATA extern const apr_bucket_type_t apr_bucket_type_flush;
+{
+ * The EOS bucket type. This signifies that there will be no more data, ever.
+ * All filters MUST send all data to the next filter when they receive a
+ * bucket of this type
+ }
+//APU_DECLARE_DATA extern const apr_bucket_type_t apr_bucket_type_eos;
+{
+ * The FILE bucket type. This bucket represents a file on disk
+ }
+//APU_DECLARE_DATA extern const apr_bucket_type_t apr_bucket_type_file;
+{
+ * The HEAP bucket type. This bucket represents a data allocated from the
+ * heap.
+ }
+//APU_DECLARE_DATA extern const apr_bucket_type_t apr_bucket_type_heap;
+//#if APR_HAS_MMAP
+{
+ * The MMAP bucket type. This bucket represents an MMAP'ed file
+ }
+//APU_DECLARE_DATA extern const apr_bucket_type_t apr_bucket_type_mmap;
+//#endif
+{
+ * The POOL bucket type. This bucket represents a data that was allocated
+ * from a pool. IF this bucket is still available when the pool is cleared,
+ * the data is copied on to the heap.
+ }
+//APU_DECLARE_DATA extern const apr_bucket_type_t apr_bucket_type_pool;
+{
+ * The PIPE bucket type. This bucket represents a pipe to another program.
+ }
+//APU_DECLARE_DATA extern const apr_bucket_type_t apr_bucket_type_pipe;
+{
+ * The IMMORTAL bucket type. This bucket represents a segment of data that
+ * the creator is willing to take responsibility for. The core will do
+ * nothing with the data in an immortal bucket
+ }
+//APU_DECLARE_DATA extern const apr_bucket_type_t apr_bucket_type_immortal;
+{
+ * The TRANSIENT bucket type. This bucket represents a data allocated off
+ * the stack. When the setaside function is called, this data is copied on
+ * to the heap
+ }
+//APU_DECLARE_DATA extern const apr_bucket_type_t apr_bucket_type_transient;
+{
+ * The SOCKET bucket type. This bucket represents a socket to another machine
+ }
+//APU_DECLARE_DATA extern const apr_bucket_type_t apr_bucket_type_socket;
+
+
+{ ***** Simple buckets ***** }
+
+{
+ * Split a simple bucket into two at the given point. Most non-reference
+ * counting buckets that allow multiple references to the same block of
+ * data (eg transient and immortal) will use this as their split function
+ * without any additional type-specific handling.
+ * @param b The bucket to be split
+ * @param point The offset of the first byte in the new bucket
+ * @return APR_EINVAL if the point is not within the bucket;
+ * APR_ENOMEM if allocation failed;
+ * or APR_SUCCESS
+ }
+//APU_DECLARE_NONSTD(apr_status_t) apr_bucket_simple_split(apr_bucket *b,
+// apr_size_t point);
+
+{
+ * Copy a simple bucket. Most non-reference-counting buckets that allow
+ * multiple references to the same block of data (eg transient and immortal)
+ * will use this as their copy function without any additional type-specific
+ * handling.
+ * @param a The bucket to copy
+ * @param b Returns a pointer to the new bucket
+ * @return APR_ENOMEM if allocation failed;
+ * or APR_SUCCESS
+ }
+{APU_DECLARE_NONSTD(apr_status_t) apr_bucket_simple_copy(apr_bucket *a,
+ apr_bucket **b);
+
+}
+{ ***** Shared, reference-counted buckets ***** }
+
+{
+ * Initialize a bucket containing reference-counted data that may be
+ * shared. The caller must allocate the bucket if necessary and
+ * initialize its type-dependent fields, and allocate and initialize
+ * its own private data structure. This function should only be called
+ * by type-specific bucket creation functions.
+ * @param b The bucket to initialize
+ * @param data A pointer to the private data structure
+ * with the reference count at the start
+ * @param start The start of the data in the bucket
+ * relative to the private base pointer
+ * @param length The length of the data in the bucket
+ * @return The new bucket, or NULL if allocation failed
+ }
+{APU_DECLARE(apr_bucket *) apr_bucket_shared_make(apr_bucket *b, void *data,
+ apr_off_t start,
+ apr_size_t length);
+}
+{
+ * Decrement the refcount of the data in the bucket. This function
+ * should only be called by type-specific bucket destruction functions.
+ * @param data The private data pointer from the bucket to be destroyed
+ * @return TRUE or FALSE; TRUE if the reference count is now
+ * zero, indicating that the shared resource itself can
+ * be destroyed by the caller.
+ }
+//APU_DECLARE(int) apr_bucket_shared_destroy(void *data);
+
+{
+ * Split a bucket into two at the given point, and adjust the refcount
+ * to the underlying data. Most reference-counting bucket types will
+ * be able to use this function as their split function without any
+ * additional type-specific handling.
+ * @param b The bucket to be split
+ * @param point The offset of the first byte in the new bucket
+ * @return APR_EINVAL if the point is not within the bucket;
+ * APR_ENOMEM if allocation failed;
+ * or APR_SUCCESS
+ }
+//APU_DECLARE_NONSTD(apr_status_t) apr_bucket_shared_split(apr_bucket *b,
+// apr_size_t point);
+
+{
+ * Copy a refcounted bucket, incrementing the reference count. Most
+ * reference-counting bucket types will be able to use this function
+ * as their copy function without any additional type-specific handling.
+ * @param a The bucket to copy
+ * @param b Returns a pointer to the new bucket
+ * @return APR_ENOMEM if allocation failed;
+ or APR_SUCCESS
+ }
+//APU_DECLARE_NONSTD(apr_status_t) apr_bucket_shared_copy(apr_bucket *a,
+// apr_bucket **b);
+
+
+{ ***** Functions to Create Buckets of varying types ***** }
+{
+ * Each bucket type foo has two initialization functions:
+ * apr_bucket_foo_make which sets up some already-allocated memory as a
+ * bucket of type foo; and apr_bucket_foo_create which allocates memory
+ * for the bucket, calls apr_bucket_make_foo, and initializes the
+ * bucket's list pointers. The apr_bucket_foo_make functions are used
+ * inside the bucket code to change the type of buckets in place;
+ * other code should call apr_bucket_foo_create. All the initialization
+ * functions change nothing if they fail.
+ }
+
+{
+ * Create an End of Stream bucket. This indicates that there is no more data
+ * coming from down the filter stack. All filters should flush at this point.
+ * @param list The freelist from which this bucket should be allocated
+ * @return The new bucket, or NULL if allocation failed
+ }
+//APU_DECLARE(apr_bucket *) apr_bucket_eos_create(apr_bucket_alloc_t *list);
+
+{
+ * Make the bucket passed in an EOS bucket. This indicates that there is no
+ * more data coming from down the filter stack. All filters should flush at
+ * this point.
+ * @param b The bucket to make into an EOS bucket
+ * @return The new bucket, or NULL if allocation failed
+ }
+//APU_DECLARE(apr_bucket *) apr_bucket_eos_make(apr_bucket *b);
+
+{
+ * Create a flush bucket. This indicates that filters should flush their
+ * data. There is no guarantee that they will flush it, but this is the
+ * best we can do.
+ * @param list The freelist from which this bucket should be allocated
+ * @return The new bucket, or NULL if allocation failed
+ }
+//APU_DECLARE(apr_bucket *) apr_bucket_flush_create(apr_bucket_alloc_t *list);
+
+{
+ * Make the bucket passed in a FLUSH bucket. This indicates that filters
+ * should flush their data. There is no guarantee that they will flush it,
+ * but this is the best we can do.
+ * @param b The bucket to make into a FLUSH bucket
+ * @return The new bucket, or NULL if allocation failed
+ }
+//APU_DECLARE(apr_bucket *) apr_bucket_flush_make(apr_bucket *b);
+
+{
+ * Create a bucket referring to long-lived data.
+ * @param buf The data to insert into the bucket
+ * @param nbyte The size of the data to insert.
+ * @param list The freelist from which this bucket should be allocated
+ * @return The new bucket, or NULL if allocation failed
+ }
+{APU_DECLARE(apr_bucket *) apr_bucket_immortal_create(const char *buf,
+ apr_size_t nbyte,
+ apr_bucket_alloc_t *list);
+}
+{
+ * Make the bucket passed in a bucket refer to long-lived data
+ * @param b The bucket to make into a IMMORTAL bucket
+ * @param buf The data to insert into the bucket
+ * @param nbyte The size of the data to insert.
+ * @return The new bucket, or NULL if allocation failed
+ }
+{APU_DECLARE(apr_bucket *) apr_bucket_immortal_make(apr_bucket *b,
+ const char *buf,
+ apr_size_t nbyte);
+}
+{
+ * Create a bucket referring to data on the stack.
+ * @param buf The data to insert into the bucket
+ * @param nbyte The size of the data to insert.
+ * @param list The freelist from which this bucket should be allocated
+ * @return The new bucket, or NULL if allocation failed
+ }
+{APU_DECLARE(apr_bucket *) apr_bucket_transient_create(const char *buf,
+ apr_size_t nbyte,
+ apr_bucket_alloc_t *list);
+}
+{
+ * Make the bucket passed in a bucket refer to stack data
+ * @param b The bucket to make into a TRANSIENT bucket
+ * @param buf The data to insert into the bucket
+ * @param nbyte The size of the data to insert.
+ * @return The new bucket, or NULL if allocation failed
+ }
+{APU_DECLARE(apr_bucket *) apr_bucket_transient_make(apr_bucket *b,
+ const char *buf,
+ apr_size_t nbyte);
+}
+{
+ * Create a bucket referring to memory on the heap. If the caller asks
+ * for the data to be copied, this function always allocates 4K of
+ * memory so that more data can be added to the bucket without
+ * requiring another allocation. Therefore not all the data may be put
+ * into the bucket. If copying is not requested then the bucket takes
+ * over responsibility for free()ing the memory.
+ * @param buf The buffer to insert into the bucket
+ * @param nbyte The size of the buffer to insert.
+ * @param free_func Function to use to free the data; NULL indicates that the
+ * bucket should make a copy of the data
+ * @param list The freelist from which this bucket should be allocated
+ * @return The new bucket, or NULL if allocation failed
+ }
+{APU_DECLARE(apr_bucket *) apr_bucket_heap_create(const char *buf,
+ apr_size_t nbyte,
+ void ( *free_func)(void *data),
+ apr_bucket_alloc_t *list);}
+{
+ * Make the bucket passed in a bucket refer to heap data
+ * @param b The bucket to make into a HEAP bucket
+ * @param buf The buffer to insert into the bucket
+ * @param nbyte The size of the buffer to insert.
+ * @param free_func Function to use to free the data; NULL indicates that the
+ * bucket should make a copy of the data
+ * @return The new bucket, or NULL if allocation failed
+ }
+{APU_DECLARE(apr_bucket *) apr_bucket_heap_make(apr_bucket *b, const char *buf,
+ apr_size_t nbyte,
+ void ( *free_func)(void *data));}
+
+{
+ * Create a bucket referring to memory allocated from a pool.
+ *
+ * @param buf The buffer to insert into the bucket
+ * @param length The number of bytes referred to by this bucket
+ * @param pool The pool the memory was allocated from
+ * @param list The freelist from which this bucket should be allocated
+ * @return The new bucket, or NULL if allocation failed
+ }
+{APU_DECLARE(apr_bucket *) apr_bucket_pool_create(const char *buf,
+ apr_size_t length,
+ apr_pool_t *pool,
+ apr_bucket_alloc_t *list);}
+
+{
+ * Make the bucket passed in a bucket refer to pool data
+ * @param b The bucket to make into a pool bucket
+ * @param buf The buffer to insert into the bucket
+ * @param length The number of bytes referred to by this bucket
+ * @param pool The pool the memory was allocated from
+ * @return The new bucket, or NULL if allocation failed
+ }
+{APU_DECLARE(apr_bucket *) apr_bucket_pool_make(apr_bucket *b, const char *buf,
+ apr_size_t length,
+ apr_pool_t *pool);}
+
+//#if APR_HAS_MMAP
+{
+ * Create a bucket referring to mmap()ed memory.
+ * @param mm The mmap to insert into the bucket
+ * @param start The offset of the first byte in the mmap
+ * that this bucket refers to
+ * @param length The number of bytes referred to by this bucket
+ * @param list The freelist from which this bucket should be allocated
+ * @return The new bucket, or NULL if allocation failed
+ }
+{APU_DECLARE(apr_bucket *) apr_bucket_mmap_create(apr_mmap_t *mm,
+ apr_off_t start,
+ apr_size_t length,
+ apr_bucket_alloc_t *list);
+}
+{
+ * Make the bucket passed in a bucket refer to an MMAP'ed file
+ * @param b The bucket to make into a MMAP bucket
+ * @param mm The mmap to insert into the bucket
+ * @param start The offset of the first byte in the mmap
+ * that this bucket refers to
+ * @param length The number of bytes referred to by this bucket
+ * @return The new bucket, or NULL if allocation failed
+ }
+{APU_DECLARE(apr_bucket *) apr_bucket_mmap_make(apr_bucket *b, apr_mmap_t *mm,
+ apr_off_t start,
+ apr_size_t length);
+#endif}
+
+{
+ * Create a bucket referring to a socket.
+ * @param thissock The socket to put in the bucket
+ * @param list The freelist from which this bucket should be allocated
+ * @return The new bucket, or NULL if allocation failed
+ }
+{APU_DECLARE(apr_bucket *) apr_bucket_socket_create(apr_socket_t *thissock,
+ apr_bucket_alloc_t *list);}
+{
+ * Make the bucket passed in a bucket refer to a socket
+ * @param b The bucket to make into a SOCKET bucket
+ * @param thissock The socket to put in the bucket
+ * @return The new bucket, or NULL if allocation failed
+ }
+{APU_DECLARE(apr_bucket *) apr_bucket_socket_make(apr_bucket *b,
+ apr_socket_t *thissock);}
+
+{
+ * Create a bucket referring to a pipe.
+ * @param thispipe The pipe to put in the bucket
+ * @param list The freelist from which this bucket should be allocated
+ * @return The new bucket, or NULL if allocation failed
+ }
+{APU_DECLARE(apr_bucket *) apr_bucket_pipe_create(apr_file_t *thispipe,
+ apr_bucket_alloc_t *list);}
+
+{
+ * Make the bucket passed in a bucket refer to a pipe
+ * @param b The bucket to make into a PIPE bucket
+ * @param thispipe The pipe to put in the bucket
+ * @return The new bucket, or NULL if allocation failed
+ }
+{APU_DECLARE(apr_bucket *) apr_bucket_pipe_make(apr_bucket *b,
+ apr_file_t *thispipe);}
+
+{
+ * Create a bucket referring to a file.
+ * @param fd The file to put in the bucket
+ * @param offset The offset where the data of interest begins in the file
+ * @param len The amount of data in the file we are interested in
+ * @param p The pool into which any needed structures should be created
+ * while reading from this file bucket
+ * @param list The freelist from which this bucket should be allocated
+ * @return The new bucket, or NULL if allocation failed
+ }
+{APU_DECLARE(apr_bucket *) apr_bucket_file_create(apr_file_t *fd,
+ apr_off_t offset,
+ apr_size_t len,
+ apr_pool_t *p,
+ apr_bucket_alloc_t *list);
+}
+{
+ * Make the bucket passed in a bucket refer to a file
+ * @param b The bucket to make into a FILE bucket
+ * @param fd The file to put in the bucket
+ * @param offset The offset where the data of interest begins in the file
+ * @param len The amount of data in the file we are interested in
+ * @param p The pool into which any needed structures should be created
+ * while reading from this file bucket
+ * @return The new bucket, or NULL if allocation failed
+ }
+{APU_DECLARE(apr_bucket *) apr_bucket_file_make(apr_bucket *b, apr_file_t *fd,
+ apr_off_t offset,
+ apr_size_t len, apr_pool_t *p);
+}
+{
+ * Enable or disable memory-mapping for a FILE bucket (default is enabled)
+ * @param b The bucket
+ * @param enabled Whether memory-mapping should be enabled
+ * @return APR_SUCCESS normally, or an error code if the operation fails
+ }
+{APU_DECLARE(apr_status_t) apr_bucket_file_enable_mmap(apr_bucket *b,
+ int enabled);}
+
diff --git a/packages/httpd22/src/apr/apr_dso.inc b/packages/httpd22/src/apr/apr_dso.inc
new file mode 100644
index 0000000000..ec41ea6d61
--- /dev/null
+++ b/packages/httpd22/src/apr/apr_dso.inc
@@ -0,0 +1,95 @@
+{ Copyright 2000-2005 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed 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.
+ }
+
+{
+ * @file apr_dso.h
+ * @brief APR Dynamic Object Handling Routines
+ }
+
+{#include "apr.h"
+#include "apr_pools.h"
+#include "apr_errno.h"}
+
+{
+ * @defgroup apr_dso Dynamic Object Handling
+ * @ingroup APR
+ }
+
+{$define APR_HAS_DSO}
+
+{$if defined(APR_HAS_DSO) or defined(DOXYGEN)}
+
+{
+ * Structure for referencing dynamic objects
+ }
+type
+ apr_dso_handle_t = record
+ end;
+ Papr_dso_handle_t = ^apr_dso_handle_t;
+ PPapr_dso_handle_t = ^Papr_dso_handle_t;
+
+{
+ * Structure for referencing symbols from dynamic objects
+ }
+ apr_dso_handle_sym_t = Pointer;
+ Papr_dso_handle_sym_t = ^apr_dso_handle_sym_t;
+ PPapr_dso_handle_sym_t = ^Papr_dso_handle_sym_t;
+
+{
+ * Load a DSO library.
+ * @param res_handle Location to store new handle for the DSO.
+ * @param path Path to the DSO library
+ * @param ctx Pool to use.
+ * @bug We aught to provide an alternative to RTLD_GLOBAL, which
+ * is the only supported method of loading DSOs today.
+ }
+function apr_dso_load(res_handle: PPapr_dso_handle_t; const path: PChar;
+ ctx: Papr_pool_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_dso_load' + LibSuff12;
+
+{
+ * Close a DSO library.
+ * @param handle handle to close.
+ }
+function apr_dso_unload(handle: Papr_dso_handle_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_dso_unload' + LibSuff4;
+
+{
+ * Load a symbol from a DSO handle.
+ * @param ressym Location to store the loaded symbol
+ * @param handle handle to load the symbol from.
+ * @param symname Name of the symbol to load.
+ }
+function apr_dso_sym(ressym: Papr_dso_handle_t; handle: Papr_dso_handle_t;
+ const symname: PChar): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_dso_sym' + LibSuff12;
+
+{
+ * Report more information when a DSO function fails.
+ * @param dso The dso handle that has been opened
+ * @param buf Location to store the dso error
+ * @param bufsize The size of the provided buffer
+ }
+function apr_dso_error(dso: Papr_dso_handle_t; buf: PChar;
+ bufsize: apr_size_t): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_dso_error' + LibSuff12;
+
+{$endif}
+
diff --git a/packages/httpd22/src/apr/apr_errno.inc b/packages/httpd22/src/apr/apr_errno.inc
new file mode 100644
index 0000000000..c9d47a2033
--- /dev/null
+++ b/packages/httpd22/src/apr/apr_errno.inc
@@ -0,0 +1,1205 @@
+{ Copyright 2000-2005 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed 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.
+ }
+
+{
+ * @file apr_errno.h
+ * @brief APR Error Codes
+ }
+
+{#include "apr.h"
+
+#if APR_HAVE_ERRNO_H
+#include <errno.h>
+#endif}
+
+{
+ * @defgroup apr_errno Error Codes
+ * @ingroup APR
+ }
+
+{
+ * Type for specifying an error or status code.
+ }
+type
+ apr_status_t = Integer;
+ Papr_status_t = ^apr_status_t;
+
+{
+ * Return a human readable string describing the specified error.
+ * @param statcode The error code the get a string for.
+ * @param buf A buffer to hold the error string.
+ * @param bufsize Size of the buffer to hold the string.
+ }
+function apr_strerror(statcode: apr_status_t; buf: PChar; bufsize: apr_size_t): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_strerror' + LibSuff12;
+
+{$ifdef DOXYGEN)}
+{
+ * @def APR_FROM_OS_ERROR(os_err_type syserr)
+ * Fold a platform specific error into an apr_status_t code.
+ * @return apr_status_t
+ * @param e The platform os error code.
+ * @warning macro implementation; the syserr argument may be evaluated
+ * multiple times.
+ }
+#define APR_FROM_OS_ERROR(e) (e == 0 ? APR_SUCCESS : e + APR_OS_START_SYSERR)
+
+{
+ * @def APR_TO_OS_ERROR(apr_status_t statcode)
+ * @return os_err_type
+ * Fold an apr_status_t code back to the native platform defined error.
+ * @param e The apr_status_t folded platform os error code.
+ * @warning macro implementation; the statcode argument may be evaluated
+ * multiple times. If the statcode was not created by apr_get_os_error
+ * or APR_FROM_OS_ERROR, the results are undefined.
+ }
+#define APR_TO_OS_ERROR(e) (e == 0 ? APR_SUCCESS : e - APR_OS_START_SYSERR)
+
+{ @def apr_get_os_error()
+ * @return apr_status_t the last platform error, folded into apr_status_t, on most platforms
+ * @remark This retrieves errno, or calls a GetLastError() style function, and
+ * folds it with APR_FROM_OS_ERROR. Some platforms (such as OS2) have no
+ * such mechanism, so this call may be unsupported. Do NOT use this
+ * call for socket errors from socket, send, recv etc!
+ }
+
+{ @def apr_set_os_error(e)
+ * Reset the last platform error, unfolded from an apr_status_t, on some platforms
+ * @param e The OS error folded in a prior call to APR_FROM_OS_ERROR()
+ * @warning This is a macro implementation; the statcode argument may be evaluated
+ * multiple times. If the statcode was not created by apr_get_os_error
+ * or APR_FROM_OS_ERROR, the results are undefined. This macro sets
+ * errno, or calls a SetLastError() style function, unfolding statcode
+ * with APR_TO_OS_ERROR. Some platforms (such as OS2) have no such
+ * mechanism, so this call may be unsupported.
+ }
+
+{ @def apr_get_netos_error()
+ * Return the last socket error, folded into apr_status_t, on all platforms
+ * @remark This retrieves errno or calls a GetLastSocketError() style function,
+ * and folds it with APR_FROM_OS_ERROR.
+ }
+
+{ @def apr_set_netos_error(e)
+ * Reset the last socket error, unfolded from an apr_status_t
+ * @param e The socket error folded in a prior call to APR_FROM_OS_ERROR()
+ * @warning This is a macro implementation; the statcode argument may be evaluated
+ * multiple times. If the statcode was not created by apr_get_os_error
+ * or APR_FROM_OS_ERROR, the results are undefined. This macro sets
+ * errno, or calls a WSASetLastError() style function, unfolding
+ * socketcode with APR_TO_OS_ERROR.
+ }
+
+{$endif} { defined(DOXYGEN) }
+
+const
+{
+ * APR_OS_START_ERROR is where the APR specific error values start.
+ }
+ APR_OS_START_ERROR = 20000;
+{
+ * APR_OS_ERRSPACE_SIZE is the maximum number of errors you can fit
+ * into one of the error/status ranges below -- except for
+ * APR_OS_START_USERERR, which see.
+ }
+ APR_OS_ERRSPACE_SIZE = 50000;
+{
+ * APR_OS_START_STATUS is where the APR specific status codes start.
+ }
+ APR_OS_START_STATUS = (APR_OS_START_ERROR + APR_OS_ERRSPACE_SIZE);
+{
+ * APR_OS_START_USERERR are reserved for applications that use APR that
+ * layer their own error codes along with APR's. Note that the
+ * error immediately following this one is set ten times farther
+ * away than usual, so that users of apr have a lot of room in
+ * which to declare custom error codes.
+ }
+ APR_OS_START_USERERR = (APR_OS_START_STATUS + APR_OS_ERRSPACE_SIZE);
+{
+ * APR_OS_START_USEERR is obsolete, defined for compatibility only.
+ * Use APR_OS_START_USERERR instead.
+ }
+ APR_OS_START_USEERR = APR_OS_START_USERERR;
+{
+ * APR_OS_START_CANONERR is where APR versions of errno values are defined
+ * on systems which don't have the corresponding errno.
+ }
+ APR_OS_START_CANONERR = (APR_OS_START_USERERR + (APR_OS_ERRSPACE_SIZE * 10));
+{
+ * APR_OS_START_EAIERR folds EAI_ error codes from getaddrinfo() into
+ * apr_status_t values.
+ }
+ APR_OS_START_EAIERR = (APR_OS_START_CANONERR + APR_OS_ERRSPACE_SIZE);
+{
+ * APR_OS_START_SYSERR folds platform-specific system error values into
+ * apr_status_t values.
+ }
+ APR_OS_START_SYSERR = (APR_OS_START_EAIERR + APR_OS_ERRSPACE_SIZE);
+
+{ no error. @see APR_STATUS_IS_SUCCESS }
+ APR_SUCCESS = 0;
+
+{
+ * @defgroup APR_Error APR Error Values
+ * <PRE>
+ * <b>APR ERROR VALUES</b>
+ * APR_ENOSTAT APR was unable to perform a stat on the file
+ * APR_ENOPOOL APR was not provided a pool with which to allocate memory
+ * APR_EBADDATE APR was given an invalid date
+ * APR_EINVALSOCK APR was given an invalid socket
+ * APR_ENOPROC APR was not given a process structure
+ * APR_ENOTIME APR was not given a time structure
+ * APR_ENODIR APR was not given a directory structure
+ * APR_ENOLOCK APR was not given a lock structure
+ * APR_ENOPOLL APR was not given a poll structure
+ * APR_ENOSOCKET APR was not given a socket
+ * APR_ENOTHREAD APR was not given a thread structure
+ * APR_ENOTHDKEY APR was not given a thread key structure
+ * APR_ENOSHMAVAIL There is no more shared memory available
+ * APR_EDSOOPEN APR was unable to open the dso object. For more
+ * information call apr_dso_error().
+ * APR_EGENERAL General failure (specific information not available)
+ * APR_EBADIP The specified IP address is invalid
+ * APR_EBADMASK The specified netmask is invalid
+ * APR_ESYMNOTFOUND Could not find the requested symbol
+ * </PRE>
+ *
+ * <PRE>
+ * <b>APR STATUS VALUES</b>
+ * APR_INCHILD Program is currently executing in the child
+ * APR_INPARENT Program is currently executing in the parent
+ * APR_DETACH The thread is detached
+ * APR_NOTDETACH The thread is not detached
+ * APR_CHILD_DONE The child has finished executing
+ * APR_CHILD_NOTDONE The child has not finished executing
+ * APR_TIMEUP The operation did not finish before the timeout
+ * APR_INCOMPLETE The operation was incomplete although some processing
+ * was performed and the results are partially valid
+ * APR_BADCH Getopt found an option not in the option string
+ * APR_BADARG Getopt found an option that is missing an argument
+ * and an argument was specified in the option string
+ * APR_EOF APR has encountered the end of the file
+ * APR_NOTFOUND APR was unable to find the socket in the poll structure
+ * APR_ANONYMOUS APR is using anonymous shared memory
+ * APR_FILEBASED APR is using a file name as the key to the shared memory
+ * APR_KEYBASED APR is using a shared key as the key to the shared memory
+ * APR_EINIT Ininitalizer value. If no option has been found, but
+ * the status variable requires a value, this should be used
+ * APR_ENOTIMPL The APR function has not been implemented on this
+ * platform, either because nobody has gotten to it yet,
+ * or the function is impossible on this platform.
+ * APR_EMISMATCH Two passwords do not match.
+ * APR_EABSOLUTE The given path was absolute.
+ * APR_ERELATIVE The given path was relative.
+ * APR_EINCOMPLETE The given path was neither relative nor absolute.
+ * APR_EABOVEROOT The given path was above the root path.
+ * APR_EBUSY The given lock was busy.
+ * APR_EPROC_UNKNOWN The given process wasn't recognized by APR
+ * </PRE>
+ }
+{ @see APR_STATUS_IS_ENOSTAT }
+ APR_ENOSTAT = (APR_OS_START_ERROR + 1);
+{ @see APR_STATUS_IS_ENOPOOL }
+ APR_ENOPOOL = (APR_OS_START_ERROR + 2);
+{ empty slot: +3 }
+{ @see APR_STATUS_IS_EBADDATE }
+ APR_EBADDATE = (APR_OS_START_ERROR + 4);
+{ @see APR_STATUS_IS_EINVALSOCK }
+ APR_EINVALSOCK = (APR_OS_START_ERROR + 5);
+{ @see APR_STATUS_IS_ENOPROC }
+ APR_ENOPROC = (APR_OS_START_ERROR + 6);
+{ @see APR_STATUS_IS_ENOTIME }
+ APR_ENOTIME = (APR_OS_START_ERROR + 7);
+{ @see APR_STATUS_IS_ENODIR }
+ APR_ENODIR = (APR_OS_START_ERROR + 8);
+{ @see APR_STATUS_IS_ENOLOCK }
+ APR_ENOLOCK = (APR_OS_START_ERROR + 9);
+{ @see APR_STATUS_IS_ENOPOLL }
+ APR_ENOPOLL = (APR_OS_START_ERROR + 10);
+{ @see APR_STATUS_IS_ENOSOCKET }
+ APR_ENOSOCKET = (APR_OS_START_ERROR + 11);
+{ @see APR_STATUS_IS_ENOTHREAD }
+ APR_ENOTHREAD = (APR_OS_START_ERROR + 12);
+{ @see APR_STATUS_IS_ENOTHDKEY }
+ APR_ENOTHDKEY = (APR_OS_START_ERROR + 13);
+{ @see APR_STATUS_IS_EGENERAL }
+ APR_EGENERAL = (APR_OS_START_ERROR + 14);
+{ @see APR_STATUS_IS_ENOSHMAVAIL }
+ APR_ENOSHMAVAIL = (APR_OS_START_ERROR + 15);
+{ @see APR_STATUS_IS_EBADIP }
+ APR_EBADIP = (APR_OS_START_ERROR + 16);
+{ @see APR_STATUS_IS_EBADMASK }
+ APR_EBADMASK = (APR_OS_START_ERROR + 17);
+{ empty slot: +18 }
+{ @see APR_STATUS_IS_EDSOPEN }
+ APR_EDSOOPEN = (APR_OS_START_ERROR + 19);
+{ @see APR_STATUS_IS_EABSOLUTE }
+ APR_EABSOLUTE = (APR_OS_START_ERROR + 20);
+{ @see APR_STATUS_IS_ERELATIVE }
+ APR_ERELATIVE = (APR_OS_START_ERROR + 21);
+{ @see APR_STATUS_IS_EINCOMPLETE }
+ APR_EINCOMPLETE = (APR_OS_START_ERROR + 22);
+{ @see APR_STATUS_IS_EABOVEROOT }
+ APR_EABOVEROOT = (APR_OS_START_ERROR + 23);
+{ @see APR_STATUS_IS_EBADPATH }
+ APR_EBADPATH = (APR_OS_START_ERROR + 24);
+{ @see APR_STATUS_IS_EPATHWILD }
+ APR_EPATHWILD = (APR_OS_START_ERROR + 25);
+{ @see APR_STATUS_IS_ESYMNOTFOUND }
+ APR_ESYMNOTFOUND = (APR_OS_START_ERROR + 26);
+{ @see APR_STATUS_IS_EPROC_UNKNOWN }
+ APR_EPROC_UNKNOWN = (APR_OS_START_ERROR + 27);
+{ @see APR_STATUS_IS_ENOTENOUGHENTROPY }
+ APR_ENOTENOUGHENTROPY = (APR_OS_START_ERROR + 28);
+
+{
+ * @defgroup APR_STATUS_IS Status Value Tests
+ * @warning For any particular error condition, more than one of these tests
+ * may match. This is because platform-specific error codes may not
+ * always match the semantics of the POSIX codes these tests (and the
+ * corresponding APR error codes) are named after. A notable example
+ * are the APR_STATUS_IS_ENOENT and APR_STATUS_IS_ENOTDIR tests on
+ * Win32 platforms. The programmer should always be aware of this and
+ * adjust the order of the tests accordingly.
+ }
+{
+ * APR was unable to perform a stat on the file
+ * @warning always use this test, as platform-specific variances may meet this
+ * more than one error code
+ }
+//#define APR_STATUS_IS_ENOSTAT(s) ((s) == APR_ENOSTAT)
+{
+ * APR was not provided a pool with which to allocate memory
+ * @warning always use this test, as platform-specific variances may meet this
+ * more than one error code
+ }
+//#define APR_STATUS_IS_ENOPOOL(s) ((s) == APR_ENOPOOL)
+{ APR was given an invalid date }
+//#define APR_STATUS_IS_EBADDATE(s) ((s) == APR_EBADDATE)
+{ APR was given an invalid socket }
+//#define APR_STATUS_IS_EINVALSOCK(s) ((s) == APR_EINVALSOCK)
+{ APR was not given a process structure }
+//#define APR_STATUS_IS_ENOPROC(s) ((s) == APR_ENOPROC)
+{ APR was not given a time structure }
+//#define APR_STATUS_IS_ENOTIME(s) ((s) == APR_ENOTIME)
+{ APR was not given a directory structure }
+//#define APR_STATUS_IS_ENODIR(s) ((s) == APR_ENODIR)
+{ APR was not given a lock structure }
+//#define APR_STATUS_IS_ENOLOCK(s) ((s) == APR_ENOLOCK)
+{ APR was not given a poll structure }
+//#define APR_STATUS_IS_ENOPOLL(s) ((s) == APR_ENOPOLL)
+{ APR was not given a socket }
+//#define APR_STATUS_IS_ENOSOCKET(s) ((s) == APR_ENOSOCKET)
+{ APR was not given a thread structure }
+//#define APR_STATUS_IS_ENOTHREAD(s) ((s) == APR_ENOTHREAD)
+{ APR was not given a thread key structure }
+//#define APR_STATUS_IS_ENOTHDKEY(s) ((s) == APR_ENOTHDKEY)
+{ Generic Error which can not be put into another spot }
+//#define APR_STATUS_IS_EGENERAL(s) ((s) == APR_EGENERAL)
+{ There is no more shared memory available }
+//#define APR_STATUS_IS_ENOSHMAVAIL(s) ((s) == APR_ENOSHMAVAIL)
+{ The specified IP address is invalid }
+//#define APR_STATUS_IS_EBADIP(s) ((s) == APR_EBADIP)
+{ The specified netmask is invalid }
+//#define APR_STATUS_IS_EBADMASK(s) ((s) == APR_EBADMASK)
+{ empty slot: +18 }
+{
+ * APR was unable to open the dso object.
+ * For more information call apr_dso_error().
+ }
+//#if defined(WIN32)
+//#define APR_STATUS_IS_EDSOOPEN(s) ((s) == APR_EDSOOPEN \
+// || APR_TO_OS_ERROR(s) == ERROR_MOD_NOT_FOUND)
+//#else
+//#define APR_STATUS_IS_EDSOOPEN(s) ((s) == APR_EDSOOPEN)
+//#endif
+{ The given path was absolute. }
+//#define APR_STATUS_IS_EABSOLUTE(s) ((s) == APR_EABSOLUTE)
+{ The given path was relative. }
+//#define APR_STATUS_IS_ERELATIVE(s) ((s) == APR_ERELATIVE)
+{ The given path was neither relative nor absolute. }
+//#define APR_STATUS_IS_EINCOMPLETE(s) ((s) == APR_EINCOMPLETE)
+{ The given path was above the root path. }
+//#define APR_STATUS_IS_EABOVEROOT(s) ((s) == APR_EABOVEROOT)
+{ The given path was bad. }
+//#define APR_STATUS_IS_EBADPATH(s) ((s) == APR_EBADPATH)
+{ The given path contained wildcards. }
+//#define APR_STATUS_IS_EPATHWILD(s) ((s) == APR_EPATHWILD)
+{ Could not find the requested symbol.
+ * For more information call apr_dso_error().
+ }
+//#if defined(WIN32)
+//#define APR_STATUS_IS_ESYMNOTFOUND(s) ((s) == APR_ESYMNOTFOUND \
+// || APR_TO_OS_ERROR(s) == ERROR_PROC_NOT_FOUND)
+//#else
+//#define APR_STATUS_IS_ESYMNOTFOUND(s) ((s) == APR_ESYMNOTFOUND)
+//#endif
+{ The given process was not recognized by APR. }
+//#define APR_STATUS_IS_EPROC_UNKNOWN(s) ((s) == APR_EPROC_UNKNOWN)
+
+{ APR could not gather enough entropy to continue. }
+//#define APR_STATUS_IS_ENOTENOUGHENTROPY(s) ((s) == APR_ENOTENOUGHENTROPY)
+
+{
+ * @addtogroup APR_Error
+ }
+{ @see APR_STATUS_IS_INCHILD }
+ APR_INCHILD = (APR_OS_START_STATUS + 1);
+{ @see APR_STATUS_IS_INPARENT }
+ APR_INPARENT = (APR_OS_START_STATUS + 2);
+{ @see APR_STATUS_IS_DETACH }
+ APR_DETACH = (APR_OS_START_STATUS + 3);
+{ @see APR_STATUS_IS_NOTDETACH }
+ APR_NOTDETACH = (APR_OS_START_STATUS + 4);
+{ @see APR_STATUS_IS_CHILD_DONE }
+ APR_CHILD_DONE = (APR_OS_START_STATUS + 5);
+{ @see APR_STATUS_IS_CHILD_NOTDONE }
+ APR_CHILD_NOTDONE = (APR_OS_START_STATUS + 6);
+{ @see APR_STATUS_IS_TIMEUP }
+ APR_TIMEUP = (APR_OS_START_STATUS + 7);
+{ @see APR_STATUS_IS_INCOMPLETE }
+ APR_INCOMPLETE = (APR_OS_START_STATUS + 8);
+{ empty slot: +9 }
+{ empty slot: +10 }
+{ empty slot: +11 }
+{ @see APR_STATUS_IS_BADCH }
+ APR_BADCH = (APR_OS_START_STATUS + 12);
+{ @see APR_STATUS_IS_BADARG }
+ APR_BADARG = (APR_OS_START_STATUS + 13);
+{ @see APR_STATUS_IS_EOF }
+ APR_EOF = (APR_OS_START_STATUS + 14);
+{ @see APR_STATUS_IS_NOTFOUND }
+ APR_NOTFOUND = (APR_OS_START_STATUS + 15);
+{ empty slot: +16 }
+{ empty slot: +17 }
+{ empty slot: +18 }
+{ @see APR_STATUS_IS_ANONYMOUS }
+ APR_ANONYMOUS = (APR_OS_START_STATUS + 19);
+{ @see APR_STATUS_IS_FILEBASED }
+ APR_FILEBASED = (APR_OS_START_STATUS + 20);
+{ @see APR_STATUS_IS_KEYBASED }
+ APR_KEYBASED = (APR_OS_START_STATUS + 21);
+{ @see APR_STATUS_IS_EINIT }
+ APR_EINIT = (APR_OS_START_STATUS + 22);
+{ @see APR_STATUS_IS_ENOTIMPL }
+ APR_ENOTIMPL = (APR_OS_START_STATUS + 23);
+{ @see APR_STATUS_IS_EMISMATCH }
+ APR_EMISMATCH = (APR_OS_START_STATUS + 24);
+{ @see APR_STATUS_IS_EBUSY }
+ APR_EBUSY = (APR_OS_START_STATUS + 25);
+
+{
+ * @addtogroup APR_STATUS_IS
+ }
+{
+ * Program is currently executing in the child
+ * @warning
+ * always use this test, as platform-specific variances may meet this
+ * more than one error code }
+//#define APR_STATUS_IS_INCHILD(s) ((s) == APR_INCHILD)
+{
+ * Program is currently executing in the parent
+ * @warning
+ * always use this test, as platform-specific variances may meet this
+ * more than one error code
+ }
+//#define APR_STATUS_IS_INPARENT(s) ((s) == APR_INPARENT)
+{
+ * The thread is detached
+ * @warning
+ * always use this test, as platform-specific variances may meet this
+ * more than one error code
+ }
+//#define APR_STATUS_IS_DETACH(s) ((s) == APR_DETACH)
+{
+ * The thread is not detached
+ * @warning
+ * always use this test, as platform-specific variances may meet this
+ * more than one error code
+ }
+//#define APR_STATUS_IS_NOTDETACH(s) ((s) == APR_NOTDETACH)
+{
+ * The child has finished executing
+ * @warning
+ * always use this test, as platform-specific variances may meet this
+ * more than one error code
+ }
+//#define APR_STATUS_IS_CHILD_DONE(s) ((s) == APR_CHILD_DONE)
+{
+ * The child has not finished executing
+ * @warning
+ * always use this test, as platform-specific variances may meet this
+ * more than one error code
+ }
+//#define APR_STATUS_IS_CHILD_NOTDONE(s) ((s) == APR_CHILD_NOTDONE)
+{
+ * The operation did not finish before the timeout
+ * @warning
+ * always use this test, as platform-specific variances may meet this
+ * more than one error code
+ }
+//#define APR_STATUS_IS_TIMEUP(s) ((s) == APR_TIMEUP)
+{
+ * The operation was incomplete although some processing was performed
+ * and the results are partially valid.
+ * @warning
+ * always use this test, as platform-specific variances may meet this
+ * more than one error code
+ }
+//#define APR_STATUS_IS_INCOMPLETE(s) ((s) == APR_INCOMPLETE)
+{ empty slot: +9 }
+{ empty slot: +10 }
+{ empty slot: +11 }
+{
+ * Getopt found an option not in the option string
+ * @warning
+ * always use this test, as platform-specific variances may meet this
+ * more than one error code
+ }
+//#define APR_STATUS_IS_BADCH(s) ((s) == APR_BADCH)
+{
+ * Getopt found an option not in the option string and an argument was
+ * specified in the option string
+ * @warning
+ * always use this test, as platform-specific variances may meet this
+ * more than one error code
+ }
+//#define APR_STATUS_IS_BADARG(s) ((s) == APR_BADARG)
+{
+ * APR has encountered the end of the file
+ * @warning
+ * always use this test, as platform-specific variances may meet this
+ * more than one error code
+ }
+//#define APR_STATUS_IS_EOF(s) ((s) == APR_EOF)
+{
+ * APR was unable to find the socket in the poll structure
+ * @warning
+ * always use this test, as platform-specific variances may meet this
+ * more than one error code
+ }
+//#define APR_STATUS_IS_NOTFOUND(s) ((s) == APR_NOTFOUND)
+{ empty slot: +16 }
+{ empty slot: +17 }
+{ empty slot: +18 }
+{
+ * APR is using anonymous shared memory
+ * @warning
+ * always use this test, as platform-specific variances may meet this
+ * more than one error code
+ }
+//#define APR_STATUS_IS_ANONYMOUS(s) ((s) == APR_ANONYMOUS)
+{
+ * APR is using a file name as the key to the shared memory
+ * @warning
+ * always use this test, as platform-specific variances may meet this
+ * more than one error code
+ }
+//#define APR_STATUS_IS_FILEBASED(s) ((s) == APR_FILEBASED)
+{
+ * APR is using a shared key as the key to the shared memory
+ * @warning
+ * always use this test, as platform-specific variances may meet this
+ * more than one error code
+ }
+//#define APR_STATUS_IS_KEYBASED(s) ((s) == APR_KEYBASED)
+{
+ * Ininitalizer value. If no option has been found, but
+ * the status variable requires a value, this should be used
+ * @warning
+ * always use this test, as platform-specific variances may meet this
+ * more than one error code
+ }
+//#define APR_STATUS_IS_EINIT(s) ((s) == APR_EINIT)
+{
+ * The APR function has not been implemented on this
+ * platform, either because nobody has gotten to it yet,
+ * or the function is impossible on this platform.
+ * @warning
+ * always use this test, as platform-specific variances may meet this
+ * more than one error code
+ }
+//#define APR_STATUS_IS_ENOTIMPL(s) ((s) == APR_ENOTIMPL)
+{
+ * Two passwords do not match.
+ * @warning
+ * always use this test, as platform-specific variances may meet this
+ * more than one error code
+ }
+//#define APR_STATUS_IS_EMISMATCH(s) ((s) == APR_EMISMATCH)
+{
+ * The given lock was busy
+ * @warning always use this test, as platform-specific variances may meet this
+ * more than one error code
+ }
+//#define APR_STATUS_IS_EBUSY(s) ((s) == APR_EBUSY)
+
+{
+ * @addtogroup APR_Error APR Error Values
+ }
+{ APR CANONICAL ERROR VALUES }
+{ @see APR_STATUS_IS_EACCES }
+{#ifdef EACCES
+#define APR_EACCES EACCES
+#else
+#define APR_EACCES (APR_OS_START_CANONERR + 1)
+#endif
+}
+{ @see APR_STATUS_IS_EXIST }
+{#ifdef EEXIST
+#define APR_EEXIST EEXIST
+#else
+#define APR_EEXIST (APR_OS_START_CANONERR + 2)
+#endif
+}
+{ @see APR_STATUS_IS_ENAMETOOLONG }
+{#ifdef ENAMETOOLONG
+#define APR_ENAMETOOLONG ENAMETOOLONG
+#else
+#define APR_ENAMETOOLONG (APR_OS_START_CANONERR + 3)
+#endif
+}
+{ @see APR_STATUS_IS_ENOENT }
+{#ifdef ENOENT
+#define APR_ENOENT ENOENT
+#else
+#define APR_ENOENT (APR_OS_START_CANONERR + 4)
+#endif
+}
+{ @see APR_STATUS_IS_ENOTDIR }
+{#ifdef ENOTDIR
+#define APR_ENOTDIR ENOTDIR
+#else
+#define APR_ENOTDIR (APR_OS_START_CANONERR + 5)
+#endif
+}
+{ @see APR_STATUS_IS_ENOSPC }
+{#ifdef ENOSPC
+#define APR_ENOSPC ENOSPC
+#else
+#define APR_ENOSPC (APR_OS_START_CANONERR + 6)
+#endif
+}
+{ @see APR_STATUS_IS_ENOMEM }
+{#ifdef ENOMEM
+#define APR_ENOMEM ENOMEM
+#else
+#define APR_ENOMEM (APR_OS_START_CANONERR + 7)
+#endif
+}
+{ @see APR_STATUS_IS_EMFILE }
+{#ifdef EMFILE
+#define APR_EMFILE EMFILE
+#else
+#define APR_EMFILE (APR_OS_START_CANONERR + 8)
+#endif
+}
+{ @see APR_STATUS_IS_ENFILE }
+{#ifdef ENFILE
+#define APR_ENFILE ENFILE
+#else
+#define APR_ENFILE (APR_OS_START_CANONERR + 9)
+#endif
+}
+{ @see APR_STATUS_IS_EBADF }
+{#ifdef EBADF
+#define APR_EBADF EBADF
+#else
+#define APR_EBADF (APR_OS_START_CANONERR + 10)
+#endif
+}
+{ @see APR_STATUS_IS_EINVAL }
+{#ifdef EINVAL
+#define APR_EINVAL EINVAL
+#else
+#define APR_EINVAL (APR_OS_START_CANONERR + 11)
+#endif
+}
+{ @see APR_STATUS_IS_ESPIPE }
+{#ifdef ESPIPE
+#define APR_ESPIPE ESPIPE
+#else
+#define APR_ESPIPE (APR_OS_START_CANONERR + 12)
+#endif
+}
+{
+ * @see APR_STATUS_IS_EAGAIN
+ * @warning use APR_STATUS_IS_EAGAIN instead of just testing this value
+ }
+{#ifdef EAGAIN
+#define APR_EAGAIN EAGAIN
+#elif defined(EWOULDBLOCK)
+#define APR_EAGAIN EWOULDBLOCK
+#else
+#define APR_EAGAIN (APR_OS_START_CANONERR + 13)
+#endif
+}
+{ @see APR_STATUS_IS_EINTR }
+{#ifdef EINTR
+#define APR_EINTR EINTR
+#else
+#define APR_EINTR (APR_OS_START_CANONERR + 14)
+#endif
+}
+{ @see APR_STATUS_IS_ENOTSOCK }
+{#ifdef ENOTSOCK
+#define APR_ENOTSOCK ENOTSOCK
+#else
+#define APR_ENOTSOCK (APR_OS_START_CANONERR + 15)
+#endif
+}
+{ @see APR_STATUS_IS_ECONNREFUSED }
+{#ifdef ECONNREFUSED
+#define APR_ECONNREFUSED ECONNREFUSED
+#else
+#define APR_ECONNREFUSED (APR_OS_START_CANONERR + 16)
+#endif
+}
+{ @see APR_STATUS_IS_EINPROGRESS }
+{#ifdef EINPROGRESS
+#define APR_EINPROGRESS EINPROGRESS
+#else
+#define APR_EINPROGRESS (APR_OS_START_CANONERR + 17)
+#endif
+}
+{
+ * @see APR_STATUS_IS_ECONNABORTED
+ * @warning use APR_STATUS_IS_ECONNABORTED instead of just testing this value
+ }
+
+{#ifdef ECONNABORTED
+#define APR_ECONNABORTED ECONNABORTED
+#else
+#define APR_ECONNABORTED (APR_OS_START_CANONERR + 18)
+#endif
+}
+{ @see APR_STATUS_IS_ECONNRESET }
+{#ifdef ECONNRESET
+#define APR_ECONNRESET ECONNRESET
+#else
+#define APR_ECONNRESET (APR_OS_START_CANONERR + 19)
+#endif
+}
+{* @see APR_STATUS_IS_ETIMEDOUT
+ * @deprecated}
+{#ifdef ETIMEDOUT
+#define APR_ETIMEDOUT ETIMEDOUT
+#else
+#define APR_ETIMEDOUT (APR_OS_START_CANONERR + 20)
+#endif
+}
+{ @see APR_STATUS_IS_EHOSTUNREACH }
+{#ifdef EHOSTUNREACH
+#define APR_EHOSTUNREACH EHOSTUNREACH
+#else
+#define APR_EHOSTUNREACH (APR_OS_START_CANONERR + 21)
+#endif
+}
+{ @see APR_STATUS_IS_ENETUNREACH }
+{#ifdef ENETUNREACH
+#define APR_ENETUNREACH ENETUNREACH
+#else
+#define APR_ENETUNREACH (APR_OS_START_CANONERR + 22)
+#endif
+}
+{ @see APR_STATUS_IS_EFTYPE }
+{#ifdef EFTYPE
+#define APR_EFTYPE EFTYPE
+#else
+#define APR_EFTYPE (APR_OS_START_CANONERR + 23)
+#endif
+}
+{ @see APR_STATUS_IS_EPIPE }
+{#ifdef EPIPE
+#define APR_EPIPE EPIPE
+#else
+#define APR_EPIPE (APR_OS_START_CANONERR + 24)
+#endif
+}
+{ @see APR_STATUS_IS_EXDEV }
+{#ifdef EXDEV
+#define APR_EXDEV EXDEV
+#else
+#define APR_EXDEV (APR_OS_START_CANONERR + 25)
+#endif
+}
+{ @see APR_STATUS_IS_ENOTEMPTY }
+{#ifdef ENOTEMPTY
+#define APR_ENOTEMPTY ENOTEMPTY
+#else
+#define APR_ENOTEMPTY (APR_OS_START_CANONERR + 26)
+#endif
+
+#if defined(OS2) && !defined(DOXYGEN)
+
+#define APR_FROM_OS_ERROR(e) (e == 0 ? APR_SUCCESS : e + APR_OS_START_SYSERR)
+#define APR_TO_OS_ERROR(e) (e == 0 ? APR_SUCCESS : e - APR_OS_START_SYSERR)
+
+#define INCL_DOSERRORS
+#define INCL_DOS
+}
+{ Leave these undefined.
+ * OS2 doesn't rely on the errno concept.
+ * The API calls always return a result codes which
+ * should be filtered through APR_FROM_OS_ERROR().
+ *
+ * #define apr_get_os_error() (APR_FROM_OS_ERROR(GetLastError()))
+ * #define apr_set_os_error(e) (SetLastError(APR_TO_OS_ERROR(e)))
+ }
+
+{ A special case, only socket calls require this;
+ }
+{#define apr_get_netos_error() (APR_FROM_OS_ERROR(errno))
+#define apr_set_netos_error(e) (errno = APR_TO_OS_ERROR(e))
+}
+{ And this needs to be greped away for good:
+ }
+{#define APR_OS2_STATUS(e) (APR_FROM_OS_ERROR(e))
+
+}
+{ These can't sit in a private header, so in spite of the extra size,
+ * they need to be made available here.
+ }
+ SOCBASEERR = 10000;
+ SOCEPERM = (SOCBASEERR+1); { Not owner }
+ SOCESRCH = (SOCBASEERR+3); { No such process }
+ SOCEINTR = (SOCBASEERR+4); { Interrupted system call }
+ SOCENXIO = (SOCBASEERR+6); { No such device or address }
+ SOCEBADF = (SOCBASEERR+9); { Bad file number }
+ SOCEACCES = (SOCBASEERR+13); { Permission denied }
+ SOCEFAULT = (SOCBASEERR+14); { Bad address }
+ SOCEINVAL = (SOCBASEERR+22); { Invalid argument }
+ SOCEMFILE = (SOCBASEERR+24); { Too many open files }
+ SOCEPIPE = (SOCBASEERR+32); { Broken pipe }
+ SOCEOS2ERR = (SOCBASEERR+100); { OS/2 Error }
+ SOCEWOULDBLOCK = (SOCBASEERR+35); { Operation would block }
+ SOCEINPROGRESS = (SOCBASEERR+36); { Operation now in progress }
+ SOCEALREADY = (SOCBASEERR+37); { Operation already in progress }
+ SOCENOTSOCK = (SOCBASEERR+38); { Socket operation on non-socket }
+ SOCEDESTADDRREQ = (SOCBASEERR+39); { Destination address required }
+ SOCEMSGSIZE = (SOCBASEERR+40); { Message too long }
+ SOCEPROTOTYPE = (SOCBASEERR+41); { Protocol wrong type for socket }
+ SOCENOPROTOOPT = (SOCBASEERR+42); { Protocol not available }
+ SOCEPROTONOSUPPORT = (SOCBASEERR+43); { Protocol not supported }
+ SOCESOCKTNOSUPPORT = (SOCBASEERR+44); { Socket type not supported }
+ SOCEOPNOTSUPP = (SOCBASEERR+45); { Operation not supported on socket }
+ SOCEPFNOSUPPORT = (SOCBASEERR+46); { Protocol family not supported }
+ SOCEAFNOSUPPORT = (SOCBASEERR+47); { Address family not supported by protocol family }
+ SOCEADDRINUSE = (SOCBASEERR+48); { Address already in use }
+ SOCEADDRNOTAVAIL = (SOCBASEERR+49); { Can't assign requested address }
+ SOCENETDOWN = (SOCBASEERR+50); { Network is down }
+ SOCENETUNREACH = (SOCBASEERR+51); { Network is unreachable }
+ SOCENETRESET = (SOCBASEERR+52); { Network dropped connection on reset }
+ SOCECONNABORTED = (SOCBASEERR+53); { Software caused connection abort }
+ SOCECONNRESET = (SOCBASEERR+54); { Connection reset by peer }
+ SOCENOBUFS = (SOCBASEERR+55); { No buffer space available }
+ SOCEISCONN = (SOCBASEERR+56); { Socket is already connected }
+ SOCENOTCONN = (SOCBASEERR+57); { Socket is not connected }
+ SOCESHUTDOWN = (SOCBASEERR+58); { Can't send after socket shutdown }
+ SOCETOOMANYREFS = (SOCBASEERR+59); { Too many references: can't splice }
+ SOCETIMEDOUT = (SOCBASEERR+60); { Connection timed out }
+ SOCECONNREFUSED = (SOCBASEERR+61); { Connection refused }
+ SOCELOOP = (SOCBASEERR+62); { Too many levels of symbolic links }
+ SOCENAMETOOLONG = (SOCBASEERR+63); { File name too long }
+ SOCEHOSTDOWN = (SOCBASEERR+64); { Host is down }
+ SOCEHOSTUNREACH = (SOCBASEERR+65); { No route to host }
+ SOCENOTEMPTY = (SOCBASEERR+66); { Directory not empty }
+
+{ APR CANONICAL ERROR TESTS }
+{#define APR_STATUS_IS_EACCES(s) ((s) == APR_EACCES \
+ || (s) == APR_OS_START_SYSERR + ERROR_ACCESS_DENIED \
+ || (s) == APR_OS_START_SYSERR + ERROR_SHARING_VIOLATION)
+#define APR_STATUS_IS_EEXIST(s) ((s) == APR_EEXIST \
+ || (s) == APR_OS_START_SYSERR + ERROR_OPEN_FAILED \
+ || (s) == APR_OS_START_SYSERR + ERROR_FILE_EXISTS \
+ || (s) == APR_OS_START_SYSERR + ERROR_ALREADY_EXISTS \
+ || (s) == APR_OS_START_SYSERR + ERROR_ACCESS_DENIED)
+#define APR_STATUS_IS_ENAMETOOLONG(s) ((s) == APR_ENAMETOOLONG \
+ || (s) == APR_OS_START_SYSERR + ERROR_FILENAME_EXCED_RANGE \
+ || (s) == APR_OS_START_SYSERR + SOCENAMETOOLONG)
+#define APR_STATUS_IS_ENOENT(s) ((s) == APR_ENOENT \
+ || (s) == APR_OS_START_SYSERR + ERROR_FILE_NOT_FOUND \
+ || (s) == APR_OS_START_SYSERR + ERROR_PATH_NOT_FOUND \
+ || (s) == APR_OS_START_SYSERR + ERROR_NO_MORE_FILES \
+ || (s) == APR_OS_START_SYSERR + ERROR_OPEN_FAILED)
+#define APR_STATUS_IS_ENOTDIR(s) ((s) == APR_ENOTDIR)
+#define APR_STATUS_IS_ENOSPC(s) ((s) == APR_ENOSPC \
+ || (s) == APR_OS_START_SYSERR + ERROR_DISK_FULL)
+#define APR_STATUS_IS_ENOMEM(s) ((s) == APR_ENOMEM)
+#define APR_STATUS_IS_EMFILE(s) ((s) == APR_EMFILE \
+ || (s) == APR_OS_START_SYSERR + ERROR_TOO_MANY_OPEN_FILES)
+#define APR_STATUS_IS_ENFILE(s) ((s) == APR_ENFILE)
+#define APR_STATUS_IS_EBADF(s) ((s) == APR_EBADF \
+ || (s) == APR_OS_START_SYSERR + ERROR_INVALID_HANDLE)
+#define APR_STATUS_IS_EINVAL(s) ((s) == APR_EINVAL \
+ || (s) == APR_OS_START_SYSERR + ERROR_INVALID_PARAMETER \
+ || (s) == APR_OS_START_SYSERR + ERROR_INVALID_FUNCTION)
+#define APR_STATUS_IS_ESPIPE(s) ((s) == APR_ESPIPE \
+ || (s) == APR_OS_START_SYSERR + ERROR_NEGATIVE_SEEK)
+#define APR_STATUS_IS_EAGAIN(s) ((s) == APR_EAGAIN \
+ || (s) == APR_OS_START_SYSERR + ERROR_NO_DATA \
+ || (s) == APR_OS_START_SYSERR + SOCEWOULDBLOCK \
+ || (s) == APR_OS_START_SYSERR + ERROR_LOCK_VIOLATION)
+#define APR_STATUS_IS_EINTR(s) ((s) == APR_EINTR \
+ || (s) == APR_OS_START_SYSERR + SOCEINTR)
+#define APR_STATUS_IS_ENOTSOCK(s) ((s) == APR_ENOTSOCK \
+ || (s) == APR_OS_START_SYSERR + SOCENOTSOCK)
+#define APR_STATUS_IS_ECONNREFUSED(s) ((s) == APR_ECONNREFUSED \
+ || (s) == APR_OS_START_SYSERR + SOCECONNREFUSED)
+#define APR_STATUS_IS_EINPROGRESS(s) ((s) == APR_EINPROGRESS \
+ || (s) == APR_OS_START_SYSERR + SOCEINPROGRESS)
+#define APR_STATUS_IS_ECONNABORTED(s) ((s) == APR_ECONNABORTED \
+ || (s) == APR_OS_START_SYSERR + SOCECONNABORTED)
+#define APR_STATUS_IS_ECONNRESET(s) ((s) == APR_ECONNRESET \
+ || (s) == APR_OS_START_SYSERR + SOCECONNRESET)
+/* XXX deprecated */
+#define APR_STATUS_IS_ETIMEDOUT(s) ((s) == APR_ETIMEDOUT \
+ || (s) == APR_OS_START_SYSERR + SOCETIMEDOUT)
+#undef APR_STATUS_IS_TIMEUP
+#define APR_STATUS_IS_TIMEUP(s) ((s) == APR_TIMEUP \
+ || (s) == APR_OS_START_SYSERR + SOCETIMEDOUT)
+#define APR_STATUS_IS_EHOSTUNREACH(s) ((s) == APR_EHOSTUNREACH \
+ || (s) == APR_OS_START_SYSERR + SOCEHOSTUNREACH)
+#define APR_STATUS_IS_ENETUNREACH(s) ((s) == APR_ENETUNREACH \
+ || (s) == APR_OS_START_SYSERR + SOCENETUNREACH)
+#define APR_STATUS_IS_EFTYPE(s) ((s) == APR_EFTYPE)
+#define APR_STATUS_IS_EPIPE(s) ((s) == APR_EPIPE \
+ || (s) == APR_OS_START_SYSERR + ERROR_BROKEN_PIPE \
+ || (s) == APR_OS_START_SYSERR + SOCEPIPE)
+#define APR_STATUS_IS_EXDEV(s) ((s) == APR_EXDEV \
+ || (s) == APR_OS_START_SYSERR + ERROR_NOT_SAME_DEVICE)
+#define APR_STATUS_IS_ENOTEMPTY(s) ((s) == APR_ENOTEMPTY \
+ || (s) == APR_OS_START_SYSERR + ERROR_DIR_NOT_EMPTY \
+ || (s) == APR_OS_START_SYSERR + ERROR_ACCESS_DENIED)
+}
+{
+ Sorry, too tired to wrap this up for OS2... feel free to
+ fit the following into their best matches.
+
+ ( ERROR_NO_SIGNAL_SENT, ESRCH ),
+ ( SOCEALREADY, EALREADY ),
+ ( SOCEDESTADDRREQ, EDESTADDRREQ ),
+ ( SOCEMSGSIZE, EMSGSIZE ),
+ ( SOCEPROTOTYPE, EPROTOTYPE ),
+ ( SOCENOPROTOOPT, ENOPROTOOPT ),
+ ( SOCEPROTONOSUPPORT, EPROTONOSUPPORT ),
+ ( SOCESOCKTNOSUPPORT, ESOCKTNOSUPPORT ),
+ ( SOCEOPNOTSUPP, EOPNOTSUPP ),
+ ( SOCEPFNOSUPPORT, EPFNOSUPPORT ),
+ ( SOCEAFNOSUPPORT, EAFNOSUPPORT ),
+ ( SOCEADDRINUSE, EADDRINUSE ),
+ ( SOCEADDRNOTAVAIL, EADDRNOTAVAIL ),
+ ( SOCENETDOWN, ENETDOWN ),
+ ( SOCENETRESET, ENETRESET ),
+ ( SOCENOBUFS, ENOBUFS ),
+ ( SOCEISCONN, EISCONN ),
+ ( SOCENOTCONN, ENOTCONN ),
+ ( SOCESHUTDOWN, ESHUTDOWN ),
+ ( SOCETOOMANYREFS, ETOOMANYREFS ),
+ ( SOCELOOP, ELOOP ),
+ ( SOCEHOSTDOWN, EHOSTDOWN ),
+ ( SOCENOTEMPTY, ENOTEMPTY ),
+ ( SOCEPIPE, EPIPE )
+}
+
+//#elif defined(WIN32) && !defined(DOXYGEN) { !defined(OS2) }
+
+{#define APR_FROM_OS_ERROR(e) (e == 0 ? APR_SUCCESS : e + APR_OS_START_SYSERR)
+#define APR_TO_OS_ERROR(e) (e == 0 ? APR_SUCCESS : e - APR_OS_START_SYSERR)
+
+#define apr_get_os_error() (APR_FROM_OS_ERROR(GetLastError()))
+#define apr_set_os_error(e) (SetLastError(APR_TO_OS_ERROR(e)))}
+
+{ A special case, only socket calls require this:
+ }
+{#define apr_get_netos_error() (APR_FROM_OS_ERROR(WSAGetLastError()))
+#define apr_set_netos_error(e) (WSASetLastError(APR_TO_OS_ERROR(e)))
+
+}
+{ APR CANONICAL ERROR TESTS }
+{#define APR_STATUS_IS_EACCES(s) ((s) == APR_EACCES \
+ || (s) == APR_OS_START_SYSERR + ERROR_ACCESS_DENIED \
+ || (s) == APR_OS_START_SYSERR + ERROR_CANNOT_MAKE \
+ || (s) == APR_OS_START_SYSERR + ERROR_CURRENT_DIRECTORY \
+ || (s) == APR_OS_START_SYSERR + ERROR_DRIVE_LOCKED \
+ || (s) == APR_OS_START_SYSERR + ERROR_FAIL_I24 \
+ || (s) == APR_OS_START_SYSERR + ERROR_LOCK_VIOLATION \
+ || (s) == APR_OS_START_SYSERR + ERROR_LOCK_FAILED \
+ || (s) == APR_OS_START_SYSERR + ERROR_NOT_LOCKED \
+ || (s) == APR_OS_START_SYSERR + ERROR_NETWORK_ACCESS_DENIED \
+ || (s) == APR_OS_START_SYSERR + ERROR_SHARING_VIOLATION)
+#define APR_STATUS_IS_EEXIST(s) ((s) == APR_EEXIST \
+ || (s) == APR_OS_START_SYSERR + ERROR_FILE_EXISTS \
+ || (s) == APR_OS_START_SYSERR + ERROR_ALREADY_EXISTS)
+#define APR_STATUS_IS_ENAMETOOLONG(s) ((s) == APR_ENAMETOOLONG \
+ || (s) == APR_OS_START_SYSERR + ERROR_FILENAME_EXCED_RANGE \
+ || (s) == APR_OS_START_SYSERR + WSAENAMETOOLONG)
+#define APR_STATUS_IS_ENOENT(s) ((s) == APR_ENOENT \
+ || (s) == APR_OS_START_SYSERR + ERROR_FILE_NOT_FOUND \
+ || (s) == APR_OS_START_SYSERR + ERROR_PATH_NOT_FOUND \
+ || (s) == APR_OS_START_SYSERR + ERROR_OPEN_FAILED \
+ || (s) == APR_OS_START_SYSERR + ERROR_NO_MORE_FILES)
+#define APR_STATUS_IS_ENOTDIR(s) ((s) == APR_ENOTDIR \
+ || (s) == APR_OS_START_SYSERR + ERROR_PATH_NOT_FOUND \
+ || (s) == APR_OS_START_SYSERR + ERROR_BAD_NETPATH \
+ || (s) == APR_OS_START_SYSERR + ERROR_BAD_NET_NAME \
+ || (s) == APR_OS_START_SYSERR + ERROR_BAD_PATHNAME \
+ || (s) == APR_OS_START_SYSERR + ERROR_INVALID_DRIVE)
+#define APR_STATUS_IS_ENOSPC(s) ((s) == APR_ENOSPC \
+ || (s) == APR_OS_START_SYSERR + ERROR_DISK_FULL)
+#define APR_STATUS_IS_ENOMEM(s) ((s) == APR_ENOMEM \
+ || (s) == APR_OS_START_SYSERR + ERROR_ARENA_TRASHED \
+ || (s) == APR_OS_START_SYSERR + ERROR_NOT_ENOUGH_MEMORY \
+ || (s) == APR_OS_START_SYSERR + ERROR_INVALID_BLOCK \
+ || (s) == APR_OS_START_SYSERR + ERROR_NOT_ENOUGH_QUOTA \
+ || (s) == APR_OS_START_SYSERR + ERROR_OUTOFMEMORY)
+#define APR_STATUS_IS_EMFILE(s) ((s) == APR_EMFILE \
+ || (s) == APR_OS_START_SYSERR + ERROR_TOO_MANY_OPEN_FILES)
+#define APR_STATUS_IS_ENFILE(s) ((s) == APR_ENFILE)
+#define APR_STATUS_IS_EBADF(s) ((s) == APR_EBADF \
+ || (s) == APR_OS_START_SYSERR + ERROR_INVALID_HANDLE \
+ || (s) == APR_OS_START_SYSERR + ERROR_INVALID_TARGET_HANDLE)
+#define APR_STATUS_IS_EINVAL(s) ((s) == APR_EINVAL \
+ || (s) == APR_OS_START_SYSERR + ERROR_INVALID_ACCESS \
+ || (s) == APR_OS_START_SYSERR + ERROR_INVALID_DATA \
+ || (s) == APR_OS_START_SYSERR + ERROR_INVALID_FUNCTION \
+ || (s) == APR_OS_START_SYSERR + ERROR_INVALID_HANDLE \
+ || (s) == APR_OS_START_SYSERR + ERROR_INVALID_PARAMETER \
+ || (s) == APR_OS_START_SYSERR + ERROR_NEGATIVE_SEEK)
+#define APR_STATUS_IS_ESPIPE(s) ((s) == APR_ESPIPE \
+ || (s) == APR_OS_START_SYSERR + ERROR_SEEK_ON_DEVICE \
+ || (s) == APR_OS_START_SYSERR + ERROR_NEGATIVE_SEEK)
+#define APR_STATUS_IS_EAGAIN(s) ((s) == APR_EAGAIN \
+ || (s) == APR_OS_START_SYSERR + ERROR_NO_DATA \
+ || (s) == APR_OS_START_SYSERR + ERROR_NO_PROC_SLOTS \
+ || (s) == APR_OS_START_SYSERR + ERROR_NESTING_NOT_ALLOWED \
+ || (s) == APR_OS_START_SYSERR + ERROR_MAX_THRDS_REACHED \
+ || (s) == APR_OS_START_SYSERR + ERROR_LOCK_VIOLATION \
+ || (s) == APR_OS_START_SYSERR + WSAEWOULDBLOCK)
+#define APR_STATUS_IS_EINTR(s) ((s) == APR_EINTR \
+ || (s) == APR_OS_START_SYSERR + WSAEINTR)
+#define APR_STATUS_IS_ENOTSOCK(s) ((s) == APR_ENOTSOCK \
+ || (s) == APR_OS_START_SYSERR + WSAENOTSOCK)
+#define APR_STATUS_IS_ECONNREFUSED(s) ((s) == APR_ECONNREFUSED \
+ || (s) == APR_OS_START_SYSERR + WSAECONNREFUSED)
+#define APR_STATUS_IS_EINPROGRESS(s) ((s) == APR_EINPROGRESS \
+ || (s) == APR_OS_START_SYSERR + WSAEINPROGRESS)
+#define APR_STATUS_IS_ECONNABORTED(s) ((s) == APR_ECONNABORTED \
+ || (s) == APR_OS_START_SYSERR + WSAECONNABORTED)
+#define APR_STATUS_IS_ECONNRESET(s) ((s) == APR_ECONNRESET \
+ || (s) == APR_OS_START_SYSERR + ERROR_NETNAME_DELETED \
+ || (s) == APR_OS_START_SYSERR + WSAECONNRESET)
+/* XXX deprecated */
+#define APR_STATUS_IS_ETIMEDOUT(s) ((s) == APR_ETIMEDOUT \
+ || (s) == APR_OS_START_SYSERR + WSAETIMEDOUT \
+ || (s) == APR_OS_START_SYSERR + WAIT_TIMEOUT)
+#undef APR_STATUS_IS_TIMEUP
+#define APR_STATUS_IS_TIMEUP(s) ((s) == APR_TIMEUP \
+ || (s) == APR_OS_START_SYSERR + WSAETIMEDOUT \
+ || (s) == APR_OS_START_SYSERR + WAIT_TIMEOUT)
+#define APR_STATUS_IS_EHOSTUNREACH(s) ((s) == APR_EHOSTUNREACH \
+ || (s) == APR_OS_START_SYSERR + WSAEHOSTUNREACH)
+#define APR_STATUS_IS_ENETUNREACH(s) ((s) == APR_ENETUNREACH \
+ || (s) == APR_OS_START_SYSERR + WSAENETUNREACH)
+#define APR_STATUS_IS_EFTYPE(s) ((s) == APR_EFTYPE \
+ || (s) == APR_OS_START_SYSERR + ERROR_EXE_MACHINE_TYPE_MISMATCH \
+ || (s) == APR_OS_START_SYSERR + ERROR_INVALID_DLL \
+ || (s) == APR_OS_START_SYSERR + ERROR_INVALID_MODULETYPE \
+ || (s) == APR_OS_START_SYSERR + ERROR_BAD_EXE_FORMAT \
+ || (s) == APR_OS_START_SYSERR + ERROR_INVALID_EXE_SIGNATURE \
+ || (s) == APR_OS_START_SYSERR + ERROR_FILE_CORRUPT \
+ || (s) == APR_OS_START_SYSERR + ERROR_BAD_FORMAT)
+#define APR_STATUS_IS_EPIPE(s) ((s) == APR_EPIPE \
+ || (s) == APR_OS_START_SYSERR + ERROR_BROKEN_PIPE)
+#define APR_STATUS_IS_EXDEV(s) ((s) == APR_EXDEV \
+ || (s) == APR_OS_START_SYSERR + ERROR_NOT_SAME_DEVICE)
+#define APR_STATUS_IS_ENOTEMPTY(s) ((s) == APR_ENOTEMPTY \
+ || (s) == APR_OS_START_SYSERR + ERROR_DIR_NOT_EMPTY)
+}
+//#elif defined(NETWARE) && defined(USE_WINSOCK) && !defined(DOXYGEN) { !defined(OS2) && !defined(WIN32) }
+{
+#define APR_FROM_OS_ERROR(e) (e == 0 ? APR_SUCCESS : e + APR_OS_START_SYSERR)
+#define APR_TO_OS_ERROR(e) (e == 0 ? APR_SUCCESS : e - APR_OS_START_SYSERR)
+
+#define apr_get_os_error() (errno)
+#define apr_set_os_error(e) (errno = (e))
+}
+{ A special case, only socket calls require this: }
+{#define apr_get_netos_error() (APR_FROM_OS_ERROR(WSAGetLastError()))
+#define apr_set_netos_error(e) (WSASetLastError(APR_TO_OS_ERROR(e)))
+
+}
+{ APR CANONICAL ERROR TESTS }
+{#define APR_STATUS_IS_EACCES(s) ((s) == APR_EACCES)
+#define APR_STATUS_IS_EEXIST(s) ((s) == APR_EEXIST)
+#define APR_STATUS_IS_ENAMETOOLONG(s) ((s) == APR_ENAMETOOLONG)
+#define APR_STATUS_IS_ENOENT(s) ((s) == APR_ENOENT)
+#define APR_STATUS_IS_ENOTDIR(s) ((s) == APR_ENOTDIR)
+#define APR_STATUS_IS_ENOSPC(s) ((s) == APR_ENOSPC)
+#define APR_STATUS_IS_ENOMEM(s) ((s) == APR_ENOMEM)
+#define APR_STATUS_IS_EMFILE(s) ((s) == APR_EMFILE)
+#define APR_STATUS_IS_ENFILE(s) ((s) == APR_ENFILE)
+#define APR_STATUS_IS_EBADF(s) ((s) == APR_EBADF)
+#define APR_STATUS_IS_EINVAL(s) ((s) == APR_EINVAL)
+#define APR_STATUS_IS_ESPIPE(s) ((s) == APR_ESPIPE)
+
+#define APR_STATUS_IS_EAGAIN(s) ((s) == APR_EAGAIN \
+ || (s) == EWOULDBLOCK \
+ || (s) == APR_OS_START_SYSERR + WSAEWOULDBLOCK)
+#define APR_STATUS_IS_EINTR(s) ((s) == APR_EINTR \
+ || (s) == APR_OS_START_SYSERR + WSAEINTR)
+#define APR_STATUS_IS_ENOTSOCK(s) ((s) == APR_ENOTSOCK \
+ || (s) == APR_OS_START_SYSERR + WSAENOTSOCK)
+#define APR_STATUS_IS_ECONNREFUSED(s) ((s) == APR_ECONNREFUSED \
+ || (s) == APR_OS_START_SYSERR + WSAECONNREFUSED)
+#define APR_STATUS_IS_EINPROGRESS(s) ((s) == APR_EINPROGRESS \
+ || (s) == APR_OS_START_SYSERR + WSAEINPROGRESS)
+#define APR_STATUS_IS_ECONNABORTED(s) ((s) == APR_ECONNABORTED \
+ || (s) == APR_OS_START_SYSERR + WSAECONNABORTED)
+#define APR_STATUS_IS_ECONNRESET(s) ((s) == APR_ECONNRESET \
+ || (s) == APR_OS_START_SYSERR + WSAECONNRESET)
+/* XXX deprecated */
+#define APR_STATUS_IS_ETIMEDOUT(s) ((s) == APR_ETIMEDOUT \
+ || (s) == APR_OS_START_SYSERR + WSAETIMEDOUT \
+ || (s) == APR_OS_START_SYSERR + WAIT_TIMEOUT)
+#undef APR_STATUS_IS_TIMEUP
+#define APR_STATUS_IS_TIMEUP(s) ((s) == APR_TIMEUP \
+ || (s) == APR_OS_START_SYSERR + WSAETIMEDOUT \
+ || (s) == APR_OS_START_SYSERR + WAIT_TIMEOUT)
+#define APR_STATUS_IS_EHOSTUNREACH(s) ((s) == APR_EHOSTUNREACH \
+ || (s) == APR_OS_START_SYSERR + WSAEHOSTUNREACH)
+#define APR_STATUS_IS_ENETUNREACH(s) ((s) == APR_ENETUNREACH \
+ || (s) == APR_OS_START_SYSERR + WSAENETUNREACH)
+#define APR_STATUS_IS_ENETDOWN(s) ((s) == APR_OS_START_SYSERR + WSAENETDOWN)
+#define APR_STATUS_IS_EFTYPE(s) ((s) == APR_EFTYPE)
+#define APR_STATUS_IS_EPIPE(s) ((s) == APR_EPIPE)
+#define APR_STATUS_IS_EXDEV(s) ((s) == APR_EXDEV)
+#define APR_STATUS_IS_ENOTEMPTY(s) ((s) == APR_ENOTEMPTY)
+}
+//#else { !defined(NETWARE) && !defined(OS2) && !defined(WIN32) }
+
+{
+ * os error codes are clib error codes
+ }
+{#define APR_FROM_OS_ERROR(e) (e)
+#define APR_TO_OS_ERROR(e) (e)
+
+#define apr_get_os_error() (errno)
+#define apr_set_os_error(e) (errno = (e))
+}
+{ A special case, only socket calls require this:
+ }
+//#define apr_get_netos_error() (errno)
+//#define apr_set_netos_error(e) (errno = (e))
+
+{
+ * @addtogroup APR_STATUS_IS
+ }
+
+{ permission denied }
+//#define APR_STATUS_IS_EACCES(s) ((s) == APR_EACCES)
+{ file exists }
+//#define APR_STATUS_IS_EEXIST(s) ((s) == APR_EEXIST)
+{ path name is too long }
+//#define APR_STATUS_IS_ENAMETOOLONG(s) ((s) == APR_ENAMETOOLONG)
+{
+ * no such file or directory
+ * @remark
+ * EMVSCATLG can be returned by the automounter on z/OS for
+ * paths which do not exist.
+ }
+{#ifdef EMVSCATLG
+#define APR_STATUS_IS_ENOENT(s) ((s) == APR_ENOENT \
+ || (s) == EMVSCATLG)
+#else
+#define APR_STATUS_IS_ENOENT(s) ((s) == APR_ENOENT)
+#endif}
+{ not a directory }
+//#define APR_STATUS_IS_ENOTDIR(s) ((s) == APR_ENOTDIR)
+{ no space left on device }
+//#define APR_STATUS_IS_ENOSPC(s) ((s) == APR_ENOSPC)
+{ not enough memory }
+//#define APR_STATUS_IS_ENOMEM(s) ((s) == APR_ENOMEM)
+{ too many open files }
+//#define APR_STATUS_IS_EMFILE(s) ((s) == APR_EMFILE)
+{ file table overflow }
+//#define APR_STATUS_IS_ENFILE(s) ((s) == APR_ENFILE)
+{ bad file # }
+//#define APR_STATUS_IS_EBADF(s) ((s) == APR_EBADF)
+{ invalid argument }
+//#define APR_STATUS_IS_EINVAL(s) ((s) == APR_EINVAL)
+{ illegal seek }
+//#define APR_STATUS_IS_ESPIPE(s) ((s) == APR_ESPIPE)
+
+{ operation would block }
+{#if !defined(EWOULDBLOCK) || !defined(EAGAIN)
+#define APR_STATUS_IS_EAGAIN(s) ((s) == APR_EAGAIN)
+#elif (EWOULDBLOCK == EAGAIN)
+#define APR_STATUS_IS_EAGAIN(s) ((s) == APR_EAGAIN)
+#else
+#define APR_STATUS_IS_EAGAIN(s) ((s) == APR_EAGAIN \
+ || (s) == EWOULDBLOCK)
+#endif
+}
+{ interrupted system call }
+//#define APR_STATUS_IS_EINTR(s) ((s) == APR_EINTR)
+{ socket operation on a non-socket }
+//#define APR_STATUS_IS_ENOTSOCK(s) ((s) == APR_ENOTSOCK)
+{ Connection Refused }
+//#define APR_STATUS_IS_ECONNREFUSED(s) ((s) == APR_ECONNREFUSED)
+{ operation now in progress }
+//#define APR_STATUS_IS_EINPROGRESS(s) ((s) == APR_EINPROGRESS)
+
+{
+ * Software caused connection abort
+ * @remark
+ * EPROTO on certain older kernels really means ECONNABORTED, so we need to
+ * ignore it for them. See discussion in new-httpd archives nh.9701 & nh.9603
+ *
+ * There is potentially a bug in Solaris 2.x x<6, and other boxes that
+ * implement tcp sockets in userland (i.e. on top of STREAMS). On these
+ * systems, EPROTO can actually result in a fatal loop. See PR#981 for
+ * example. It's hard to handle both uses of EPROTO.
+ }
+{#ifdef EPROTO
+#define APR_STATUS_IS_ECONNABORTED(s) ((s) == APR_ECONNABORTED \
+ || (s) == EPROTO)
+#else
+#define APR_STATUS_IS_ECONNABORTED(s) ((s) == APR_ECONNABORTED)
+#endif
+}
+{ Connection Reset by peer }
+//#define APR_STATUS_IS_ECONNRESET(s) ((s) == APR_ECONNRESET)
+{* Operation timed out
+ * @deprecated}
+//#define APR_STATUS_IS_ETIMEDOUT(s) ((s) == APR_ETIMEDOUT)
+{ no route to host }
+//#define APR_STATUS_IS_EHOSTUNREACH(s) ((s) == APR_EHOSTUNREACH)
+{ network is unreachable }
+//#define APR_STATUS_IS_ENETUNREACH(s) ((s) == APR_ENETUNREACH)
+{ inappropiate file type or format }
+//#define APR_STATUS_IS_EFTYPE(s) ((s) == APR_EFTYPE)
+{ broken pipe }
+//#define APR_STATUS_IS_EPIPE(s) ((s) == APR_EPIPE)
+{ cross device link }
+//#define APR_STATUS_IS_EXDEV(s) ((s) == APR_EXDEV)
+{ Directory Not Empty }
+//#define APR_STATUS_IS_ENOTEMPTY(s) ((s) == APR_ENOTEMPTY || \
+// (s) == APR_EEXIST)
+
+//#endif { !defined(NETWARE) && !defined(OS2) && !defined(WIN32) }
+
diff --git a/packages/httpd22/src/apr/apr_file_info.inc b/packages/httpd22/src/apr/apr_file_info.inc
new file mode 100644
index 0000000000..aa660e3b10
--- /dev/null
+++ b/packages/httpd22/src/apr/apr_file_info.inc
@@ -0,0 +1,433 @@
+{ Copyright 2000-2005 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed 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.
+ }
+
+{
+ * @file apr_file_info.h
+ * @brief APR File Information
+ }
+
+{#include "apr.h"
+#include "apr_user.h"
+#include "apr_pools.h"
+#include "apr_tables.h"
+#include "apr_time.h"
+#include "apr_errno.h"
+
+#if APR_HAVE_SYS_UIO_H
+#include <sys/uio.h>
+#endif}
+
+{
+ * @defgroup apr_file_info File Information
+ * @ingroup APR
+ }
+
+{ Many applications use the type member to determine the
+ * existance of a file or initialization of the file info,
+ * so the APR_NOFILE value must be distinct from APR_UNKFILE.
+ }
+
+{ apr_filetype_e values for the filetype member of the
+ * apr_file_info_t structure
+ * @warning: Not all of the filetypes below can be determined.
+ * For example, a given platform might not correctly report
+ * a socket descriptor as APR_SOCK if that type isn't
+ * well-identified on that platform. In such cases where
+ * a filetype exists but cannot be described by the recognized
+ * flags below, the filetype will be APR_UNKFILE. If the
+ * filetype member is not determined, the type will be APR_NOFILE.
+ }
+
+type
+ apr_filetype_e = (
+ APR_NOFILE = 0, {< no file type determined }
+ APR_REG, {< a regular file }
+ APR_DIR, {< a directory }
+ APR_CHR, {< a character device }
+ APR_BLK, {< a block device }
+ APR_PIPE, {< a FIFO / pipe }
+ APR_LNK, {< a symbolic link }
+ APR_SOCK, {< a [unix domain] socket }
+ APR_UNKFILE = 127 {< a file of some other unknown type }
+ );
+
+{
+ * @defgroup apr_file_permissions File Permissions flags
+ * @
+ }
+
+const
+ APR_FPROT_USETID = $8000; {< Set user id }
+ APR_FPROT_UREAD = $0400; {< Read by user }
+ APR_FPROT_UWRITE = $0200; {< Write by user }
+ APR_FPROT_UEXECUTE = $0100; {< Execute by user }
+
+ APR_FPROT_GSETID = $4000; {< Set group id }
+ APR_FPROT_GREAD = $0040; {< Read by group }
+ APR_FPROT_GWRITE = $0020; {< Write by group }
+ APR_FPROT_GEXECUTE = $0010; {< Execute by group }
+
+ APR_FPROT_WSTICKY = $2000; {< Sticky bit }
+ APR_FPROT_WREAD = $0004; {< Read by others }
+ APR_FPROT_WWRITE = $0002; {< Write by others }
+ APR_FPROT_WEXECUTE = $0001; {< Execute by others }
+
+ APR_FPROT_OS_DEFAULT = $0FFF; {< use OS's default permissions }
+
+{ additional permission flags for apr_file_copy and apr_file_append }
+ APR_FPROT_FILE_SOURCE_PERMS = $1000; {< Copy source file's permissions }
+
+{ backcompat }
+ APR_USETID = APR_FPROT_USETID; {< @deprecated @see APR_FPROT_USETID }
+ APR_UREAD = APR_FPROT_UREAD; {< @deprecated @see APR_FPROT_UREAD }
+ APR_UWRITE = APR_FPROT_UWRITE; {< @deprecated @see APR_FPROT_UWRITE }
+ APR_UEXECUTE = APR_FPROT_UEXECUTE; {< @deprecated @see APR_FPROT_UEXECUTE }
+ APR_GSETID = APR_FPROT_GSETID; {< @deprecated @see APR_FPROT_GSETID }
+ APR_GREAD = APR_FPROT_GREAD; {< @deprecated @see APR_FPROT_GREAD }
+ APR_GWRITE = APR_FPROT_GWRITE; {< @deprecated @see APR_FPROT_GWRITE }
+ APR_GEXECUTE = APR_FPROT_GEXECUTE; {< @deprecated @see APR_FPROT_GEXECUTE }
+ APR_WSTICKY = APR_FPROT_WSTICKY; {< @deprecated @see APR_FPROT_WSTICKY }
+ APR_WREAD = APR_FPROT_WREAD; {< @deprecated @see APR_FPROT_WREAD }
+ APR_WWRITE = APR_FPROT_WWRITE; {< @deprecated @see APR_FPROT_WWRITE }
+ APR_WEXECUTE = APR_FPROT_WEXECUTE; {< @deprecated @see APR_FPROT_WEXECUTE }
+ APR_OS_DEFAULT= APR_FPROT_OS_DEFAULT; {< @deprecated @see APR_FPROT_OS_DEFAULT }
+ APR_FILE_SOURCE_PERMS = APR_FPROT_FILE_SOURCE_PERMS; {< @deprecated @see APR_FPROT_FILE_SOURCE_PERMS }
+
+{
+ * Structure for referencing directories.
+ }
+type
+ apr_dir_t = record end;
+ Papr_dir_t = ^apr_dir_t;
+ PPapr_dir_t = ^Papr_dir_t;
+
+{
+ * Structure for determining file permissions.
+ }
+ apr_fileperms_t = apr_int32_t;
+
+{$if defined(WINDOWS) or defined(NETWARE)}
+{
+ * Structure for determining the inode of the file.
+ }
+ apr_ino_t = apr_uint64_t;
+{
+ * Structure for determining the device the file is on.
+ }
+ apr_dev_t = apr_uint32_t;
+{$else}
+{ The inode of the file. }
+ apr_ino_t = ino_t;
+{
+ * Structure for determining the device the file is on.
+ }
+ apr_dev_t = dev_t;
+{$endif}
+
+{
+ * @defgroup apr_file_stat Stat Functions
+ * @
+ }
+
+const
+ APR_FINFO_LINK = $00000001; {< Stat the link not the file itself if it is a link }
+ APR_FINFO_MTIME = $00000010; {< Modification Time }
+ APR_FINFO_CTIME = $00000020; {< Creation Time }
+ APR_FINFO_ATIME = $00000040; {< Access Time }
+ APR_FINFO_SIZE = $00000100; {< Size of the file }
+ APR_FINFO_CSIZE = $00000200; {< Storage size consumed by the file }
+ APR_FINFO_DEV = $00001000; {< Device }
+ APR_FINFO_INODE = $00002000; {< Inode }
+ APR_FINFO_NLINK = $00004000; {< Number of links }
+ APR_FINFO_TYPE = $00008000; {< Type }
+ APR_FINFO_USER = $00010000; {< User }
+ APR_FINFO_GROUP = $00020000; {< Group }
+ APR_FINFO_UPROT = $00100000; {< User protection bits }
+ APR_FINFO_GPROT = $00200000; {< Group protection bits }
+ APR_FINFO_WPROT = $00400000; {< World protection bits }
+ APR_FINFO_ICASE = $01000000; {< if dev is case insensitive }
+ APR_FINFO_NAME = $02000000; {< ->name in proper case }
+
+ APR_FINFO_MIN = $00008170; {< type, mtime, ctime, atime, size }
+ APR_FINFO_IDENT = $00003000; {< dev and inode }
+ APR_FINFO_OWNER = $00030000; {< user and group }
+ APR_FINFO_PROT = $00700000; {< all protections }
+ APR_FINFO_NORM = $0073b170; {< an atomic unix apr_stat() }
+ APR_FINFO_DIRENT = $02000000; {< an atomic unix apr_dir_read() }
+
+{
+ * The file information structure. This is analogous to the POSIX
+ * stat structure.
+ }
+type
+ apr_finfo_t = record
+ { Allocates memory and closes lingering handles in the specified pool }
+ pool: Papr_pool_t;
+ { The bitmask describing valid fields of this apr_finfo_t structure
+ * including all available 'wanted' fields and potentially more }
+ valid: apr_int32_t;
+ { The access permissions of the file. Mimics Unix access rights. }
+ protection: apr_fileperms_t;
+ { The type of file. One of APR_REG, APR_DIR, APR_CHR, APR_BLK, APR_PIPE,
+ * APR_LNK or APR_SOCK. If the type is undetermined, the value is APR_NOFILE.
+ * If the type cannot be determined, the value is APR_UNKFILE.
+ }
+ filetype: apr_filetype_e;
+ { The user id that owns the file }
+ user: apr_uid_t;
+ { The group id that owns the file }
+ group: apr_gid_t;
+ { The inode of the file. }
+ inode: apr_ino_t;
+ { The id of the device the file is on. }
+ device: apr_dev_t;
+ { The number of hard links to the file. }
+ nlink: apr_int32_t;
+ { The size of the file }
+ size: apr_off_t;
+ { The storage size consumed by the file }
+ csize: apr_off_t;
+ { The time the file was last accessed }
+ atime: apr_time_t;
+ { The time the file was last modified }
+ mtime: apr_time_t;
+ { The time the file was last changed }
+ ctime: apr_time_t;
+ { The pathname of the file (possibly unrooted) }
+ fname: PChar;
+ { The file's name (no path) in filesystem case }
+ name: PChar;
+ { The file's handle, if accessed (can be submitted to apr_duphandle) }
+ filehand: Papr_file_t;
+ end;
+
+ Papr_finfo_t = ^apr_finfo_t;
+
+{
+ * get the specified file's stats. The file is specified by filename,
+ * instead of using a pre-opened file.
+ * @param finfo Where to store the information about the file, which is
+ * never touched if the call fails.
+ * @param fname The name of the file to stat.
+ * @param wanted The desired apr_finfo_t fields, as a bit flag of APR_FINFO_
+ values
+ * @param pool the pool to use to allocate the new file.
+ *
+ * @note If @c APR_INCOMPLETE is returned all the fields in @a finfo may
+ * not be filled in, and you need to check the @c finfo->valid bitmask
+ * to verify that what you're looking for is there.
+ }
+function apr_stat(finfo: Papr_finfo_t; const fname: PChar;
+ wanted: apr_int32_t; pool: Papr_pool_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_stat' + LibSuff16;
+
+{
+ * @defgroup apr_dir Directory Manipulation Functions
+ }
+
+{
+ * Open the specified directory.
+ * @param new_dir The opened directory descriptor.
+ * @param dirname The full path to the directory (use / on all systems)
+ * @param pool The pool to use.
+ }
+function apr_dir_open(new_dir: PPapr_dir_t; const dirname: PChar;
+ pool: Papr_pool_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_dir_open' + LibSuff12;
+
+{
+ * close the specified directory.
+ * @param thedir the directory descriptor to close.
+ }
+function apr_dir_close(thedir: Papr_dir_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_dir_close' + LibSuff4;
+
+{
+ * Read the next entry from the specified directory.
+ * @param finfo the file info structure and filled in by apr_dir_read
+ * @param wanted The desired apr_finfo_t fields, as a bit flag of APR_FINFO_
+ values
+ * @param thedir the directory descriptor returned from apr_dir_open
+ * @remark No ordering is guaranteed for the entries read.
+ *
+ * @note If @c APR_INCOMPLETE is returned all the fields in @a finfo may
+ * not be filled in, and you need to check the @c finfo->valid bitmask
+ * to verify that what you're looking for is there.
+ }
+function apr_dir_read(finfo: Papr_finfo_t; wanted: apr_int32_t;
+ thedir: Papr_dir_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_dir_read' + LibSuff12;
+
+{
+ * Rewind the directory to the first entry.
+ * @param thedir the directory descriptor to rewind.
+ }
+function apr_dir_rewind(thedir: Papr_dir_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_dir_rewind' + LibSuff4;
+
+{
+ * @defgroup apr_filepath Filepath Manipulation Functions
+ }
+
+const
+ { Cause apr_filepath_merge to fail if addpath is above rootpath }
+ APR_FILEPATH_NOTABOVEROOT = $01;
+
+{ internal: Only meaningful with APR_FILEPATH_NOTABOVEROOT }
+ APR_FILEPATH_SECUREROOTTEST =$02;
+
+{ Cause apr_filepath_merge to fail if addpath is above rootpath,
+ * even given a rootpath /foo/bar and an addpath ../bar/bash
+ }
+ APR_FILEPATH_SECUREROOT = $03;
+
+{ Fail apr_filepath_merge if the merged path is relative }
+ APR_FILEPATH_NOTRELATIVE = $04;
+
+{ Fail apr_filepath_merge if the merged path is absolute }
+ APR_FILEPATH_NOTABSOLUTE = $08;
+
+{ Return the file system's native path format (e.g. path delimiters
+ * of ':' on MacOS9, '\' on Win32, etc.) }
+ APR_FILEPATH_NATIVE = $10;
+
+{ Resolve the true case of existing directories and file elements
+ * of addpath, (resolving any aliases on Win32) and append a proper
+ * trailing slash if a directory
+ }
+ APR_FILEPATH_TRUENAME = $20;
+
+{
+ * Extract the rootpath from the given filepath
+ * @param rootpath the root file path returned with APR_SUCCESS or APR_EINCOMPLETE
+ * @param filepath the pathname to parse for its root component
+ * @param flags the desired rules to apply, from
+ * <PRE>
+ * APR_FILEPATH_NATIVE Use native path seperators (e.g. '\' on Win32)
+ * APR_FILEPATH_TRUENAME Tests that the root exists, and makes it proper
+ * </PRE>
+ * @param p the pool to allocate the new path string from
+ * @remark on return, filepath points to the first non-root character in the
+ * given filepath. In the simplest example, given a filepath of "/foo",
+ * returns the rootpath of "/" and filepath points at "foo". This is far
+ * more complex on other platforms, which will canonicalize the root form
+ * to a consistant format, given the APR_FILEPATH_TRUENAME flag, and also
+ * test for the validity of that root (e.g., that a drive d:/ or network
+ * share //machine/foovol/).
+ * The function returns APR_ERELATIVE if filepath isn't rooted (an
+ * error), APR_EINCOMPLETE if the root path is ambigious (but potentially
+ * legitimate, e.g. "/" on Windows is incomplete because it doesn't specify
+ * the drive letter), or APR_EBADPATH if the root is simply invalid.
+ * APR_SUCCESS is returned if filepath is an absolute path.
+ }
+function apr_filepath_root(const rootpath, filepath: PPChar;
+ flags: apr_int32_t; p: Papr_pool_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_filepath_root' + LibSuff16;
+
+{
+ * Merge additional file path onto the previously processed rootpath
+ * @param newpath the merged paths returned
+ * @param rootpath the root file path (NULL uses the current working path)
+ * @param addpath the path to add to the root path
+ * @param flags the desired APR_FILEPATH_ rules to apply when merging
+ * @param p the pool to allocate the new path string from
+ * @remark if the flag APR_FILEPATH_TRUENAME is given, and the addpath
+ * contains wildcard characters ('*', '?') on platforms that don't support
+ * such characters within filenames, the paths will be merged, but the
+ * result code will be APR_EPATHWILD, and all further segments will not
+ * reflect the true filenames including the wildcard and following segments.
+ }
+function apr_filepath_merge(newpath: PPChar; const rootpath, addpath: PPChar;
+ flags: apr_int32_t; p: Papr_pool_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_filepath_merge' + LibSuff20;
+
+{
+ * Split a search path into separate components
+ * @param pathelts the returned components of the search path
+ * @param liststr the search path (e.g., <tt>getenv("PATH")</tt>)
+ * @param p the pool to allocate the array and path components from
+ * @remark empty path componenta do not become part of @a pathelts.
+ * @remark the path separator in @a liststr is system specific;
+ * e.g., ':' on Unix, ';' on Windows, etc.
+ }
+function apr_filepath_list_split(pathelts: PPapr_array_header_t;
+ const liststr: PChar; p: Papr_pool_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_filepath_list_split' + LibSuff12;
+
+{
+ * Merge a list of search path components into a single search path
+ * @param liststr the returned search path; may be NULL if @a pathelts is empty
+ * @param pathelts the components of the search path
+ * @param p the pool to allocate the search path from
+ * @remark emtpy strings in the source array are ignored.
+ * @remark the path separator in @a liststr is system specific;
+ * e.g., ':' on Unix, ';' on Windows, etc.
+ }
+function apr_filepath_list_merge(liststr: PPChar;
+ pathelts: Papr_array_header_t; p: Papr_pool_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_filepath_list_merge' + LibSuff12;
+
+{
+ * Return the default file path (for relative file names)
+ * @param path the default path string returned
+ * @param flags optional flag APR_FILEPATH_NATIVE to retrieve the
+ * default file path in os-native format.
+ * @param p the pool to allocate the default path string from
+ }
+function apr_filepath_get(path: PPChar; flags: apr_int32_t;
+ p: Papr_pool_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_filepath_get' + LibSuff12;
+
+{
+ * Set the default file path (for relative file names)
+ * @param path the default path returned
+ * @param p the pool to allocate any working storage
+ }
+function apr_filepath_set(const path: PChar; p: Papr_pool_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_filepath_set' + LibSuff8;
+
+const
+ { The FilePath character encoding is unknown }
+ APR_FILEPATH_ENCODING_UNKNOWN = 0;
+
+ { The FilePath character encoding is locale-dependent }
+ APR_FILEPATH_ENCODING_LOCALE = 1;
+
+ { The FilePath character encoding is UTF-8 }
+ APR_FILEPATH_ENCODING_UTF8 = 2;
+
+{
+ * Determine the encoding used internally by the FilePath functions
+ * @param style points to a variable which receives the encoding style flag
+ * @param p the pool to allocate any working storage
+ * @remark Use @c apr_os_locale_encoding and/or @c apr_os_default_encoding
+ * to get the name of the path encoding if it's not UTF-8.
+ }
+function apr_filepath_encoding(style: PInteger; p: Papr_pool_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_filepath_encoding' + LibSuff8;
+
diff --git a/packages/httpd22/src/apr/apr_file_io.inc b/packages/httpd22/src/apr/apr_file_io.inc
new file mode 100644
index 0000000000..ccf5b7dfc8
--- /dev/null
+++ b/packages/httpd22/src/apr/apr_file_io.inc
@@ -0,0 +1,842 @@
+{ Copyright 2000-2005 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed 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.
+ }
+
+{
+ * @file apr_file_io.h
+ * @brief APR File I/O Handling
+ }
+
+{#include "apr.h"
+#include "apr_pools.h"
+#include "apr_time.h"
+#include "apr_errno.h"}
+{.$include apr_file_info.inc}
+{#include "apr_inherit.h"}
+
+//#define APR_WANT_STDIO {< for SEEK_* }
+//#define APR_WANT_IOVEC {< for apr_file_writev }
+//#include "apr_want.h"
+
+{
+ * @defgroup apr_file_io File I/O Handling Functions
+ * @ingroup APR
+ }
+
+{
+ * @defgroup apr_file_open_flags File Open Flags/Routines
+ }
+
+{ Note to implementors: Values in the range 0x00100000--0x80000000
+ are reserved for platform-specific values. }
+
+const
+ APR_FOPEN_READ = $00001; {< Open the file for reading }
+ APR_FOPEN_WRITE = $00002; {< Open the file for writing }
+ APR_FOPEN_CREATE = $00004; {< Create the file if not there }
+ APR_FOPEN_APPEND = $00008; {< Append to the end of the file }
+ APR_FOPEN_TRUNCATE = $00010; {< Open the file and truncate
+ to 0 length }
+ APR_FOPEN_BINARY = $00020; {< Open the file in binary mode }
+ APR_FOPEN_EXCL = $00040; {< Open should fail if APR_CREATE
+ and file exists. }
+ APR_FOPEN_BUFFERED = $00080; {< Open the file for buffered I/O }
+ APR_FOPEN_DELONCLOSE= $00100; {< Delete the file after close }
+ APR_FOPEN_XTHREAD = $00200; {< Platform dependent tag to open
+ the file for use across multiple
+ threads }
+ APR_FOPEN_SHARELOCK = $00400; {< Platform dependent support for
+ higher level locked read/write
+ access to support writes across
+ process/machines }
+ APR_FOPEN_NOCLEANUP = $00800; {< Do not register a cleanup
+ when the file is opened }
+ APR_FOPEN_SENDFILE_ENABLED = $01000; {< Advisory flag that this
+ file should support
+ apr_socket_sendfile operation }
+ APR_FOPEN_LARGEFILE = $04000; {< Platform dependent flag to enable
+ large file support; WARNING see
+ below. }
+{ backcompat }
+ APR_READ = APR_FOPEN_READ; {< @deprecated @see APR_FOPEN_READ }
+ APR_WRITE = APR_FOPEN_WRITE; {< @deprecated @see APR_FOPEN_WRITE }
+ APR_CREATE = APR_FOPEN_CREATE; {< @deprecated @see APR_FOPEN_CREATE }
+ APR_APPEND = APR_FOPEN_APPEND; {< @deprecated @see APR_FOPEN_APPEND }
+ APR_TRUNCATE = APR_FOPEN_TRUNCATE; {< @deprecated @see APR_FOPEN_TRUNCATE }
+ APR_BINARY = APR_FOPEN_BINARY; {< @deprecated @see APR_FOPEN_BINARY }
+ APR_EXCL = APR_FOPEN_EXCL; {< @deprecated @see APR_FOPEN_EXCL }
+ APR_BUFFERED = APR_FOPEN_BUFFERED; {< @deprecated @see APR_FOPEN_BUFFERED }
+ APR_DELONCLOSE = APR_FOPEN_DELONCLOSE; {< @deprecated @see APR_FOPEN_DELONCLOSE }
+ APR_XTHREAD = APR_FOPEN_XTHREAD; {< @deprecated @see APR_FOPEN_XTHREAD }
+ APR_SHARELOCK = APR_FOPEN_SHARELOCK; {< @deprecated @see APR_FOPEN_SHARELOCK }
+ APR_FILE_NOCLEANUP = APR_FOPEN_NOCLEANUP; {< @deprecated @see APR_FOPEN_NOCLEANUP }
+ APR_SENDFILE_ENABLED= APR_FOPEN_SENDFILE_ENABLED; {< @deprecated @see APR_FOPEN_SENDFILE_ENABLED }
+ APR_LARGEFILE = APR_FOPEN_LARGEFILE; {< @deprecated @see APR_FOPEN_LARGEFILE }
+
+{ @warning The APR_LARGEFILE flag only has effect on some platforms
+ * where sizeof(apr_off_t) == 4. Where implemented, it allows opening
+ * and writing to a file which exceeds the size which can be
+ * represented by apr_off_t (2 gigabytes). When a file's size does
+ * exceed 2Gb, apr_file_info_get() will fail with an error on the
+ * descriptor, likewise apr_stat()/apr_lstat() will fail on the
+ * filename. apr_dir_read() will fail with APR_INCOMPLETE on a
+ * directory entry for a large file depending on the particular
+ * APR_FINFO_* flags. Generally, it is not recommended to use this
+ * flag. }
+
+{
+ * @defgroup apr_file_seek_flags File Seek Flags
+ }
+
+{
+ * @defgroup apr_file_attrs_set_flags File Attribute Flags
+ }
+
+{ flags for apr_file_attrs_set }
+ APR_FILE_ATTR_READONLY = $01; {< File is read-only }
+ APR_FILE_ATTR_EXECUTABLE =$02; {< File is executable }
+ APR_FILE_ATTR_HIDDEN = $04; {< File is hidden }
+
+{
+ * @defgroup apr_file_writev(_full) max iovec size
+ }
+{$ifdef DOXYGEN}
+ APR_MAX_IOVEC_SIZE = 1024; {< System dependent maximum
+ size of an iovec array }
+{#elif defined(IOV_MAX)
+#define APR_MAX_IOVEC_SIZE IOV_MAX
+#elif defined(MAX_IOVEC)
+#define APR_MAX_IOVEC_SIZE MAX_IOVEC}
+{$else}
+ APR_MAX_IOVEC_SIZE = 1024;
+{$endif}
+
+{ File attributes }
+type
+ apr_fileattrs_t = apr_uint32_t;
+
+{ Type to pass as whence argument to apr_file_seek. }
+ apr_seek_where_t = Integer;
+
+{
+ * Structure for referencing files.
+ }
+ apr_file_t = record end;
+// Papr_file_t = ^apr_file_t;
+ PPapr_file_t = ^Papr_file_t;
+
+{ File lock types/flags }
+{
+ * @defgroup apr_file_lock_types File Lock Types
+ }
+
+const
+ APR_FLOCK_SHARED = 1; {< Shared lock. More than one process
+ or thread can hold a shared lock
+ at any given time. Essentially,
+ this is a "read lock", preventing
+ writers from establishing an
+ exclusive lock. }
+ APR_FLOCK_EXCLUSIVE = 2; {< Exclusive lock. Only one process
+ may hold an exclusive lock at any
+ given time. This is analogous to
+ a "write lock". }
+
+ APR_FLOCK_TYPEMASK = $000F; {< mask to extract lock type }
+ APR_FLOCK_NONBLOCK = $0010; {< do not block while acquiring the
+ file lock }
+{
+ * Open the specified file.
+ * @param newf The opened file descriptor.
+ * @param fname The full path to the file (using / on all systems)
+ * @param flag Or'ed value of:
+ * <PRE>
+ * APR_READ open for reading
+ * APR_WRITE open for writing
+ * APR_CREATE create the file if not there
+ * APR_APPEND file ptr is set to end prior to all writes
+ * APR_TRUNCATE set length to zero if file exists
+ * APR_BINARY not a text file (This flag is ignored on
+ * UNIX because it has no meaning)
+ * APR_BUFFERED buffer the data. Default is non-buffered
+ * APR_EXCL return error if APR_CREATE and file exists
+ * APR_DELONCLOSE delete the file after closing.
+ * APR_XTHREAD Platform dependent tag to open the file
+ * for use across multiple threads
+ * APR_SHARELOCK Platform dependent support for higher
+ * level locked read/write access to support
+ * writes across process/machines
+ * APR_FILE_NOCLEANUP Do not register a cleanup with the pool
+ * passed in on the <EM>pool</EM> argument (see below).
+ * The apr_os_file_t handle in apr_file_t will not
+ * be closed when the pool is destroyed.
+ * APR_SENDFILE_ENABLED Open with appropriate platform semantics
+ * for sendfile operations. Advisory only,
+ * apr_socket_sendfile does not check this flag.
+ * </PRE>
+ * @param perm Access permissions for file.
+ * @param pool The pool to use.
+ * @remark If perm is APR_OS_DEFAULT and the file is being created, appropriate
+ * default permissions will be used. *arg1 must point to a valid file_t,
+ * or NULL (in which case it will be allocated)
+ }
+function apr_file_open(newf: PPapr_file_t; const fname: PChar;
+ flag: apr_int32_t; perm: apr_fileperms_t;
+ pool: Papr_pool_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_file_open' + LibSuff20;
+
+{
+ * Close the specified file.
+ * @param file The file descriptor to close.
+ }
+function apr_file_close(file_: Papr_file_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_file_close' + LibSuff4;
+
+{
+ * delete the specified file.
+ * @param path The full path to the file (using / on all systems)
+ * @param pool The pool to use.
+ * @remark If the file is open, it won't be removed until all instances are closed.
+ }
+function apr_file_remove(const path: PChar; pool: Papr_pool_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_file_remove' + LibSuff8;
+
+{
+ * rename the specified file.
+ * @param from_path The full path to the original file (using / on all systems)
+ * @param to_path The full path to the new file (using / on all systems)
+ * @param pool The pool to use.
+ * @warning If a file exists at the new location, then it will be overwritten.
+ * Moving files or directories across devices may not be possible.
+ }
+function apr_file_rename(const from_path, to_path: PChar; pool: Papr_pool_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_file_rename' + LibSuff12;
+
+{
+ * copy the specified file to another file.
+ * @param from_path The full path to the original file (using / on all systems)
+ * @param to_path The full path to the new file (using / on all systems)
+ * @param perms Access permissions for the new file if it is created.
+ * In place of the usual or'd combination of file permissions, the
+ * value APR_FILE_SOURCE_PERMS may be given, in which case the source
+ * file's permissions are copied.
+ * @param pool The pool to use.
+ * @remark The new file does not need to exist, it will be created if required.
+ * @warning If the new file already exists, its contents will be overwritten.
+ }
+function apr_file_copy(const from_path, to_path: PChar;
+ perms: apr_fileperms_t; pool: Papr_pool_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_file_copy' + LibSuff16;
+
+{
+ * append the specified file to another file.
+ * @param from_path The full path to the source file (using / on all systems)
+ * @param to_path The full path to the destination file (using / on all systems)
+ * @param perms Access permissions for the destination file if it is created.
+ * In place of the usual or'd combination of file permissions, the
+ * value APR_FILE_SOURCE_PERMS may be given, in which case the source
+ * file's permissions are copied.
+ * @param pool The pool to use.
+ * @remark The new file does not need to exist, it will be created if required.
+ }
+function apr_file_append(const from_path, to_path: PChar;
+ perms: apr_fileperms_t; pool: Papr_pool_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_file_append' + LibSuff16;
+
+{
+ * Are we at the end of the file
+ * @param fptr The apr file we are testing.
+ * @remark Returns APR_EOF if we are at the end of file, APR_SUCCESS otherwise.
+ }
+function apr_file_eof(fptr: Papr_file_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_file_eof' + LibSuff4;
+
+{
+ * open standard error as an apr file pointer.
+ * @param thefile The apr file to use as stderr.
+ * @param pool The pool to allocate the file out of.
+ *
+ * @remark The only reason that the apr_file_open_std* functions exist
+ * is that you may not always have a stderr/out/in on Windows. This
+ * is generally a problem with newer versions of Windows and services.
+ *
+ * The other problem is that the C library functions generally work
+ * differently on Windows and Unix. So, by using apr_file_open_std*
+ * functions, you can get a handle to an APR struct that works with
+ * the APR functions which are supposed to work identically on all
+ * platforms.
+ }
+function apr_file_open_stderr(thefile: PPapr_file_t;
+ pool: Papr_pool_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_file_open_stderr' + LibSuff8;
+
+{
+ * open standard output as an apr file pointer.
+ * @param thefile The apr file to use as stdout.
+ * @param pool The pool to allocate the file out of.
+ *
+ * @remark See remarks for apr_file_open_stdout.
+ }
+function apr_file_open_stdout(thefile: PPapr_file_t;
+ pool: Papr_pool_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_file_open_stdout' + LibSuff8;
+
+{
+ * open standard input as an apr file pointer.
+ * @param thefile The apr file to use as stdin.
+ * @param pool The pool to allocate the file out of.
+ *
+ * @remark See remarks for apr_file_open_stdout.
+ }
+function apr_file_open_stdin(thefile: PPapr_file_t;
+ pool: Papr_pool_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_file_open_stdin' + LibSuff8;
+
+{
+ * Read data from the specified file.
+ * @param thefile The file descriptor to read from.
+ * @param buf The buffer to store the data to.
+ * @param nbytes On entry, the number of bytes to read; on exit, the number
+ * of bytes read.
+ *
+ * @remark apr_file_read will read up to the specified number of
+ * bytes, but never more. If there isn't enough data to fill that
+ * number of bytes, all of the available data is read. The third
+ * argument is modified to reflect the number of bytes read. If a
+ * char was put back into the stream via ungetc, it will be the first
+ * character returned.
+ *
+ * @remark It is not possible for both bytes to be read and an APR_EOF
+ * or other error to be returned. APR_EINTR is never returned.
+ }
+function apr_file_read(thefile: Papr_file_t; buf: Pointer;
+ nbytes: Papr_size_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_file_read' + LibSuff12;
+
+{
+ * Write data to the specified file.
+ * @param thefile The file descriptor to write to.
+ * @param buf The buffer which contains the data.
+ * @param nbytes On entry, the number of bytes to write; on exit, the number
+ * of bytes written.
+ *
+ * @remark apr_file_write will write up to the specified number of
+ * bytes, but never more. If the OS cannot write that many bytes, it
+ * will write as many as it can. The third argument is modified to
+ * reflect the * number of bytes written.
+ *
+ * @remark It is possible for both bytes to be written and an error to
+ * be returned. APR_EINTR is never returned.
+ }
+function apr_file_write(thefile: Papr_file_t; buf: Pointer;
+ nbytes: Papr_size_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_file_write' + LibSuff12;
+
+{
+ * Write data from iovec array to the specified file.
+ * @param thefile The file descriptor to write to.
+ * @param vec The array from which to get the data to write to the file.
+ * @param nvec The number of elements in the struct iovec array. This must
+ * be smaller than APR_MAX_IOVEC_SIZE. If it isn't, the function
+ * will fail with APR_EINVAL.
+ * @param nbytes The number of bytes written.
+ *
+ * @remark It is possible for both bytes to be written and an error to
+ * be returned. APR_EINTR is never returned.
+ *
+ * @remark apr_file_writev is available even if the underlying
+ * operating system doesn't provide writev().
+ }
+function apr_file_writev(thefile: Papr_file_t; const vec: Piovec;
+ nvec: apr_size_t; nbytes: Papr_size_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_file_writev' + LibSuff16;
+
+{
+ * Read data from the specified file, ensuring that the buffer is filled
+ * before returning.
+ * @param thefile The file descriptor to read from.
+ * @param buf The buffer to store the data to.
+ * @param nbytes The number of bytes to read.
+ * @param bytes_read If non-NULL, this will contain the number of bytes read.
+ *
+ * @remark apr_file_read will read up to the specified number of
+ * bytes, but never more. If there isn't enough data to fill that
+ * number of bytes, then the process/thread will block until it is
+ * available or EOF is reached. If a char was put back into the
+ * stream via ungetc, it will be the first character returned.
+ *
+ * @remark It is possible for both bytes to be read and an error to be
+ * returned. And if *bytes_read is less than nbytes, an accompanying
+ * error is _always_ returned.
+ *
+ * @remark APR_EINTR is never returned.
+ }
+function apr_file_read_full(thefile: Papr_file_t; buf: Pointer;
+ nbytes: apr_size_t; bytes_read: Papr_size_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_file_read_full' + LibSuff16;
+
+{
+ * Write data to the specified file, ensuring that all of the data is
+ * written before returning.
+ * @param thefile The file descriptor to write to.
+ * @param buf The buffer which contains the data.
+ * @param nbytes The number of bytes to write.
+ * @param bytes_written If non-NULL, set to the number of bytes written.
+ *
+ * @remark apr_file_write will write up to the specified number of
+ * bytes, but never more. If the OS cannot write that many bytes, the
+ * process/thread will block until they can be written. Exceptional
+ * error such as "out of space" or "pipe closed" will terminate with
+ * an error.
+ *
+ * @remark It is possible for both bytes to be written and an error to
+ * be returned. And if *bytes_written is less than nbytes, an
+ * accompanying error is _always_ returned.
+ *
+ * @remark APR_EINTR is never returned.
+ }
+function apr_file_write_full(thefile: Papr_file_t; buf: Pointer;
+ nbytes: apr_size_t; bytes_written: Papr_size_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_file_write_full' + LibSuff16;
+
+{
+ * Write data from iovec array to the specified file, ensuring that all of the
+ * data is written before returning.
+ * @param thefile The file descriptor to write to.
+ * @param vec The array from which to get the data to write to the file.
+ * @param nvec The number of elements in the struct iovec array. This must
+ * be smaller than APR_MAX_IOVEC_SIZE. If it isn't, the function
+ * will fail with APR_EINVAL.
+ * @param nbytes The number of bytes written.
+ *
+ * @remark apr_file_writev_full is available even if the underlying
+ * operating system doesn't provide writev().
+ }
+function apr_file_writev_full(thefile: Papr_file_t; const vec: Piovec;
+ nvec: apr_size_t; nbytes: Papr_size_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_file_writev_full' + LibSuff16;
+
+{
+ * Write a character into the specified file.
+ * @param ch The character to write.
+ * @param thefile The file descriptor to write to
+ }
+function apr_file_putc(ch: Char; thefile: Papr_file_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_file_putc' + LibSuff8;
+
+{
+ * get a character from the specified file.
+ * @param ch The character to read into
+ * @param thefile The file descriptor to read from
+ }
+function apr_file_getc(ch: PChar; thefile: Papr_file_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_file_getc' + LibSuff8;
+
+{
+ * put a character back onto a specified stream.
+ * @param ch The character to write.
+ * @param thefile The file descriptor to write to
+ }
+function apr_file_ungetc(ch: Char; thefile: PPapr_file_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_file_ungetc' + LibSuff8;
+
+{
+ * Get a string from a specified file.
+ * @param str The buffer to store the string in.
+ * @param len The length of the string
+ * @param thefile The file descriptor to read from
+ * @remark The buffer will be '\0'-terminated if any characters are stored.
+ }
+function apr_file_gets(str: PChar; len: Integer;
+ thefile: Papr_file_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_file_gets' + LibSuff12;
+
+{
+ * Put the string into a specified file.
+ * @param str The string to write.
+ * @param thefile The file descriptor to write to
+ }
+function apr_file_puts(const str: PChar; thefile: Papr_file_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_file_puts' + LibSuff8;
+
+{
+ * Flush the file's buffer.
+ * @param thefile The file descriptor to flush
+ }
+function apr_file_flush(thefile: PPapr_file_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_file_flush' + LibSuff4;
+
+{
+ * duplicate the specified file descriptor.
+ * @param new_file The structure to duplicate into.
+ * @param old_file The file to duplicate.
+ * @param p The pool to use for the new file.
+ * @remark *new_file must point to a valid apr_file_t, or point to NULL
+ }
+function apr_file_dup(new_file: PPapr_file_t; old_file: PPapr_file_t;
+ p: Papr_pool_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_file_dup' + LibSuff12;
+
+{
+ * duplicate the specified file descriptor and close the original
+ * @param new_file The old file that is to be closed and reused
+ * @param old_file The file to duplicate
+ * @param p The pool to use for the new file
+ *
+ * @remark new_file MUST point at a valid apr_file_t. It cannot be NULL
+ }
+function apr_file_dup2(new_file: PPapr_file_t; old_file: PPapr_file_t;
+ p: Papr_pool_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_file_dup2' + LibSuff12;
+
+{
+ * move the specified file descriptor to a new pool
+ * @param new_file Pointer in which to return the new apr_file_t
+ * @param old_file The file to move
+ * @param p The pool to which the descriptor is to be moved
+ * @remark Unlike apr_file_dup2(), this function doesn't do an
+ * OS dup() operation on the underlying descriptor; it just
+ * moves the descriptor's apr_file_t wrapper to a new pool.
+ * @remark The new pool need not be an ancestor of old_file's pool.
+ * @remark After calling this function, old_file may not be used
+ }
+function apr_file_setaside(new_file: PPapr_file_t; old_file: PPapr_file_t;
+ p: Papr_pool_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_file_setaside' + LibSuff12;
+
+{
+ * Move the read/write file offset to a specified byte within a file.
+ * @param thefile The file descriptor
+ * @param where How to move the pointer, one of:
+ * <PRE>
+ * APR_SET -- set the offset to offset
+ * APR_CUR -- add the offset to the current position
+ * APR_END -- add the offset to the current file size
+ * </PRE>
+ * @param offset The offset to move the pointer to.
+ * @remark The third argument is modified to be the offset the pointer
+ was actually moved to.
+ }
+function apr_file_seek(thefile: Papr_file_t;
+ where: apr_seek_where_t; offset: Papr_off_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_file_seek' + LibSuff12;
+
+{
+ * Create an anonymous pipe.
+ * @param in The file descriptor to use as input to the pipe.
+ * @param out The file descriptor to use as output from the pipe.
+ * @param pool The pool to operate on.
+ }
+function apr_file_pipe_create(in_: PPapr_file_t; out_: PPapr_file_t;
+ pool: Papr_pool_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_file_pipe_create' + LibSuff12;
+
+{
+ * Create a named pipe.
+ * @param filename The filename of the named pipe
+ * @param perm The permissions for the newly created pipe.
+ * @param pool The pool to operate on.
+ }
+function apr_file_namedpipe_create(const filename: PChar;
+ perm: apr_fileperms_t; pool: Papr_pool_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_file_namedpipe_create' + LibSuff12;
+
+{
+ * Get the timeout value for a pipe or manipulate the blocking state.
+ * @param thepipe The pipe we are getting a timeout for.
+ * @param timeout The current timeout value in microseconds.
+ }
+function apr_file_pipe_timeout_get(thepipe: Papr_file_t;
+ timeout: Papr_interval_time_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_file_pipe_timeout_get' + LibSuff8;
+
+{
+ * Set the timeout value for a pipe or manipulate the blocking state.
+ * @param thepipe The pipe we are setting a timeout on.
+ * @param timeout The timeout value in microseconds. Values < 0 mean wait
+ * forever, 0 means do not wait at all.
+ }
+function apr_file_pipe_timeout_set(thepipe: Papr_file_t;
+ timeout: apr_interval_time_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_file_pipe_timeout_set' + LibSuff12;
+
+{ file (un)locking functions. }
+
+{
+ * Establish a lock on the specified, open file. The lock may be advisory
+ * or mandatory, at the discretion of the platform. The lock applies to
+ * the file as a whole, rather than a specific range. Locks are established
+ * on a per-thread/process basis; a second lock by the same thread will not
+ * block.
+ * @param thefile The file to lock.
+ * @param type The type of lock to establish on the file.
+ }
+function apr_file_lock(thefile: Papr_file_t; type_: Integer): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_file_lock' + LibSuff8;
+
+{
+ * Remove any outstanding locks on the file.
+ * @param thefile The file to unlock.
+ }
+function apr_file_unlock(thefile: Papr_file_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_file_unlock' + LibSuff4;
+
+{accessor and general file_io functions. }
+
+{
+ * return the file name of the current file.
+ * @param new_path The path of the file.
+ * @param thefile The currently open file.
+ }
+function apr_file_name_get(const newpath: PPChar; thefile: Papr_file_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_file_name_get' + LibSuff8;
+
+{
+ * Return the data associated with the current file.
+ * @param data The user data associated with the file.
+ * @param key The key to use for retreiving data associated with this file.
+ * @param file The currently open file.
+ }
+function apr_file_data_get(data: PPointer; const key: PChar;
+ file_: Papr_file_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_file_data_get' + LibSuff12;
+
+{
+ * Set the data associated with the current file.
+ * @param file The currently open file.
+ * @param data The user data to associate with the file.
+ * @param key The key to use for assocaiteing data with the file.
+ * @param cleanup The cleanup routine to use when the file is destroyed.
+ }
+//function apr_file_data_set(ch: Char; thefile: PPapr_file_t): apr_status_t;
+// {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+// external LibAPR name LibNamePrefix + 'apr_file_data_set' + LibSuff4;
+//APR_DECLARE(apr_status_t) (apr_file_t *file, void *data,
+// const char *key,
+// apr_status_t (*cleanup)(void *));
+
+{
+ * Write a string to a file using a printf format.
+ * @param fptr The file to write to.
+ * @param format The format string
+ * @param ... The values to substitute in the format string
+ * @return The number of bytes written
+ }
+function apr_file_printf(fptr: Papr_file_t; const format: PChar;
+ othres: array of const): Integer;
+ cdecl; external LibAPR name 'apr_file_printf';
+
+{
+ * set the specified file's permission bits.
+ * @param fname The file (name) to apply the permissions to.
+ * @param perms The permission bits to apply to the file.
+ * @warning Some platforms may not be able to apply all of the available
+ * permission bits; APR_INCOMPLETE will be returned if some permissions
+ * are specified which could not be set.
+ *
+ * Platforms which do not implement this feature will return APR_ENOTIMPL.
+ }
+function apr_file_perms_set(const fname: PChar;
+ perms: apr_fileperms_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_file_perms_set' + LibSuff8;
+
+{
+ * Set attributes of the specified file.
+ * @param fname The full path to the file (using / on all systems)
+ * @param attributes Or'd combination of
+ * <PRE>
+ * APR_FILE_ATTR_READONLY - make the file readonly
+ * APR_FILE_ATTR_EXECUTABLE - make the file executable
+ * APR_FILE_ATTR_HIDDEN - make the file hidden
+ * </PRE>
+ * @param attr_mask Mask of valid bits in attributes.
+ * @param pool the pool to use.
+ * @remark This function should be used in preference to explict manipulation
+ * of the file permissions, because the operations to provide these
+ * attributes are platform specific and may involve more than simply
+ * setting permission bits.
+ * @warning Platforms which do not implement this feature will return
+ * APR_ENOTIMPL.
+ }
+function apr_file_attrs_set(const fname: PChar;
+ attributes, attr_mask: apr_fileattrs_t;
+ pool: Papr_pool_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_file_attrs_set' + LibSuff16;
+
+{
+ * Set the mtime of the specified file.
+ * @param fname The full path to the file (using / on all systems)
+ * @param mtime The mtime to apply to the file.
+ * @param pool The pool to use.
+ * @warning Platforms which do not implement this feature will return
+ * APR_ENOTIMPL.
+ }
+function apr_file_mtime_set(const fname: PChar;
+ mtime: apr_time_t; pool: Papr_pool_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_file_mtime_set' + LibSuff16;
+
+{
+ * Create a new directory on the file system.
+ * @param path the path for the directory to be created. (use / on all systems)
+ * @param perm Permissions for the new direcoty.
+ * @param pool the pool to use.
+ }
+function apr_dir_make(const path: PChar; perm: apr_fileperms_t;
+ pool: Papr_pool_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_dir_make' + LibSuff12;
+
+{ Creates a new directory on the file system, but behaves like
+ * 'mkdir -p'. Creates intermediate directories as required. No error
+ * will be reported if PATH already exists.
+ * @param path the path for the directory to be created. (use / on all systems)
+ * @param perm Permissions for the new direcoty.
+ * @param pool the pool to use.
+ }
+function apr_dir_make_recursive(const path: PChar;
+ perm: apr_fileperms_t; pool: Papr_pool_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_dir_make_recursive' + LibSuff12;
+
+{
+ * Remove directory from the file system.
+ * @param path the path for the directory to be removed. (use / on all systems)
+ * @param pool the pool to use.
+ }
+function apr_dir_remove(const path: PChar; pool: Papr_pool_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_dir_remove' + LibSuff8;
+
+{
+ * get the specified file's stats.
+ * @param finfo Where to store the information about the file.
+ * @param wanted The desired apr_finfo_t fields, as a bit flag of APR_FINFO_ values
+ * @param thefile The file to get information about.
+ }
+function apr_file_info_get(finfo: Papr_finfo_t;
+ wanted: apr_int32_t; thefile: Papr_file_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_file_info_get' + LibSuff12;
+
+{
+ * Truncate the file's length to the specified offset
+ * @param fp The file to truncate
+ * @param offset The offset to truncate to.
+ }
+function apr_file_trunc(fp: Papr_file_t; offset: apr_off_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_file_trunc' + LibSuff12;
+
+{
+ * Retrieve the flags that were passed into apr_file_open()
+ * when the file was opened.
+ * @return apr_int32_t the flags
+ }
+function apr_file_flags_get(f: Papr_file_t): apr_int32_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_file_flags_get' + LibSuff4;
+
+{
+ * Get the pool used by the file.
+ }
+{APR_POOL_DECLARE_ACCESSOR(file);
+}
+{
+ * Set a file to be inherited by child processes.
+ *
+ }
+{APR_DECLARE_INHERIT_SET(file);
+}
+
+{
+ * Unset a file from being inherited by child processes.
+ }
+{APR_DECLARE_INHERIT_UNSET(file);
+}
+
+{
+ * Open a temporary file
+ * @param fp The apr file to use as a temporary file.
+ * @param templ The template to use when creating a temp file.
+ * @param flags The flags to open the file with. If this is zero,
+ * the file is opened with
+ * APR_CREATE | APR_READ | APR_WRITE | APR_EXCL | APR_DELONCLOSE
+ * @param p The pool to allocate the file out of.
+ * @remark
+ * This function generates a unique temporary file name from template.
+ * The last six characters of template must be XXXXXX and these are replaced
+ * with a string that makes the filename unique. Since it will be modified,
+ * template must not be a string constant, but should be declared as a character
+ * array.
+ *
+ }
+function apr_file_mktemp(fp: PPapr_file_t; templ: PChar;
+ flags: apr_int32_t; p: Papr_pool_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_file_mktemp' + LibSuff16;
+
+{
+ * Find an existing directory suitable as a temporary storage location.
+ * @param temp_dir The temp directory.
+ * @param p The pool to use for any necessary allocations.
+ * @remark
+ * This function uses an algorithm to search for a directory that an
+ * an application can use for temporary storage. Once such a
+ * directory is found, that location is cached by the library. Thus,
+ * callers only pay the cost of this algorithm once if that one time
+ * is successful.
+ *
+ }
+function apr_temp_dir_get(const temp_dir: PPChar; p: Papr_pool_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_temp_dir_get' + LibSuff8;
+
diff --git a/packages/httpd22/src/apr/apr_general.inc b/packages/httpd22/src/apr/apr_general.inc
new file mode 100644
index 0000000000..8e98912297
--- /dev/null
+++ b/packages/httpd22/src/apr/apr_general.inc
@@ -0,0 +1,219 @@
+{ Copyright 2000-2005 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed 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.
+ }
+
+{
+ * @file apr_general.h
+ * This is collection of oddballs that didn't fit anywhere else,
+ * and might move to more appropriate headers with the release
+ * of APR 1.0.
+ * @brief APR Miscellaneous library routines
+ }
+
+{#include "apr.h"
+#include "apr_pools.h"
+#include "apr_errno.h"
+
+#if APR_HAVE_SIGNAL_H
+#include <signal.h>
+#endif}
+
+{
+ * @defgroup apr_general Miscellaneous library routines
+ * @ingroup APR
+ * This is collection of oddballs that didn't fit anywhere else,
+ * and might move to more appropriate headers with the release
+ * of APR 1.0.
+ }
+
+const
+{ a space }
+ APR_ASCII_BLANK = #040;
+{ a carrige return }
+ APR_ASCII_CR = #015;
+{ a line feed }
+ APR_ASCII_LF = #012;
+{ a tab }
+ APR_ASCII_TAB = #011;
+
+{ signal numbers typedef }
+type
+ apr_signum_t = Integer;
+
+{
+ * Finding offsets of elements within structures.
+ * Taken from the X code... they've sweated portability of this stuff
+ * so we don't have to. Sigh...
+ * @param p_type pointer type name
+ * @param field data field within the structure pointed to
+ * @return offset
+ }
+
+{#if defined(CRAY) || (defined(__arm) && !defined(LINUX))
+#ifdef __STDC__
+#define APR_OFFSET(p_type,field) _Offsetof(p_type,field)
+#else
+#ifdef CRAY2
+#define APR_OFFSET(p_type,field) \
+ (sizeof(int)*((unsigned int)&(((p_type)NULL)->field)))
+
+#else} { !CRAY2 }
+
+{#define APR_OFFSET(p_type,field) ((unsigned int)&(((p_type)NULL)->field))
+
+#endif} { !CRAY2 }
+//#endif { __STDC__ }
+//#else { ! (CRAY || __arm) }
+
+//#define APR_OFFSET(p_type,field) \
+// ((long) (((char *) (&(((p_type)NULL)->field))) - ((char *) NULL)))
+
+//#endif { !CRAY }
+
+{
+ * Finding offsets of elements within structures.
+ * @param s_type structure type name
+ * @param field data field within the structure
+ * @return offset
+ }
+{#if defined(offsetof) && !defined(__cplusplus)
+#define APR_OFFSETOF(s_type,field) offsetof(s_type,field)
+#else
+#define APR_OFFSETOF(s_type,field) APR_OFFSET(s_type*,field)
+#endif}
+
+{$ifndef DOXYGEN}
+
+{ A couple of prototypes for functions in case some platform doesn't
+ * have it
+ }
+{#if (!APR_HAVE_STRCASECMP) && (APR_HAVE_STRICMP)
+#define strcasecmp(s1, s2) stricmp(s1, s2)
+#elif (!APR_HAVE_STRCASECMP)
+int strcasecmp(const char *a, const char *b);
+#endif
+
+#if (!APR_HAVE_STRNCASECMP) && (APR_HAVE_STRNICMP)
+#define strncasecmp(s1, s2, n) strnicmp(s1, s2, n)
+#elif (!APR_HAVE_STRNCASECMP)
+int strncasecmp(const char *a, const char *b, size_t n);
+#endif}
+
+{$endif}
+
+{
+ * Alignment macros
+ }
+
+{ APR_ALIGN() is only to be used to align on a power of 2 boundary }
+{#define APR_ALIGN(size, boundary) \
+ (((size) + ((boundary) - 1)) & ~((boundary) - 1))}
+
+{ Default alignment }
+//#define APR_ALIGN_DEFAULT(size) APR_ALIGN(size, 8)
+
+
+{
+ * String and memory functions
+ }
+
+{ APR_STRINGIFY is defined here, and also in apr_release.h, so wrap it }
+{$ifndef APR_STRINGIFY}
+{ Properly quote a value as a string in the C preprocessor }
+//#define APR_STRINGIFY(n) APR_STRINGIFY_HELPER(n)
+{ Helper macro for APR_STRINGIFY }
+{#define APR_STRINGIFY_HELPER(n) #n}
+{$endif}
+
+{#if (!APR_HAVE_MEMMOVE)
+#define memmove(a,b,c) bcopy(b,a,c)
+#endif
+
+#if (!APR_HAVE_MEMCHR)
+void *memchr(const void *s, int c, size_t n);
+#endif}
+
+{
+ * @defgroup apr_library Library initialization and termination
+ }
+
+{
+ * Setup any APR internal data structures. This MUST be the first function
+ * called for any APR library.
+ * @remark See apr_app_initialize if this is an application, rather than
+ * a library consumer of apr.
+ }
+function apr_initialize: apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_initialize' + LibSuff0;
+
+{
+ * Set up an application with normalized argc, argv (and optionally env) in
+ * order to deal with platform-specific oddities, such as Win32 services,
+ * code pages and signals. This must be the first function called for any
+ * APR program.
+ * @param argc Pointer to the argc that may be corrected
+ * @param argv Pointer to the argv that may be corrected
+ * @param env Pointer to the env that may be corrected, may be NULL
+ * @remark See apr_initialize if this is a library consumer of apr.
+ * Otherwise, this call is identical to apr_initialize, and must be closed
+ * with a call to apr_terminate at the end of program execution.
+ }
+function apr_app_initialize(argc: PInteger; argv, env: PPChar): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_app_initialize' + LibSuff12;
+
+{
+ * Tear down any APR internal data structures which aren't torn down
+ * automatically.
+ * @remark An APR program must call this function at termination once it
+ * has stopped using APR services. The APR developers suggest using
+ * atexit to ensure this is called. When using APR from a language
+ * other than C that has problems with the calling convention, use
+ * apr_terminate2() instead.
+ }
+procedure apr_terminate;
+ cdecl; external LibAPR name 'apr_terminate';
+
+{
+ * Tear down any APR internal data structures which aren't torn down
+ * automatically, same as apr_terminate
+ * @remark An APR program must call either the apr_terminate or apr_terminate2
+ * function once it it has finished using APR services. The APR
+ * developers suggest using atexit(apr_terminate) to ensure this is done.
+ * apr_terminate2 exists to allow non-c language apps to tear down apr,
+ * while apr_terminate is recommended from c language applications.
+ }
+procedure apr_terminate2;
+ cdecl; external LibAPR name LibNamePrefix + 'apr_terminate2' + LibSuff0;
+
+{
+ * @defgroup apr_random Random Functions
+ }
+
+{$if defined(APR_HAS_RANDOM) or defined(DOXYGEN)}
+
+{ TODO: I'm not sure this is the best place to put this prototype...}
+{
+ * Generate random bytes.
+ * @param buf Buffer to fill with random bytes
+ * @param length Length of buffer in bytes (becomes apr_size_t in APR 1.0)
+ }
+function apr_generate_random_bytes(buf: PChar; length: Integer): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_generate_random_bytes' + LibSuff8;
+
+{$endif}
+
diff --git a/packages/httpd22/src/apr/apr_hash.inc b/packages/httpd22/src/apr/apr_hash.inc
new file mode 100644
index 0000000000..82feb7cb53
--- /dev/null
+++ b/packages/httpd22/src/apr/apr_hash.inc
@@ -0,0 +1,232 @@
+{ Copyright 2000-2005 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed 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.
+ }
+
+{
+ * @file apr_hash.h
+ * @brief APR Hash Tables
+ }
+
+//#include "apr_pools.h"
+
+{
+ * @defgroup apr_hash Hash Tables
+ * @ingroup APR
+ * @
+ }
+
+{
+ * When passing a key to apr_hash_set or apr_hash_get, this value can be
+ * passed to indicate a string-valued key, and have apr_hash compute the
+ * length automatically.
+ *
+ * @remark apr_hash will use strlen(key) for the length. The null-terminator
+ * is not included in the hash value (why throw a constant in?).
+ * Since the hash table merely references the provided key (rather
+ * than copying it), apr_hash_this() will return the null-term'd key.
+ }
+const
+ APR_HASH_KEY_STRING = -1;
+
+{
+ * Abstract type for hash tables.
+ }
+type
+ apr_hash_t = record end;
+ Papr_hash_t = ^apr_hash_t;
+
+{
+ * Abstract type for scanning hash tables.
+ }
+ apr_hash_index_t = record end;
+ Papr_hash_index_t = ^apr_hash_index_t;
+
+{
+ * Callback functions for calculating hash values.
+ * @param key The key.
+ * @param klen The length of the key, or APR_HASH_KEY_STRING to use the string
+ * length. If APR_HASH_KEY_STRING then returns the actual key length.
+ }
+ apr_hashfunc_t = function (const key: PChar; klen: Papr_size_t): cuint;
+
+{
+ * The default hash function.
+ }
+function apr_hashfunc_default(const key: PChar; klen: Papr_size_t): cuint;
+ cdecl; external LibAPR name 'apr_hashfunc_default';
+
+{
+ * Create a hash table.
+ * @param pool The pool to allocate the hash table out of
+ * @return The hash table just created
+ }
+function apr_hash_make(pool: Papr_pool_t): Papr_hash_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_hash_make' + LibSuff4;
+
+{
+ * Create a hash table with a custom hash function
+ * @param pool The pool to allocate the hash table out of
+ * @param hash_func A custom hash function.
+ * @return The hash table just created
+ }
+function apr_hash_make_custom(pool: Papr_pool_t; hash_func: apr_hashfunc_t): Papr_hash_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_hash_make_custom' + LibSuff8;
+
+{
+ * Make a copy of a hash table
+ * @param pool The pool from which to allocate the new hash table
+ * @param h The hash table to clone
+ * @return The hash table just created
+ * @remark Makes a shallow copy
+ }
+function apr_hash_copy(pool: Papr_pool_t; const h: Papr_hash_t): Papr_hash_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_hash_copy' + LibSuff8;
+
+{
+ * Associate a value with a key in a hash table.
+ * @param ht The hash table
+ * @param key Pointer to the key
+ * @param klen Length of the key. Can be APR_HASH_KEY_STRING to use the string length.
+ * @param val Value to associate with the key
+ * @remark If the value is NULL the hash entry is deleted.
+ }
+procedure apr_hash_set(ht: Papr_hash_t; const key: Pointer;
+ klen: apr_size_t; const val: Pointer);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_hash_set' + LibSuff16;
+
+{
+ * Look up the value associated with a key in a hash table.
+ * @param ht The hash table
+ * @param key Pointer to the key
+ * @param klen Length of the key. Can be APR_HASH_KEY_STRING to use the string length.
+ * @return Returns NULL if the key is not present.
+ }
+function apr_hash_get(ht: Papr_hash_t; const key: Pointer;
+ klen: apr_size_t): Pointer;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_hash_get' + LibSuff12;
+
+{
+ * Start iterating over the entries in a hash table.
+ * @param p The pool to allocate the apr_hash_index_t iterator. If this
+ * pool is NULL, then an internal, non-thread-safe iterator is used.
+ * @param ht The hash table
+ * @remark There is no restriction on adding or deleting hash entries during
+ * an iteration (although the results may be unpredictable unless all you do
+ * is delete the current entry) and multiple iterations can be in
+ * progress at the same time.
+
+ * @example
+ }
+{
+ * <PRE>
+ *
+ * int sum_values(apr_pool_t *p, apr_hash_t *ht)
+ * (
+ * apr_hash_index_t *hi;
+ * void *val;
+ * int sum = 0;
+ * for (hi = apr_hash_first(p, ht); hi; hi = apr_hash_next(hi)) (
+ * apr_hash_this(hi, NULL, NULL, &val);
+ * sum += *(int * )val;
+ * )
+ * return sum;
+ * )
+ * </PRE>
+ }
+function apr_hash_first(p: Papr_pool_t; ht: Papr_hash_t): Papr_hash_index_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_hash_first' + LibSuff8;
+
+{
+ * Continue iterating over the entries in a hash table.
+ * @param hi The iteration state
+ * @return a pointer to the updated iteration state. NULL if there are no more
+ * entries.
+ }
+function apr_hash_next(hi: Papr_hash_index_t): Papr_hash_index_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_hash_next' + LibSuff4;
+
+{
+ * Get the current entry's details from the iteration state.
+ * @param hi The iteration state
+ * @param key Return pointer for the pointer to the key.
+ * @param klen Return pointer for the key length.
+ * @param val Return pointer for the associated value.
+ * @remark The return pointers should point to a variable that will be set to the
+ * corresponding data, or they may be NULL if the data isn't interesting.
+ }
+procedure apr_hash_this(hi: Papr_hash_index_t; const key: PPointer;
+ klen: Papr_size_t; val: PPointer);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_hash_this' + LibSuff16;
+
+{
+ * Get the number of key/value pairs in the hash table.
+ * @param ht The hash table
+ * @return The number of key/value pairs in the hash table.
+ }
+function apr_hash_count(ht: Papr_hash_t): cuint;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_hash_count' + LibSuff4;
+
+{
+ * Merge two hash tables into one new hash table. The values of the overlay
+ * hash override the values of the base if both have the same key. Both
+ * hash tables must use the same hash function.
+ * @param p The pool to use for the new hash table
+ * @param overlay The table to add to the initial table
+ * @param base The table that represents the initial values of the new table
+ * @return A new hash table containing all of the data from the two passed in
+ }
+function apr_hash_overlay(p: Papr_pool_t;
+ const overlay, base: Papr_hash_t): Papr_hash_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_hash_overlay' + LibSuff12;
+
+{
+ * Merge two hash tables into one new hash table. If the same key
+ * is present in both tables, call the supplied merge function to
+ * produce a merged value for the key in the new table. Both
+ * hash tables must use the same hash function.
+ * @param p The pool to use for the new hash table
+ * @param h1 The first of the tables to merge
+ * @param h2 The second of the tables to merge
+ * @param merger A callback function to merge values, or NULL to
+ * make values from h1 override values from h2 (same semantics as
+ * apr_hash_overlay())
+ * @param data Client data to pass to the merger function
+ * @return A new hash table containing all of the data from the two passed in
+ }
+type
+ apr_hash_merge_t = function (p: Papr_pool_t; const key: Pointer; klen: apr_size_t;
+ const h1_val, h2_val, data: Pointer): Pointer; cdecl;
+
+function apr_hash_merge(p: Papr_pool_t;
+ const h1, h2: Papr_hash_t;
+ merger: apr_hash_merge_t; const data: Pointer): Papr_hash_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_hash_merge' + LibSuff20;
+
+{
+ * Get a pointer to the pool which the hash table was created in
+ }
+//APR_POOL_DECLARE_ACCESSOR(hash);
+
diff --git a/packages/httpd22/src/apr/apr_lib.inc b/packages/httpd22/src/apr/apr_lib.inc
new file mode 100644
index 0000000000..3996e6232e
--- /dev/null
+++ b/packages/httpd22/src/apr/apr_lib.inc
@@ -0,0 +1,223 @@
+{ Copyright 2000-2005 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed 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.
+ }
+
+{
+ * @file apr_lib.h
+ * This is collection of oddballs that didn't fit anywhere else,
+ * and might move to more appropriate headers with the release
+ * of APR 1.0.
+ * @brief APR general purpose library routines
+ }
+
+{#include "apr.h"
+#include "apr_errno.h"
+
+#if APR_HAVE_CTYPE_H
+#include <ctype.h>
+#endif
+#if APR_HAVE_STDARG_H
+#include <stdarg.h>
+#endif}
+
+{
+ * @defgroup apr_lib General Purpose Library Routines
+ * @ingroup APR
+ * This is collection of oddballs that didn't fit anywhere else,
+ * and might move to more appropriate headers with the release
+ * of APR 1.0.
+ }
+
+{ A constant representing a 'large' string. }
+const HUGE_STRING_LEN = 8192;
+
+{
+ * Define the structures used by the APR general-purpose library.
+ }
+
+{ @see apr_vformatter_buff_t }
+type
+ Papr_vformatter_buff_t = ^apr_vformatter_buff_t;
+
+{
+ * Structure used by the variable-formatter routines.
+ }
+ apr_vformatter_buff_t = record
+ { The current position }
+ curpos: PChar;
+ { The end position of the format string }
+ endpos: PChar;
+ end;
+
+{
+ * return the final element of the pathname
+ * @param pathname The path to get the final element of
+ * @return the final element of the path
+ * @remark
+ * <PRE>
+ * For example:
+ * "/foo/bar/gum" -> "gum"
+ * "/foo/bar/gum/" -> ""
+ * "gum" -> "gum"
+ * "bs\\path\\stuff" -> "stuff"
+ * </PRE>
+ }
+function apr_filepath_name_get(const pathname: PChar): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_filepath_name_get' + LibSuff4;
+
+{
+ * apr_killpg
+ * Small utility macros to make things easier to read. Not usually a
+ * goal, to be sure..
+ }
+
+//#ifdef WIN32
+//#define apr_killpg(x, y)
+//#else { WIN32 }
+//#ifdef NO_KILLPG
+//#define apr_killpg(x, y) (kill (-(x), (y)))
+//#else { NO_KILLPG }
+//#define apr_killpg(x, y) (killpg ((x), (y)))
+//#endif { NO_KILLPG }
+//#endif { WIN32 }
+
+{
+ * apr_vformatter() is a generic printf-style formatting routine
+ * with some extensions.
+ * @param flush_func The function to call when the buffer is full
+ * @param c The buffer to write to
+ * @param fmt The format string
+ * @param ap The arguments to use to fill out the format string.
+ *
+ * @remark
+ * <PRE>
+ * The extensions are:
+ *
+ * %%pA takes a struct in_addr *, and prints it as a.b.c.d
+ * %%pI takes an apr_sockaddr_t * and prints it as a.b.c.d:port or
+ * [ipv6-address]:port
+ * %%pT takes an apr_os_thread_t * and prints it in decimal
+ * ('0' is printed if !APR_HAS_THREADS)
+ * %%pt takes an apr_os_thread_t * and prints it in hexadecimal
+ * ('0' is printed if !APR_HAS_THREADS)
+ * %%pp takes a void * and outputs it in hex
+ *
+ * The %%p hacks are to force gcc's printf warning code to skip
+ * over a pointer argument without complaining. This does
+ * mean that the ANSI-style %%p (output a void * in hex format) won't
+ * work as expected at all, but that seems to be a fair trade-off
+ * for the increased robustness of having printf-warnings work.
+ *
+ * Additionally, apr_vformatter allows for arbitrary output methods
+ * using the apr_vformatter_buff and flush_func.
+ *
+ * The apr_vformatter_buff has two elements curpos and endpos.
+ * curpos is where apr_vformatter will write the next byte of output.
+ * It proceeds writing output to curpos, and updating curpos, until
+ * either the end of output is reached, or curpos == endpos (i.e. the
+ * buffer is full).
+ *
+ * If the end of output is reached, apr_vformatter returns the
+ * number of bytes written.
+ *
+ * When the buffer is full, the flush_func is called. The flush_func
+ * can return -1 to indicate that no further output should be attempted,
+ * and apr_vformatter will return immediately with -1. Otherwise
+ * the flush_func should flush the buffer in whatever manner is
+ * appropriate, re apr_pool_t nitialize curpos and endpos, and return 0.
+ *
+ * Note that flush_func is only invoked as a result of attempting to
+ * write another byte at curpos when curpos >= endpos. So for
+ * example, it's possible when the output exactly matches the buffer
+ * space available that curpos == endpos will be true when
+ * apr_vformatter returns.
+ *
+ * apr_vformatter does not call out to any other code, it is entirely
+ * self-contained. This allows the callers to do things which are
+ * otherwise "unsafe". For example, apr_psprintf uses the "scratch"
+ * space at the unallocated end of a block, and doesn't actually
+ * complete the allocation until apr_vformatter returns. apr_psprintf
+ * would be completely broken if apr_vformatter were to call anything
+ * that used this same pool. Similarly http_bprintf() uses the "scratch"
+ * space at the end of its output buffer, and doesn't actually note
+ * that the space is in use until it either has to flush the buffer
+ * or until apr_vformatter returns.
+ * </PRE>
+ }
+type
+ flush_func_t = function (b: Papr_vformatter_buff_t): Integer;
+
+function apr_vformatter(flush_func: flush_func_t;
+ c: Papr_vformatter_buff_t; const fmt: PChar; ap: va_list): Integer;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_vformatter' + LibSuff16;
+
+{
+ * Display a prompt and read in the password from stdin.
+ * @param prompt The prompt to display
+ * @param pwbuf Buffer to store the password
+ * @param bufsize The length of the password buffer.
+ * @remark If the password entered must be truncated to fit in
+ * the provided buffer, APR_ENAMETOOLONG will be returned.
+ * Note that the bufsize paramater is passed by reference for no
+ * reason; its value will never be modified by the apr_password_get()
+ * function.
+ }
+function apr_password_get(const prompt: PChar;
+ pwbuf: PChar; bufsize: Papr_size_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_password_get' + LibSuff12;
+
+{
+ * @defgroup apr_ctype ctype functions
+ * These macros allow correct support of 8-bit characters on systems which
+ * support 8-bit characters. Pretty dumb how the cast is required, but
+ * that's legacy libc for ya. These new macros do not support EOF like
+ * the standard macros do. Tough.
+ }
+{ @see isalnum }
+//#define apr_isalnum(c) (isalnum(((unsigned char)(c))))
+{ @see isalpha }
+//#define apr_isalpha(c) (isalpha(((unsigned char)(c))))
+{ @see iscntrl }
+//#define apr_iscntrl(c) (iscntrl(((unsigned char)(c))))
+{ @see isdigit }
+//#define apr_isdigit(c) (isdigit(((unsigned char)(c))))
+{ @see isgraph }
+//#define apr_isgraph(c) (isgraph(((unsigned char)(c))))
+{ @see islower}
+//#define apr_islower(c) (islower(((unsigned char)(c))))
+{ @see isascii }
+{#ifdef isascii
+#define apr_isascii(c) (isascii(((unsigned char)(c))))
+#else
+#define apr_isascii(c) (((c) & ~0x7f)==0)
+#endif}
+{ @see isprint }
+//#define apr_isprint(c) (isprint(((unsigned char)(c))))
+{ @see ispunct }
+//#define apr_ispunct(c) (ispunct(((unsigned char)(c))))
+{ @see isspace }
+//#define apr_isspace(c) (isspace(((unsigned char)(c))))
+{ @see isupper }
+//#define apr_isupper(c) (isupper(((unsigned char)(c))))
+{ @see isxdigit }
+//#define apr_isxdigit(c) (isxdigit(((unsigned char)(c))))
+{ @see tolower }
+function apr_tolower(c: Char): Char;
+{ @see toupper }
+function apr_toupper(c: Char): Char;
+
diff --git a/packages/httpd22/src/apr/apr_network_io.inc b/packages/httpd22/src/apr/apr_network_io.inc
new file mode 100644
index 0000000000..09f574aa9a
--- /dev/null
+++ b/packages/httpd22/src/apr/apr_network_io.inc
@@ -0,0 +1,851 @@
+{ Copyright 2000-2005 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed 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.
+ }
+
+{
+ * @file apr_network_io.h
+ * @brief APR Network library
+ }
+
+{#include "apr.h"
+#include "apr_pools.h"
+#include "apr_file_io.h"
+#include "apr_errno.h"
+#include "apr_inherit.h"
+
+#if APR_HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif}
+
+{
+ * @defgroup apr_network_io Network Routines
+ * @ingroup APR
+ }
+
+const
+{ Maximum seconds to linger }
+ APR_MAX_SECS_TO_LINGER = 30;
+
+{ Maximum hostname length }
+ APRMAXHOSTLEN = 256;
+
+{ Default 'any' address }
+ APR_ANYADDR = '0.0.0.0';
+
+{
+ * @defgroup apr_sockopt Socket option definitions
+ }
+ APR_SO_LINGER = 1; {< Linger }
+ APR_SO_KEEPALIVE = 2; {< Keepalive }
+ APR_SO_DEBUG = 4; {< Debug }
+ APR_SO_NONBLOCK = 8; {< Non-blocking IO }
+ APR_SO_REUSEADDR = 16; {< Reuse addresses }
+ APR_SO_SNDBUF = 64; {< Send buffer }
+ APR_SO_RCVBUF = 128; {< Receive buffer }
+ APR_SO_DISCONNECTED = 256; {< Disconnected }
+ APR_TCP_NODELAY = 512; {< For SCTP sockets, this is mapped
+ * to STCP_NODELAY internally.
+ }
+ APR_TCP_NOPUSH = 1024; {< No push }
+ APR_RESET_NODELAY = 2048; {< This flag is ONLY set internally
+ * when we set APR_TCP_NOPUSH with
+ * APR_TCP_NODELAY set to tell us that
+ * APR_TCP_NODELAY should be turned on
+ * again when NOPUSH is turned off
+ }
+ APR_INCOMPLETE_READ = 4096; {< Set on non-blocking sockets
+ * (timeout != 0) on which the
+ * previous read() did not fill a buffer
+ * completely. the next apr_socket_recv()
+ * will first call select()/poll() rather than
+ * going straight into read(). (Can also
+ * be set by an application to force a
+ * select()/poll() call before the next
+ * read, in cases where the app expects
+ * that an immediate read would fail.)
+ }
+ APR_INCOMPLETE_WRITE = 8192;{< like APR_INCOMPLETE_READ, but for write
+ * @see APR_INCOMPLETE_READ
+ }
+ APR_IPV6_V6ONLY = 16384; {< Don't accept IPv4 connections on an
+ * IPv6 listening socket.
+ }
+ APR_TCP_DEFER_ACCEPT = 32768;{< Delay accepting of new connections
+ * until data is available.
+ * @see apr_socket_accept_filter
+ }
+
+{ Define what type of socket shutdown should occur. }
+type
+ apr_shutdown_how_e = (
+ APR_SHUTDOWN_READ, {< no longer allow read request }
+ APR_SHUTDOWN_WRITE, {< no longer allow write requests }
+ APR_SHUTDOWN_READWRITE {< no longer allow read or write requests }
+ );
+
+const
+ APR_IPV4_ADDR_OK = $01; {< @see apr_sockaddr_info_get() }
+ APR_IPV6_ADDR_OK = $02; {< @see apr_sockaddr_info_get() }
+
+{$ifndef APR_HAVE_IN_ADDR}
+{
+ * We need to make sure we always have an in_addr type, so APR will just
+ * define it ourselves, if the platform doesn't provide it.
+ }
+{type
+ in_addr = record
+ s_addr: apr_uint32_t; < storage to hold the IP#
+ end;}
+{$endif}
+
+{ @def APR_INADDR_NONE
+ * Not all platforms have a real INADDR_NONE. This macro replaces
+ * INADDR_NONE on all platforms.
+ }
+{$ifdef INADDR_NONE}
+ APR_INADDR_NONE = INADDR_NONE;
+{$else}
+ APR_INADDR_NONE = $ffffffff;
+{$endif}
+
+const
+{
+ * @def APR_INET
+ * Not all platforms have these defined, so we'll define them here
+ * The default values come from FreeBSD 4.1.1
+ }
+//#define APR_INET AF_INET
+{ @def APR_UNSPEC
+ * Let the system decide which address family to use
+ }
+{#ifdef AF_UNSPEC
+#define APR_UNSPEC AF_UNSPEC
+#else
+#define APR_UNSPEC 0
+#endif
+#if APR_HAVE_IPV6
+
+/** @def APR_INET6
+* IPv6 Address Family. Not all platforms may have this defined.
+*/
+
+#define APR_INET6 AF_INET6
+#endif}
+
+{
+ * @defgroup IP_Proto IP Protocol Definitions for use when creating sockets
+ }
+ APR_PROTO_TCP = 6; {< TCP }
+ APR_PROTO_UDP = 17; {< UDP }
+ APR_PROTO_SCTP = 132; {< SCTP }
+
+{
+ * Enum to tell us if we're interested in remote or local socket
+ }
+type
+ apr_interface_e = (
+ APR_LOCAL,
+ APR_REMOTE
+ );
+
+{
+ * The specific declaration of inet_addr's ... some platforms fall back
+ * inet_network (this is not good, but necessary)
+ }
+
+{$ifdef APR_HAVE_INET_ADDR}
+ apr_inet_addr = inet_addr;
+{$else}
+{$ifdef APR_HAVE_INET_NETWORK} { only DGUX, as far as I know }
+{
+ * @warning
+ * not generally safe... inet_network() and inet_addr() perform
+ * different functions }
+ apr_inet_addr = inet_network;
+{$endif}
+{$endif}
+
+{ A structure to represent sockets }
+ apr_socket_t = record
+ end;
+ Papr_socket_t = ^apr_socket_t;
+ PPapr_socket_t = ^Papr_socket_t;
+
+{
+ * A structure to encapsulate headers and trailers for apr_socket_sendfile
+ }
+ Papr_hdtr_t = ^apr_hdtr_t;
+ { A structure to represent in_addr }
+ apr_in_addr_t = record
+ end;
+{ A structure to represent an IP subnet }
+ apr_ipsubnet_t = record
+ end;
+ Papr_ipsubnet_t = ^apr_ipsubnet_t;
+ PPapr_ipsubnet_t = ^Papr_ipsubnet_t;
+
+{ @remark use apr_uint16_t just in case some system has a short that isn't 16 bits... }
+ apr_port_t = apr_uint16_t;
+ Papr_port_t = ^apr_port_t;
+
+{ @remark It's defined here as I think it should all be platform safe...
+ * @see apr_sockaddr_t
+ }
+ Papr_sockaddr_t = ^apr_sockaddr_t;
+ PPapr_sockaddr_t = ^Papr_sockaddr_t;
+
+ sa_t = record
+ case Integer of
+ { IPv4 sockaddr structure }
+ 0: (sin: sockaddr_in);
+{$ifdef APR_HAVE_IPV6}
+ { IPv6 sockaddr structure }
+ 1: (sin6: sockaddr_in6);
+{$endif}
+{$ifdef APR_HAVE_SA_STORAGE}
+ { Placeholder to ensure that the size of this union is not
+ * dependent on whether APR_HAVE_IPV6 is defined. }
+ 2: (sas: sockaddr_storage);
+{$endif}
+ end;
+
+{
+ * APRs socket address type, used to ensure protocol independence
+ }
+ apr_sockaddr_t = record
+ { The pool to use... }
+ pool: Papr_pool_t;
+ { The hostname }
+ hostname: PChar;
+ { Either a string of the port number or the service name for the port }
+ servname: PChar;
+ { The numeric port }
+ port: apr_port_t;
+ { The family }
+ family: apr_int32_t;
+ { How big is the sockaddr we're using? }
+ salen: apr_socklen_t;
+ { How big is the ip address structure we're using? }
+ ipaddr_len: cint;
+ { How big should the address buffer be? 16 for v4 or 46 for v6
+ * used in inet_ntop... }
+ addr_str_len: cint;
+ { This points to the IP address structure within the appropriate
+ * sockaddr structure. }
+ ipaddr_ptr: Pointer;
+ { If multiple addresses were found by apr_sockaddr_info_get(), this
+ * points to a representation of the next address. }
+ next: Papr_sockaddr_t;
+ { Union of either IPv4 or IPv6 sockaddr. }
+ sa: sa_t;
+ end;
+
+{$ifdef APR_HAS_SENDFILE}
+{
+ * Support reusing the socket on platforms which support it (from disconnect,
+ * specifically Win32.
+ * @remark Optional flag passed into apr_socket_sendfile()
+ }
+ APR_SENDFILE_DISCONNECT_SOCKET = 1;
+{$endif}
+
+{ A structure to encapsulate headers and trailers for apr_socket_sendfile }
+ apr_hdtr_t = record
+ { An iovec to store the headers sent before the file. }
+ headers: Piovec;
+ { number of headers in the iovec }
+ numheaders: cint;
+ { An iovec to store the trailers sent after the file. }
+ trailers: Piovec;
+ { number of trailers in the iovec }
+ numtrailers: Integer;
+ end;
+
+{ function definitions }
+
+{
+ * Create a socket.
+ * @param new_sock The new socket that has been set up.
+ * @param family The address family of the socket (e.g., APR_INET).
+ * @param type The type of the socket (e.g., SOCK_STREAM).
+ * @param cont The pool to use
+ }
+function apr_socket_create(new_sock: PPapr_socket_t;
+ family, type_, protocol: Integer; cont: Papr_pool_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_socket_create' + LibSuff20;
+
+{
+ * Shutdown either reading, writing, or both sides of a socket.
+ * @param thesocket The socket to close
+ * @param how How to shutdown the socket. One of:
+ * <PRE>
+ * APR_SHUTDOWN_READ no longer allow read requests
+ * APR_SHUTDOWN_WRITE no longer allow write requests
+ * APR_SHUTDOWN_READWRITE no longer allow read or write requests
+ * </PRE>
+ * @see apr_shutdown_how_e
+ * @remark This does not actually close the socket descriptor, it just
+ * controls which calls are still valid on the socket.
+ }
+function apr_socket_shutdown(thesocket: Papr_socket_t;
+ how: apr_shutdown_how_e): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_socket_shutdown' + LibSuff8;
+
+{
+ * Close a socket.
+ * @param thesocket The socket to close
+ }
+function apr_socket_close(thesocket: Papr_socket_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_socket_close' + LibSuff4;
+
+{
+ * Bind the socket to its associated port
+ * @param sock The socket to bind
+ * @param sa The socket address to bind to
+ * @remark This may be where we will find out if there is any other process
+ * using the selected port.
+ }
+function apr_socket_bind(sock: Papr_socket_t;
+ sa: Papr_sockaddr_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_socket_bind' + LibSuff8;
+
+{
+ * Listen to a bound socket for connections.
+ * @param sock The socket to listen on
+ * @param backlog The number of outstanding connections allowed in the sockets
+ * listen queue. If this value is less than zero, the listen
+ * queue size is set to zero.
+ }
+function apr_socket_listen(sock: Papr_socket_t;
+ backlog: apr_int32_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_socket_listen' + LibSuff8;
+
+{
+ * Accept a new connection request
+ * @param new_sock A copy of the socket that is connected to the socket that
+ * made the connection request. This is the socket which should
+ * be used for all future communication.
+ * @param sock The socket we are listening on.
+ * @param connection_pool The pool for the new socket.
+ }
+function apr_socket_accept(new_sock: PPapr_socket_t;
+ sock: Papr_socket_t; connection_pool: Papr_pool_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_socket_accept' + LibSuff12;
+
+{
+ * Issue a connection request to a socket either on the same machine
+ * or a different one.
+ * @param sock The socket we wish to use for our side of the connection
+ * @param sa The address of the machine we wish to connect to. If NULL,
+ * APR assumes that the sockaddr_in in the apr_socket is
+ * completely filled out.
+ }
+function apr_socket_connect(sock: Papr_socket_t; sa: Papr_sockaddr_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_socket_connect' + LibSuff8;
+
+{
+ * Create apr_sockaddr_t from hostname, address family, and port.
+ * @param sa The new apr_sockaddr_t.
+ * @param hostname The hostname or numeric address string to resolve/parse, or
+ * NULL to build an address that corresponds to 0.0.0.0 or ::
+ * @param family The address family to use, or APR_UNSPEC if the system should
+ * decide.
+ * @param port The port number.
+ * @param flags Special processing flags:
+ * <PRE>
+ * APR_IPV4_ADDR_OK first query for IPv4 addresses; only look
+ * for IPv6 addresses if the first query failed;
+ * only valid if family is APR_UNSPEC and hostname
+ * isn't NULL; mutually exclusive with
+ * APR_IPV6_ADDR_OK
+ * APR_IPV6_ADDR_OK first query for IPv6 addresses; only look
+ * for IPv4 addresses if the first query failed;
+ * only valid if family is APR_UNSPEC and hostname
+ * isn't NULL and APR_HAVE_IPV6; mutually exclusive
+ * with APR_IPV4_ADDR_OK
+ * </PRE>
+ * @param p The pool for the apr_sockaddr_t and associated storage.
+ }
+function apr_sockaddr_info_get(sa: PPapr_socket_t;
+ const hostname: PChar; family: apr_int32_t;
+ port: apr_port_t; flags: apr_int32_t; p: Papr_pool_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_sockaddr_info_get' + LibSuff24;
+
+{
+ * Look up the host name from an apr_sockaddr_t.
+ * @param hostname The hostname.
+ * @param sa The apr_sockaddr_t.
+ * @param flags Special processing flags.
+ }
+function apr_getnameinfo(hostname: PPChar; sa: Papr_socket_t; flags: apr_int32_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_getnameinfo' + LibSuff12;
+
+{
+ * Parse hostname/IP address with scope id and port.
+ *
+ * Any of the following strings are accepted:
+ * 8080 (just the port number)
+ * www.apache.org (just the hostname)
+ * www.apache.org:8080 (hostname and port number)
+ * [fe80::1]:80 (IPv6 numeric address string only)
+ * [fe80::1%eth0] (IPv6 numeric address string and scope id)
+ *
+ * Invalid strings:
+ * (empty string)
+ * [abc] (not valid IPv6 numeric address string)
+ * abc:65536 (invalid port number)
+ *
+ * @param addr The new buffer containing just the hostname. On output, *addr
+ * will be NULL if no hostname/IP address was specfied.
+ * @param scope_id The new buffer containing just the scope id. On output,
+ * *scope_id will be NULL if no scope id was specified.
+ * @param port The port number. On output, *port will be 0 if no port was
+ * specified.
+ * ### FIXME: 0 is a legal port (per RFC 1700). this should
+ * ### return something besides zero if the port is missing.
+ * @param str The input string to be parsed.
+ * @param p The pool from which *addr and *scope_id are allocated.
+ * @remark If scope id shouldn't be allowed, check for scope_id != NULL in
+ * addition to checking the return code. If addr/hostname should be
+ * required, check for addr == NULL in addition to checking the
+ * return code.
+ }
+function apr_parse_addr_port(addr, scope_id: PPChar; port: Papr_port_t;
+ const str: PChar; p: Papr_pool_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_parse_addr_port' + LibSuff20;
+
+{
+ * Get name of the current machine
+ * @param buf A buffer to store the hostname in.
+ * @param len The maximum length of the hostname that can be stored in the
+ * buffer provided. The suggested length is APRMAXHOSTLEN + 1.
+ * @param cont The pool to use.
+ * @remark If the buffer was not large enough, an error will be returned.
+ }
+function apr_gethostname(buf: PChar; len: Integer; cont: Papr_pool_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_gethostname' + LibSuff12;
+
+{
+ * Return the data associated with the current socket
+ * @param data The user data associated with the socket.
+ * @param key The key to associate with the user data.
+ * @param sock The currently open socket.
+ }
+function apr_socket_data_get(data: PPointer; const key: PChar;
+ sock: Papr_sockaddr_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_socket_data_get' + LibSuff12;
+
+{
+ * Set the data associated with the current socket.
+ * @param sock The currently open socket.
+ * @param data The user data to associate with the socket.
+ * @param key The key to associate with the data.
+ * @param cleanup The cleanup to call when the socket is destroyed.
+ }
+type
+ cleanup_t = function (param: Pointer): apr_status_t;
+
+function apr_socket_data_set(sock: Papr_socket_t; data: Pointer;
+ const key: PChar; cleanup: cleanup_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_socket_data_set' + LibSuff16;
+
+{
+ * Send data over a network.
+ * @param sock The socket to send the data over.
+ * @param buf The buffer which contains the data to be sent.
+ * @param len On entry, the number of bytes to send; on exit, the number
+ * of bytes sent.
+ * @remark
+ * <PRE>
+ * This functions acts like a blocking write by default. To change
+ * this behavior, use apr_socket_timeout_set().
+ *
+ * It is possible for both bytes to be sent and an error to be returned.
+ *
+ * APR_EINTR is never returned.
+ * </PRE>
+ }
+function apr_socket_send(sock: Papr_socket_t; const buf: PChar;
+ len: Papr_size_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_socket_send' + LibSuff12;
+
+{
+ * Send multiple packets of data over a network.
+ * @param sock The socket to send the data over.
+ * @param vec The array of iovec structs containing the data to send
+ * @param nvec The number of iovec structs in the array
+ * @param len Receives the number of bytes actually written
+ * @remark
+ * <PRE>
+ * This functions acts like a blocking write by default. To change
+ * this behavior, use apr_socket_timeout_set().
+ * The number of bytes actually sent is stored in argument 3.
+ *
+ * It is possible for both bytes to be sent and an error to be returned.
+ *
+ * APR_EINTR is never returned.
+ * </PRE>
+ }
+function apr_socket_sendv(sock: Papr_socket_t; const vec: Piovec;
+ nvec: apr_int32_t; len: Papr_size_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_socket_sendv' + LibSuff16;
+
+{
+ * @param sock The socket to send from
+ * @param where The apr_sockaddr_t describing where to send the data
+ * @param flags The flags to use
+ * @param buf The data to send
+ * @param len The length of the data to send
+ }
+function apr_socket_sendto(sock: Papr_socket_t; where: Papr_sockaddr_t;
+ flags: apr_int32_t; const buf: PChar; len: Papr_size_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_socket_sendto' + LibSuff20;
+
+{
+ * @param from The apr_sockaddr_t to fill in the recipient info
+ * @param sock The socket to use
+ * @param flags The flags to use
+ * @param buf The buffer to use
+ * @param len The length of the available buffer
+ }
+function apr_socket_recvfrom(from: Papr_sockaddr_t; sock: Papr_socket_t;
+ flags: apr_int32_t; buf: PChar; len: Papr_size_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_socket_recvfrom' + LibSuff20;
+
+{$if defined(APR_HAS_SENDFILE) or defined(DOXYGEN)}
+
+{
+ * Send a file from an open file descriptor to a socket, along with
+ * optional headers and trailers
+ * @param sock The socket to which we're writing
+ * @param file The open file from which to read
+ * @param hdtr A structure containing the headers and trailers to send
+ * @param offset Offset into the file where we should begin writing
+ * @param len (input) - Number of bytes to send from the file
+ * (output) - Number of bytes actually sent,
+ * including headers, file, and trailers
+ * @param flags APR flags that are mapped to OS specific flags
+ * @remark This functions acts like a blocking write by default. To change
+ * this behavior, use apr_socket_timeout_set().
+ * The number of bytes actually sent is stored in argument 5.
+ }
+function apr_socket_sendfile(sock: Papr_socket_t; file_: Papr_file_t;
+ hdtr: Papr_hdtr_t; offset: Papr_off_t; len: Papr_size_t;
+ flags: apr_int32_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_socket_sendfile' + LibSuff24;
+
+{$endif} { APR_HAS_SENDFILE }
+
+{
+ * Read data from a network.
+ * @param sock The socket to read the data from.
+ * @param buf The buffer to store the data in.
+ * @param len On entry, the number of bytes to receive; on exit, the number
+ * of bytes received.
+ * @remark
+ * <PRE>
+ * This functions acts like a blocking read by default. To change
+ * this behavior, use apr_socket_timeout_set().
+ * The number of bytes actually sent is stored in argument 3.
+ *
+ * It is possible for both bytes to be received and an APR_EOF or
+ * other error to be returned.
+ *
+ * APR_EINTR is never returned.
+ * </PRE>
+ }
+function apr_socket_recv(sock: Papr_socket_t; buf: PChar; len: Papr_size_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_socket_recv' + LibSuff12;
+
+{
+ * Setup socket options for the specified socket
+ * @param sock The socket to set up.
+ * @param opt The option we would like to configure. One of:
+ * <PRE>
+ * APR_SO_DEBUG -- turn on debugging information
+ * APR_SO_KEEPALIVE -- keep connections active
+ * APR_SO_LINGER -- lingers on close if data is present
+ * APR_SO_NONBLOCK -- Turns blocking on/off for socket
+ * When this option is enabled, use
+ * the APR_STATUS_IS_EAGAIN() macro to
+ * see if a send or receive function
+ * could not transfer data without
+ * blocking.
+ * APR_SO_REUSEADDR -- The rules used in validating addresses
+ * supplied to bind should allow reuse
+ * of local addresses.
+ * APR_SO_SNDBUF -- Set the SendBufferSize
+ * APR_SO_RCVBUF -- Set the ReceiveBufferSize
+ * </PRE>
+ * @param on Value for the option.
+ }
+function apr_socket_opt_set(sock: Papr_socket_t; opt, on_: apr_int32_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_socket_opt_set' + LibSuff12;
+
+{
+ * Setup socket timeout for the specified socket
+ * @param sock The socket to set up.
+ * @param t Value for the timeout.
+ * <PRE>
+ * t > 0 -- read and write calls return APR_TIMEUP if specified time
+ * elapsess with no data read or written
+ * t == 0 -- read and write calls never block
+ * t < 0 -- read and write calls block
+ * </PRE>
+ }
+function apr_socket_timeout_set(sock: Papr_socket_t; t: apr_interval_time_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_socket_timeout_set' + LibSuff12;
+
+{
+ * Query socket options for the specified socket
+ * @param sock The socket to query
+ * @param opt The option we would like to query. One of:
+ * <PRE>
+ * APR_SO_DEBUG -- turn on debugging information
+ * APR_SO_KEEPALIVE -- keep connections active
+ * APR_SO_LINGER -- lingers on close if data is present
+ * APR_SO_NONBLOCK -- Turns blocking on/off for socket
+ * APR_SO_REUSEADDR -- The rules used in validating addresses
+ * supplied to bind should allow reuse
+ * of local addresses.
+ * APR_SO_SNDBUF -- Set the SendBufferSize
+ * APR_SO_RCVBUF -- Set the ReceiveBufferSize
+ * APR_SO_DISCONNECTED -- Query the disconnected state of the socket.
+ * (Currently only used on Windows)
+ * </PRE>
+ * @param on Socket option returned on the call.
+ }
+function apr_socket_opt_get(sock: Papr_socket_t; opt, on_: apr_int32_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_socket_opt_get' + LibSuff12;
+
+{
+ * Query socket timeout for the specified socket
+ * @param sock The socket to query
+ * @param t Socket timeout returned from the query.
+ }
+function apr_socket_timeout_get(sock: Papr_socket_t; t: Papr_interval_time_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_socket_timeout_get' + LibSuff8;
+
+{
+ * Query the specified socket if at the OOB/Urgent data mark
+ * @param sock The socket to query
+ * @param atmark Is set to true if socket is at the OOB/urgent mark,
+ * otherwise is set to false.
+ }
+function apr_socket_atmark(sock: Papr_socket_t; atmark: PInteger): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_socket_atmark' + LibSuff8;
+
+{
+ * Return an apr_sockaddr_t from an apr_socket_t
+ * @param sa The returned apr_sockaddr_t.
+ * @param which Which interface do we want the apr_sockaddr_t for?
+ * @param sock The socket to use
+ }
+function apr_socket_addr_get(sa: PPapr_sockaddr_t;
+ which: apr_interface_e; sock: Papr_socket_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_socket_addr_get' + LibSuff12;
+
+{
+ * Return the IP address (in numeric address string format) in
+ * an APR socket address. APR will allocate storage for the IP address
+ * string from the pool of the apr_sockaddr_t.
+ * @param addr The IP address.
+ * @param sockaddr The socket address to reference.
+ }
+function apr_sockaddr_ip_get(addr: PPChar; sockaddr: Papr_sockaddr_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_sockaddr_ip_get' + LibSuff8;
+
+{
+ * See if the IP addresses in two APR socket addresses are
+ * equivalent. Appropriate logic is present for comparing
+ * IPv4-mapped IPv6 addresses with IPv4 addresses.
+ *
+ * @param addr1 One of the APR socket addresses.
+ * @param addr2 The other APR socket address.
+ * @remark The return value will be non-zero if the addresses
+ * are equivalent.
+ }
+function apr_sockaddr_equal(const addr1, addr2: Papr_sockaddr_t): Integer;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_sockaddr_equal' + LibSuff8;
+
+{
+ * Return the type of the socket.
+ * @param sock The socket to query.
+ * @param type The returned type (e.g., SOCK_STREAM).
+ }
+function apr_socket_type_get(sock: Papr_socket_t; type_: PInteger): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_socket_type_get' + LibSuff8;
+
+{
+ * Given an apr_sockaddr_t and a service name, set the port for the service
+ * @param sockaddr The apr_sockaddr_t that will have its port set
+ * @param servname The name of the service you wish to use
+ }
+function apr_getservbyname(sockaddr: Papr_sockaddr_t; const servname: PChar): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_getservbyname' + LibSuff8;
+
+{
+ * Build an ip-subnet representation from an IP address and optional netmask or
+ * number-of-bits.
+ * @param ipsub The new ip-subnet representation
+ * @param ipstr The input IP address string
+ * @param mask_or_numbits The input netmask or number-of-bits string, or NULL
+ * @param p The pool to allocate from
+ }
+function apr_ipsubnet_create(ipsub: PPapr_ipsubnet_t;
+ const ipstr, mask_or_numbits: PChar; p: Papr_pool_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_ipsubnet_create' + LibSuff16;
+
+{
+ * Test the IP address in an apr_sockaddr_t against a pre-built ip-subnet
+ * representation.
+ * @param ipsub The ip-subnet representation
+ * @param sa The socket address to test
+ * @return non-zero if the socket address is within the subnet, 0 otherwise
+ }
+function apr_ipsubnet_test(ipsub: Papr_ipsubnet_t; sa: Papr_sockaddr_t): Integer;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_ipsubnet_test' + LibSuff8;
+
+{$if defined(APR_HAS_SO_ACCEPTFILTER) or defined(DOXYGEN)}
+{
+ * Set an OS level accept filter.
+ * @param sock The socket to put the accept filter on.
+ * @param name The accept filter
+ * @param args Any extra args to the accept filter. Passing NULL here removes
+ * the accept filter.
+ }
+function apr_socket_accept_filter(sock: Papr_socket_t; name, args: PChar): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_socket_accept_filter' + LibSuff12;
+
+{$endif}
+
+{
+ * Return the protocol of the socket.
+ * @param sock The socket to query.
+ * @param protocol The returned protocol (e.g., APR_PROTO_TCP).
+ }
+function apr_socket_protocol_get(sock: Papr_socket_t; protocol: PInteger): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_socket_protocol_get' + LibSuff8;
+
+{
+ * Get the pool used by the socket.
+ }
+//APR_POOL_DECLARE_ACCESSOR(socket);
+
+{
+ * Set a socket to be inherited by child processes.
+ }
+//APR_DECLARE_INHERIT_SET(socket);
+
+{
+ * Unset a socket from being inherited by child processes.
+ }
+//APR_DECLARE_INHERIT_UNSET(socket);
+
+{
+ * @defgroup apr_mcast IP Multicast
+ }
+
+{
+ * Join a Multicast Group
+ * @param sock The socket to join a multicast group
+ * @param join The address of the multicast group to join
+ * @param iface Address of the interface to use. If NULL is passed, the
+ * default multicast interface will be used. (OS Dependent)
+ * @param source Source Address to accept transmissions from (non-NULL
+ * implies Source-Specific Multicast)
+ }
+function apr_mcast_join(sock: Papr_socket_t;
+ join, iface, source: Papr_sockaddr_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_mcast_join' + LibSuff16;
+
+{
+ * Leave a Multicast Group. All arguments must be the same as
+ * apr_mcast_join.
+ * @param sock The socket to leave a multicast group
+ * @param addr The address of the multicast group to leave
+ * @param iface Address of the interface to use. If NULL is passed, the
+ * default multicast interface will be used. (OS Dependent)
+ * @param source Source Address to accept transmissions from (non-NULL
+ * implies Source-Specific Multicast)
+ }
+function apr_mcast_leave(sock: Papr_socket_t;
+ addr, iface, source: Papr_sockaddr_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_mcast_leave' + LibSuff16;
+
+{
+ * Set the Multicast Time to Live (ttl) for a multicast transmission.
+ * @param sock The socket to set the multicast ttl
+ * @param ttl Time to live to Assign. 0-255, default=1
+ * @remark If the TTL is 0, packets will only be seen by sockets on
+ * the local machine, and only when multicast loopback is enabled.
+ }
+function apr_mcast_hops(sock: Papr_socket_t; ttl: apr_byte_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_mcast_hops' + LibSuff8;
+
+{
+ * Toggle IP Multicast Loopback
+ * @param sock The socket to set multicast loopback
+ * @param opt 0=disable, 1=enable
+ }
+function apr_mcast_loopback(sock: Papr_socket_t; opt: apr_byte_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_mcast_loopback' + LibSuff8;
+
+{
+ * Set the Interface to be used for outgoing Multicast Transmissions.
+ * @param sock The socket to set the multicast interface on
+ * @param iface Address of the interface to use for Multicast
+ }
+function apr_mcast_interface(sock: Papr_socket_t; iface: Papr_sockaddr_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_mcast_interface' + LibSuff8;
+
diff --git a/packages/httpd22/src/apr/apr_poll.inc b/packages/httpd22/src/apr/apr_poll.inc
new file mode 100644
index 0000000000..ce0e5d7b90
--- /dev/null
+++ b/packages/httpd22/src/apr/apr_poll.inc
@@ -0,0 +1,193 @@
+{ Copyright 2000-2005 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed 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.
+ }
+
+{
+ * @file apr_poll.h
+ * @brief APR Poll interface
+ }
+{#include "apr.h"
+#include "apr_pools.h"
+#include "apr_errno.h"
+#include "apr_inherit.h"
+#include "apr_file_io.h"
+#include "apr_network_io.h"
+
+#if APR_HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif}
+
+{
+ * @defgroup apr_poll Poll Routines
+ * @ingroup APR
+ }
+
+{
+ * Poll options
+ }
+const
+ APR_POLLIN = $001; {< Can read without blocking }
+ APR_POLLPRI = $002; {< Priority data available }
+ APR_POLLOUT = $004; {< Can write without blocking }
+ APR_POLLERR = $010; {< Pending error }
+ APR_POLLHUP = $020; {< Hangup occurred }
+ APR_POLLNVAL = $040; {< Descriptior invalid }
+
+{
+ * Pollset Flags
+ }
+ APR_POLLSET_THREADSAFE = $001; {< Adding or Removing a Descriptor is thread safe }
+
+{ Used in apr_pollfd_t to determine what the apr_descriptor is }
+type
+ apr_datatype_e = (
+ APR_NO_DESC, {< nothing here }
+ APR_POLL_SOCKET, {< descriptor refers to a socket }
+ APR_POLL_FILE, {< descriptor refers to a file }
+ APR_POLL_LASTDESC {< descriptor is the last one in the list }
+ );
+
+{ Union of either an APR file or socket. }
+ apr_descriptor = record
+ case Integer of
+ 1: (f: Papr_file_t); {< file }
+ 2: (s: Papr_socket_t); {< socket }
+ end;
+
+{ @see apr_pollfd_t }
+ Papr_pollfd_t = ^apr_pollfd_t;
+
+ PPapr_pollfd_t = ^Papr_pollfd_t;
+
+{ Poll descriptor set. }
+ apr_pollfd_t = record
+ p: Papr_pool_t; {< associated pool }
+ desc_type: apr_datatype_e; {< descriptor type }
+ reqevents: apr_int16_t; {< requested events }
+ rtnevents: apr_int16_t; {< returned events }
+ desc: apr_descriptor; {< @see apr_descriptor }
+ client_data: Pointer; {< allows app to associate context }
+ end;
+
+{ General-purpose poll API for arbitrarily large numbers of
+ * file descriptors
+ }
+
+{ Opaque structure used for pollset API }
+type
+ apr_pollset_t = record end;
+ Papr_pollset_t = ^apr_pollset_t;
+ PPapr_pollset_t = ^Papr_pollset_t;
+
+{
+ * Setup a pollset object
+ * @param pollset The pointer in which to return the newly created object
+ * @param size The maximum number of descriptors that this pollset can hold
+ * @param p The pool from which to allocate the pollset
+ * @param flags Optional flags to modify the operation of the pollset.
+ *
+ * @remark If flags equals APR_POLLSET_THREADSAFE, then a pollset is
+ * created on which it is safe to make concurrent calls to
+ * apr_pollset_add(), apr_pollset_remove() and apr_pollset_poll() from
+ * separate threads. This feature is only supported on some
+ * platforms; the apr_pollset_create() call will fail with
+ * APR_ENOTIMPL on platforms where it is not supported.
+ }
+function apr_pollset_create(pollset: PPapr_pollset_t; size: apr_uint32_tso_handle_t;
+ p: Papr_pool_t; flags: apr_uint32_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_pollset_create' + LibSuff16;
+
+{
+ * Destroy a pollset object
+ * @param pollset The pollset to destroy
+ }
+function apr_pollset_destroy(pollset: Papr_pollset_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_pollset_destroy' + LibSuff4;
+
+{
+ * Add a socket or file descriptor to a pollset
+ * @param pollset The pollset to which to add the descriptor
+ * @param descriptor The descriptor to add
+ * @remark If you set client_data in the descriptor, that value
+ * will be returned in the client_data field whenever this
+ * descriptor is signalled in apr_pollset_poll().
+ * @remark If the pollset has been created with APR_POLLSET_THREADSAFE
+ * and thread T1 is blocked in a call to apr_pollset_poll() for
+ * this same pollset that is being modified via apr_pollset_add()
+ * in thread T2, the currently executing apr_pollset_poll() call in
+ * T1 will either: (1) automatically include the newly added descriptor
+ * in the set of descriptors it is watching or (2) return immediately
+ * with APR_EINTR. Option (1) is recommended, but option (2) is
+ * allowed for implementations where option (1) is impossible
+ * or impractical.
+ }
+function apr_pollset_add(pollset: Papr_pollset_t;
+ const descriptor: Papr_pollfd_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_pollset_add' + LibSuff8;
+
+{
+ * Remove a descriptor from a pollset
+ * @param pollset The pollset from which to remove the descriptor
+ * @param descriptor The descriptor to remove
+ * @remark If the pollset has been created with APR_POLLSET_THREADSAFE
+ * and thread T1 is blocked in a call to apr_pollset_poll() for
+ * this same pollset that is being modified via apr_pollset_remove()
+ * in thread T2, the currently executing apr_pollset_poll() call in
+ * T1 will either: (1) automatically exclude the newly added descriptor
+ * in the set of descriptors it is watching or (2) return immediately
+ * with APR_EINTR. Option (1) is recommended, but option (2) is
+ * allowed for implementations where option (1) is impossible
+ * or impractical.
+ }
+function apr_pollset_remove(pollset: Papr_pollset_t;
+ const descriptor: Papr_pollfd_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_pollset_remove' + LibSuff8;
+
+{
+ * Block for activity on the descriptor(s) in a pollset
+ * @param pollset The pollset to use
+ * @param timeout Timeout in microseconds
+ * @param num Number of signalled descriptors (output parameter)
+ * @param descriptors Array of signalled descriptors (output parameter)
+ }
+function apr_pollset_poll(pollset: Papr_pollset_t; timeout: apr_interval_time_t;
+ num: Papr_int32_t; const descriptors: PPapr_pollfd_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_pollset_poll' + LibSuff20;
+
+{
+ * Poll the descriptors in the poll structure
+ * @param aprset The poll structure we will be using.
+ * @param numsock The number of descriptors we are polling
+ * @param nsds The number of descriptors signalled.
+ * @param timeout The amount of time in microseconds to wait. This is
+ * a maximum, not a minimum. If a descriptor is signalled, we
+ * will wake up before this time. A negative number means
+ * wait until a descriptor is signalled.
+ * @remark The number of descriptors signalled is returned in the third argument.
+ * This is a blocking call, and it will not return until either a
+ * descriptor has been signalled, or the timeout has expired.
+ * @remark The rtnevents field in the apr_pollfd_t array will only be filled-
+ * in if the return value is APR_SUCCESS.
+ }
+function apr_poll(aprset: Papr_pollfd_t; numsock: apr_int32_t;
+ nsds: Papr_int32_t; timeout: apr_interval_time_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_poll' + LibSuff20;
+
diff --git a/packages/httpd22/src/apr/apr_pools.inc b/packages/httpd22/src/apr/apr_pools.inc
new file mode 100644
index 0000000000..025fd34780
--- /dev/null
+++ b/packages/httpd22/src/apr/apr_pools.inc
@@ -0,0 +1,702 @@
+{ Copyright 2000-2005 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed 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.
+ }
+
+{
+ * @file apr_pools.h
+ * @brief APR memory allocation
+ *
+ * Resource allocation routines...
+ *
+ * designed so that we don't have to keep track of EVERYTHING so that
+ * it can be explicitly freed later (a fundamentally unsound strategy ---
+ * particularly in the presence of die()).
+ *
+ * Instead, we maintain pools, and allocate items (both memory and I/O
+ * handlers) from the pools --- currently there are two, one for per
+ * transaction info, and one for config info. When a transaction is over,
+ * we can delete everything in the per-transaction apr_pool_t without fear,
+ * and without thinking too hard about it either.
+ }
+
+{#include "apr.h"
+#include "apr_errno.h"
+#include "apr_general.h" for APR_STRINGIFY }
+//#include "apr_want.h"
+
+{
+ * @defgroup apr_pools Memory Pool Functions
+ * @ingroup APR
+ * @
+ }
+
+{ The fundamental pool type }
+type
+ apr_pool_t = record end;
+ Papr_pool_t = ^apr_pool_t;
+ PPapr_pool_t = ^Papr_pool_t;
+
+{
+ * Declaration helper macro to construct apr_foo_pool_get()s.
+ *
+ * This standardized macro is used by opaque (APR) data types to return
+ * the apr_pool_t that is associated with the data type.
+ *
+ * APR_POOL_DECLARE_ACCESSOR() is used in a header file to declare the
+ * accessor function. A typical usage and result would be:
+ * <pre>
+ * APR_POOL_DECLARE_ACCESSOR(file);
+ * becomes:
+ * APR_DECLARE(apr_pool_t *) apr_file_pool_get(apr_file_t *ob);
+ * </pre>
+ * @remark Doxygen unwraps this macro (via doxygen.conf) to provide
+ * actual help for each specific occurance of apr_foo_pool_get.
+ * @remark the linkage is specified for APR. It would be possible to expand
+ * the macros to support other linkages.
+ }
+{#define APR_POOL_DECLARE_ACCESSOR(type) \
+ APR_DECLARE(apr_pool_t *) apr_##type##_pool_get \
+ (const apr_##type##_t *the##type)
+}
+{
+ * Implementation helper macro to provide apr_foo_pool_get()s.
+ *
+ * In the implementation, the APR_POOL_IMPLEMENT_ACCESSOR() is used to
+ * actually define the function. It assumes the field is named "pool".
+ }
+{#define APR_POOL_IMPLEMENT_ACCESSOR(type) \
+ APR_DECLARE(apr_pool_t *) apr_##type##_pool_get \
+ (const apr_##type##_t *the##type) \}
+ { return the##type->pool; }
+
+
+{
+ * Pool debug levels
+ *
+ * <pre>
+ * | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
+ * ---------------------------------
+ * | | | | | | | | x | General debug code enabled (useful in
+ * combination with --with-efence).
+ *
+ * | | | | | | | x | | Verbose output on stderr (report
+ * CREATE, CLEAR, DESTROY).
+ *
+ * | | | | x | | | | | Verbose output on stderr (report
+ * PALLOC, PCALLOC).
+ *
+ * | | | | | | x | | | Lifetime checking. On each use of a
+ * pool, check its lifetime. If the pool
+ * is out of scope, abort().
+ * In combination with the verbose flag
+ * above, it will output LIFE in such an
+ * event prior to aborting.
+ *
+ * | | | | | x | | | | Pool owner checking. On each use of a
+ * pool, check if the current thread is the
+ * pools owner. If not, abort(). In
+ * combination with the verbose flag above,
+ * it will output OWNER in such an event
+ * prior to aborting. Use the debug
+ * function apr_pool_owner_set() to switch
+ * a pools ownership.
+ *
+ * When no debug level was specified, assume general debug mode.
+ * If level 0 was specified, debugging is switched off
+ * </pre>
+ }
+{$ifdef APR_POOL_DEBUG}
+{/* If APR_POOL_DEBUG is blank, we get 1; if it is a number, we get -1. */
+#if (APR_POOL_DEBUG - APR_POOL_DEBUG -1 == 1)
+#undef APR_POOL_DEBUG
+#define APR_POOL_DEBUG 1
+#endif}
+{$else}
+const
+ APR_POOL_DEBUG = 0;
+{$endif}
+
+{ the place in the code where the particular function was called }
+//#define APR_POOL__FILE_LINE__ __FILE__ ":" APR_STRINGIFY(__LINE__)
+
+
+
+{ A function that is called when allocation fails. }
+type
+ apr_abortfunc_t = function (retcode: Integer): Integer;
+
+{
+ * APR memory structure manipulators (pools, tables, and arrays).
+ }
+
+{
+ * Initialization
+ }
+
+{
+ * Setup all of the internal structures required to use pools
+ * @remark Programs do NOT need to call this directly. APR will call this
+ * automatically from apr_initialize.
+ * @internal
+ }
+function apr_pool_initialize: apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_pool_initialize' + LibSuff0;
+
+{
+ * Tear down all of the internal structures required to use pools
+ * @remark Programs do NOT need to call this directly. APR will call this
+ * automatically from apr_terminate.
+ * @internal
+ }
+procedure apr_pool_terminate;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_pool_terminate' + LibSuff0;
+
+{
+ * Pool creation/destruction
+ }
+
+{$include apr_allocator.inc}
+
+{
+ * Create a new pool.
+ * @param newpool The pool we have just created.
+ * @param parent The parent pool. If this is NULL, the new pool is a root
+ * pool. If it is non-NULL, the new pool will inherit all
+ * of its parent pool's attributes, except the apr_pool_t will
+ * be a sub-pool.
+ * @param abort_fn A function to use if the pool cannot allocate more memory.
+ * @param allocator The allocator to use with the new pool. If NULL the
+ * allocator of the parent pool will be used.
+ }
+function apr_pool_create_ex(newpool: PPapr_pool_t;
+ parent: Papr_pool_t; abort_fn: apr_abortfunc_t;
+ allocator: Papr_allocator_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_pool_create_ex' + LibSuff16;
+
+{
+ * Debug version of apr_pool_create_ex.
+ * @param newpool @see apr_pool_create.
+ * @param parent @see apr_pool_create.
+ * @param abort_fn @see apr_pool_create.
+ * @param allocator @see apr_pool_create.
+ * @param file_line Where the function is called from.
+ * This is usually APR_POOL__FILE_LINE__.
+ * @remark Only available when APR_POOL_DEBUG is defined.
+ * Call this directly if you have you apr_pool_create_ex
+ * calls in a wrapper function and wish to override
+ * the file_line argument to reflect the caller of
+ * your wrapper function. If you do not have
+ * apr_pool_create_ex in a wrapper, trust the macro
+ * and don't call apr_pool_create_ex_debug directly.
+ }
+function apr_pool_create_ex_debug(newpool: PPapr_pool_t;
+ parent: Papr_pool_t; abort_fn: apr_abortfunc_t;
+ allocator: Papr_allocator_t; const file_line: PChar): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_pool_create_ex_debug' + LibSuff20;
+
+{#if APR_POOL_DEBUG
+#define apr_pool_create_ex(newpool, parent, abort_fn, allocator) \
+ apr_pool_create_ex_debug(newpool, parent, abort_fn, allocator, \
+ APR_POOL__FILE_LINE__)
+#endif
+}
+{
+ * Create a new pool.
+ * @param newpool The pool we have just created.
+ * @param parent The parent pool. If this is NULL, the new pool is a root
+ * pool. If it is non-NULL, the new pool will inherit all
+ * of its parent pool's attributes, except the apr_pool_t will
+ * be a sub-pool.
+ }
+{$ifdef DOXYGEN}
+function apr_pool_create(newpool: PPapr_pool_t;
+ parent: Papr_pool_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_pool_create' + LibSuff8;
+{$else}
+{.$ifdef APR_POOL_DEBUG}
+{#define apr_pool_create(newpool, parent) \
+ apr_pool_create_ex_debug(newpool, parent, NULL, NULL, \
+ APR_POOL__FILE_LINE__)}
+{.$else}
+function apr_pool_create(newpool: PPapr_pool_t; parent: Papr_pool_t): apr_status_t;
+{.$endif}
+{$endif}
+
+{
+ * Find the pools allocator
+ * @param pool The pool to get the allocator from.
+ }
+function apr_pool_allocator_get(pool: Papr_pool_t): Papr_allocator_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_pool_allocator_get' + LibSuff4;
+
+{
+ * Clear all memory in the pool and run all the cleanups. This also destroys all
+ * subpools.
+ * @param p The pool to clear
+ * @remark This does not actually free the memory, it just allows the pool
+ * to re-use this memory for the next allocation.
+ * @see apr_pool_destroy()
+ }
+procedure apr_pool_clear(p: Papr_pool_t);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_pool_clear' + LibSuff4;
+
+{
+ * Debug version of apr_pool_clear.
+ * @param p See: apr_pool_clear.
+ * @param file_line Where the function is called from.
+ * This is usually APR_POOL__FILE_LINE__.
+ * @remark Only available when APR_POOL_DEBUG is defined.
+ * Call this directly if you have you apr_pool_clear
+ * calls in a wrapper function and wish to override
+ * the file_line argument to reflect the caller of
+ * your wrapper function. If you do not have
+ * apr_pool_clear in a wrapper, trust the macro
+ * and don't call apr_pool_destroy_clear directly.
+ }
+procedure apr_pool_clear_debug(p: Papr_pool_t; const file_line: PChar);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_pool_clear_debug' + LibSuff8;
+
+{#if APR_POOL_DEBUG
+#define apr_pool_clear(p) \
+ apr_pool_clear_debug(p, APR_POOL__FILE_LINE__)
+#endif}
+
+{
+ * Destroy the pool. This takes similar action as apr_pool_clear() and then
+ * frees all the memory.
+ * @param p The pool to destroy
+ * @remark This will actually free the memory
+ }
+procedure apr_pool_destroy(p: Papr_pool_t);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_pool_destroy' + LibSuff4;
+
+{
+ * Debug version of apr_pool_destroy.
+ * @param p See: apr_pool_destroy.
+ * @param file_line Where the function is called from.
+ * This is usually APR_POOL__FILE_LINE__.
+ * @remark Only available when APR_POOL_DEBUG is defined.
+ * Call this directly if you have you apr_pool_destroy
+ * calls in a wrapper function and wish to override
+ * the file_line argument to reflect the caller of
+ * your wrapper function. If you do not have
+ * apr_pool_destroy in a wrapper, trust the macro
+ * and don't call apr_pool_destroy_debug directly.
+ }
+procedure apr_pool_destroy_debug(p: Papr_pool_t; const file_line: PChar);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_pool_destroy_debug' + LibSuff8;
+
+{#if APR_POOL_DEBUG
+#define apr_pool_destroy(p) \
+ apr_pool_destroy_debug(p, APR_POOL__FILE_LINE__)
+#endif}
+
+
+{
+ * Memory allocation
+ }
+
+{
+ * Allocate a block of memory from a pool
+ * @param p The pool to allocate from
+ * @param size The amount of memory to allocate
+ * @return The allocated memory
+ }
+function apr_palloc(p: Papr_pool_t; size: apr_size_t): Pointer;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_palloc' + LibSuff8;
+
+{
+ * Debug version of apr_palloc
+ * @param p See: apr_palloc
+ * @param size See: apr_palloc
+ * @param file_line Where the function is called from.
+ * This is usually APR_POOL__FILE_LINE__.
+ * @return See: apr_palloc
+ }
+function apr_palloc_debug(p: Papr_pool_t; size: apr_size_t;
+ const file_line: PChar): Pointer;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_palloc_debug' + LibSuff12;
+
+{#if APR_POOL_DEBUG
+#define apr_palloc(p, size) \
+ apr_palloc_debug(p, size, APR_POOL__FILE_LINE__)
+#endif
+}
+{
+ * Allocate a block of memory from a pool and set all of the memory to 0
+ * @param p The pool to allocate from
+ * @param size The amount of memory to allocate
+ * @return The allocated memory
+ }
+{#if defined(DOXYGEN)}
+
+function apr_pcalloc(p: Papr_pool_t; size: apr_size_t): Pointer;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_pcalloc' + LibSuff8;
+
+{#elif !APR_POOL_DEBUG
+#define apr_pcalloc(p, size) memset(apr_palloc(p, size), 0, size)
+#endif
+}
+{
+ * Debug version of apr_pcalloc
+ * @param p See: apr_pcalloc
+ * @param size See: apr_pcalloc
+ * @param file_line Where the function is called from.
+ * This is usually APR_POOL__FILE_LINE__.
+ * @return See: apr_pcalloc
+ }
+{APR_DECLARE(void *) apr_pcalloc_debug(apr_pool_t *p, apr_size_t size,
+ const char *file_line);
+
+#if APR_POOL_DEBUG
+#define apr_pcalloc(p, size) \
+ apr_pcalloc_debug(p, size, APR_POOL__FILE_LINE__)
+#endif
+
+}
+{
+ * Pool Properties
+ }
+
+{
+ * Set the function to be called when an allocation failure occurs.
+ * @remark If the program wants APR to exit on a memory allocation error,
+ * then this function can be called to set the callback to use (for
+ * performing cleanup and then exiting). If this function is not called,
+ * then APR will return an error and expect the calling program to
+ * deal with the error accordingly.
+ }
+procedure apr_pool_abort_set(abortfunc: apr_abortfunc_t; pool: Papr_pool_t);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_pool_abort_set' + LibSuff8;
+
+{
+ * Get the abort function associated with the specified pool.
+ * @param pool The pool for retrieving the abort function.
+ * @return The abort function for the given pool.
+ }
+function apr_pool_abort_get(pool: Papr_pool_t): apr_abortfunc_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_pool_abort_get' + LibSuff4;
+
+{
+ * Get the parent pool of the specified pool.
+ * @param pool The pool for retrieving the parent pool.
+ * @return The parent of the given pool.
+ }
+function apr_pool_parent_get(pool: Papr_pool_t): Papr_pool_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_pool_parent_get' + LibSuff4;
+
+{
+ * Determine if pool a is an ancestor of pool b.
+ * @param a The pool to search
+ * @param b The pool to search for
+ * @return True if a is an ancestor of b, NULL is considered an ancestor
+ * of all pools.
+ * @remark if compiled with APR_POOL_DEBUG, this function will also
+ * return true if A is a pool which has been guaranteed by the caller
+ * (using apr_pool_join) to have a lifetime at least as long as some
+ * ancestor of pool B.
+ }
+function apr_pool_is_ancestor(a, b: Papr_pool_t): Integer;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_pool_is_ancestor' + LibSuff8;
+
+{
+ * Tag a pool (give it a name)
+ * @param pool The pool to tag
+ * @param tag The tag
+ }
+procedure apr_pool_tag(pool: Papr_pool_t; tag: PChar);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_pool_tag' + LibSuff8;
+
+{
+ * User data management
+ }
+
+{
+ * Set the data associated with the current pool
+ * @param data The user data associated with the pool.
+ * @param key The key to use for association
+ * @param cleanup The cleanup program to use to cleanup the data (NULL if none)
+ * @param pool The current pool
+ * @warning The data to be attached to the pool should have a life span
+ * at least as long as the pool it is being attached to.
+ *
+ * Users of APR must take EXTREME care when choosing a key to
+ * use for their data. It is possible to accidentally overwrite
+ * data by choosing a key that another part of the program is using.
+ * Therefore it is advised that steps are taken to ensure that unique
+ * keys are used for all of the userdata objects in a particular pool
+ * (the same key in two different pools or a pool and one of its
+ * subpools is okay) at all times. Careful namespace prefixing of
+ * key names is a typical way to help ensure this uniqueness.
+ }
+//function apr_pool_userdata_set(
+// const data: Pointer; const key: PChar;
+// cleanup: function(param: Pointer): apr_status_t,
+// pool: Papr_pool_t): apr_status_t;
+// {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+// external LibAPR name LibNamePrefix + 'apr_pool_userdata_set' + LibSuff20;
+
+{
+ * Set the data associated with the current pool
+ * @param data The user data associated with the pool.
+ * @param key The key to use for association
+ * @param cleanup The cleanup program to use to cleanup the data (NULL if none)
+ * @param pool The current pool
+ * @note same as apr_pool_userdata_set(), except that this version doesn't
+ * make a copy of the key (this function is useful, for example, when
+ * the key is a string literal)
+ * @warning This should NOT be used if the key could change addresses by
+ * any means between the apr_pool_userdata_setn() call and a
+ * subsequent apr_pool_userdata_get() on that key, such as if a
+ * static string is used as a userdata key in a DSO and the DSO could
+ * be unloaded and reloaded between the _setn() and the _get(). You
+ * MUST use apr_pool_userdata_set() in such cases.
+ * @warning More generally, the key and the data to be attached to the
+ * pool should have a life span at least as long as the pool itself.
+ *
+ }
+//function apr_pool_userdata_setn(
+// const data: Pointer; const key: PChar;
+// cleanup: function(param: Pointer): apr_status_t,
+// pool: Papr_pool_t): apr_status_t;
+// {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+// external LibAPR name LibNamePrefix + 'apr_pool_userdata_setn' + LibSuff20;
+
+{
+ * Return the data associated with the current pool.
+ * @param data The user data associated with the pool.
+ * @param key The key for the data to retrieve
+ * @param pool The current pool.
+ }
+function apr_pool_userdata_get(data: PPointer; const key: PChar;
+ pool: Papr_pool_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_pool_userdata_get' + LibSuff12;
+
+{
+ * @defgroup PoolCleanup Pool Cleanup Functions
+ *
+ * Cleanups are performed in the reverse order they were registered. That is:
+ * Last In, First Out. A cleanup function can safely allocate memory from
+ * the pool that is being cleaned up. It can also safely register additional
+ * cleanups which will be run LIFO, directly after the current cleanup
+ * terminates. Cleanups have to take caution in calling functions that
+ * create subpools. Subpools, created during cleanup will NOT automatically
+ * be cleaned up. In other words, cleanups are to clean up after themselves.
+ *
+ }
+
+{
+ * Register a function to be called when a pool is cleared or destroyed
+ * @param p The pool register the cleanup with
+ * @param data The data to pass to the cleanup function.
+ * @param plain_cleanup The function to call when the pool is cleared
+ * or destroyed
+ * @param child_cleanup The function to call when a child process is about
+ * to exec - this function is called in the child, obviously!
+ }
+type
+ plain_cleanup_t = function(param: Pointer): apr_status_t; cdecl;
+ child_cleanup_t = function(param: Pointer): apr_status_t; cdecl;
+
+procedure apr_pool_cleanup_register(p: Papr_pool_t;
+ const data: Pointer;
+ plain_cleanup: plain_cleanup_t;
+ child_cleanup: child_cleanup_t);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_pool_cleanup_register' + LibSuff16;
+
+{
+ * Remove a previously registered cleanup function
+ * @param p The pool remove the cleanup from
+ * @param data The data to remove from cleanup
+ * @param cleanup The function to remove from cleanup
+ * @remarks For some strange reason only the plain_cleanup is handled by this
+ * function
+ }
+//procedure apr_pool_cleanup_for_exec;
+// {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+// external LibAPR name LibNamePrefix + 'apr_pool_cleanup_for_exec' + LibSuff0;
+
+//APR_DECLARE(void) apr_pool_cleanup_kill(apr_pool_t *p, const void *data,
+// apr_status_t cleanup)(void );
+
+{
+ * Replace the child cleanup of a previously registered cleanup
+ * @param p The pool of the registered cleanup
+ * @param data The data of the registered cleanup
+ * @param plain_cleanup The plain cleanup function of the registered cleanup
+ * @param child_cleanup The function to register as the child cleanup
+ }
+//procedure apr_pool_cleanup_for_exec;
+// {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+// external LibAPR name LibNamePrefix + 'apr_pool_cleanup_for_exec' + LibSuff0;
+
+{APR_DECLARE(void) apr_pool_child_cleanup_set(
+ apr_pool_t *p,
+ const void *data,
+ apr_status_t plain_cleanup)(void ,
+ apr_status_t child_cleanup)(void );
+}
+{
+ * Run the specified cleanup function immediately and unregister it.
+ *
+ * The cleanup most recently registered with @a p having the same values of
+ * @a data and @a cleanup will be removed and @a cleanup will be called
+ * with @a data as the argument.
+ *
+ * @param p The pool to remove the cleanup from
+ * @param data The data to remove from cleanup
+ * @param cleanup The function to remove from cleanup
+ }
+//procedure apr_pool_cleanup_for_exec;
+// {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+// external LibAPR name LibNamePrefix + 'apr_pool_cleanup_for_exec' + LibSuff0;
+
+{APR_DECLARE(apr_status_t) apr_pool_cleanup_run(
+ apr_pool_t *p,
+ void *data,
+ apr_status_t cleanup)(void );}
+
+{
+ * An empty cleanup function.
+ *
+ * Passed to apr_pool_cleanup_register() when no cleanup is required.
+ *
+ * @param data The data to cleanup, will not be used by this function.
+ }
+//APR_DECLARE_NONSTD(apr_status_t) apr_pool_cleanup_null(void *data);
+
+{
+ * Run all registered child cleanups, in preparation for an exec()
+ * call in a forked child -- close files, etc., but *don't* flush I/O
+ * buffers, *don't* wait for subprocesses, and *don't* free any
+ * memory.
+ }
+procedure apr_pool_cleanup_for_exec;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_pool_cleanup_for_exec' + LibSuff0;
+
+{
+ * @defgroup PoolDebug Pool Debugging functions.
+ *
+ * pools have nested lifetimes -- sub_pools are destroyed when the
+ * parent pool is cleared. We allow certain liberties with operations
+ * on things such as tables (and on other structures in a more general
+ * sense) where we allow the caller to insert values into a table which
+ * were not allocated from the table's pool. The table's data will
+ * remain valid as long as all the pools from which its values are
+ * allocated remain valid.
+ *
+ * For example, if B is a sub pool of A, and you build a table T in
+ * pool B, then it's safe to insert data allocated in A or B into T
+ * (because B lives at most as long as A does, and T is destroyed when
+ * B is cleared/destroyed). On the other hand, if S is a table in
+ * pool A, it is safe to insert data allocated in A into S, but it
+ * is *not safe* to insert data allocated from B into S... because
+ * B can be cleared/destroyed before A is (which would leave dangling
+ * pointers in T's data structures).
+ *
+ * In general we say that it is safe to insert data into a table T
+ * if the data is allocated in any ancestor of T's pool. This is the
+ * basis on which the APR_POOL_DEBUG code works -- it tests these ancestor
+ * relationships for all data inserted into tables. APR_POOL_DEBUG also
+ * provides tools (apr_pool_find, and apr_pool_is_ancestor) for other
+ * folks to implement similar restrictions for their own data
+ * structures.
+ *
+ * However, sometimes this ancestor requirement is inconvenient --
+ * sometimes it's necessary to create a sub pool where the sub pool is
+ * guaranteed to have the same lifetime as the parent pool. This is a
+ * guarantee implemented by the *caller*, not by the pool code. That
+ * is, the caller guarantees they won't destroy the sub pool
+ * individually prior to destroying the parent pool.
+ *
+ * In this case the caller must call apr_pool_join() to indicate this
+ * guarantee to the APR_POOL_DEBUG code.
+ *
+ * These functions are only implemented when #APR_POOL_DEBUG is set.
+ *
+ }
+{$if defined(APR_POOL_DEBUG) or defined(DOXYGEN)}
+{
+ * Guarantee that a subpool has the same lifetime as the parent.
+ * @param p The parent pool
+ * @param sub The subpool
+ }
+procedure apr_pool_join(p, sub: Papr_pool_t);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_pool_join' + LibSuff8;
+
+{
+ * Find a pool from something allocated in it.
+ * @param mem The thing allocated in the pool
+ * @return The pool it is allocated in
+ }
+function apr_pool_find(const mem: Pointer): Papr_pool_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_pool_find' + LibSuff4;
+
+{
+ * Report the number of bytes currently in the pool
+ * @param p The pool to inspect
+ * @param recurse Recurse/include the subpools' sizes
+ * @return The number of bytes
+ }
+function apr_pool_num_bytes(p: Papr_pool_t; recurse: Integer): apr_size_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_pool_num_bytes' + LibSuff8;
+
+{
+ * Lock a pool
+ * @param pool The pool to lock
+ * @param flag The flag
+ }
+procedure apr_pool_lock(pool: Papr_pool_t; flag: Integer);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_pool_lock' + LibSuff8;
+
+{$else} { APR_POOL_DEBUG or DOXYGEN }
+
+{#ifdef apr_pool_join
+#undef apr_pool_join
+#endif
+#define apr_pool_join(a,b)
+
+#ifdef apr_pool_lock
+#undef apr_pool_lock
+#endif
+#define apr_pool_lock(pool, lock)}
+
+{$endif} { APR_POOL_DEBUG or DOXYGEN }
+
diff --git a/packages/httpd22/src/apr/apr_portable.inc b/packages/httpd22/src/apr/apr_portable.inc
new file mode 100644
index 0000000000..b8bc09c9ca
--- /dev/null
+++ b/packages/httpd22/src/apr/apr_portable.inc
@@ -0,0 +1,538 @@
+{ Copyright 2000-2005 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed 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.
+ }
+
+{ This header file is where you should put ANY platform specific information.
+ * This should be the only header file that programs need to include that
+ * actually has platform dependant code which refers to the .
+ }
+
+{
+ * @file apr_portable.h
+ * @brief APR Portability Routines
+ }
+
+{#include "apr.h"
+#include "apr_pools.h"
+#include "apr_thread_proc.h"
+#include "apr_file_io.h"
+#include "apr_network_io.h"
+#include "apr_errno.h"
+#include "apr_global_mutex.h"
+#include "apr_proc_mutex.h"
+#include "apr_time.h"
+#include "apr_dso.h"
+#include "apr_shm.h"
+
+#if APR_HAVE_DIRENT_H
+#include <dirent.h>
+#endif
+#if APR_HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
+#if APR_HAVE_PTHREAD_H
+#include <pthread.h>
+#endif}
+
+{
+ * @defgroup apr_portabile Portability Routines
+ * @ingroup APR
+ }
+
+
+
+type
+
+{$ifdef WINDOWS}
+{ The primitives for Windows types }
+ apr_os_file_t = THandle;
+ apr_os_dir_t = THandle;
+ apr_os_sock_t = TSocket;
+ apr_os_proc_mutex_t = THandle;
+ apr_os_thread_t = THandle;
+ apr_os_proc_t = THandle;
+ apr_os_threadkey_t = Cardinal;
+ apr_os_imp_time_t = TFILETIME;
+ apr_os_exp_time_t = TSYSTEMTIME;
+ apr_os_dso_handle_t = THandle;
+ apr_os_shm_t = THandle;
+
+{$else}
+{$ifdef OS2}
+ HFILE apr_os_file_t;
+ HDIR apr_os_dir_t;
+ int apr_os_sock_t;
+ HMTX apr_os_proc_mutex_t;
+ TID apr_os_thread_t;
+ PID apr_os_proc_t;
+ PULONG apr_os_threadkey_t;
+ struct timeval apr_os_imp_time_t;
+ struct tm apr_os_exp_time_t;
+ HMODULE apr_os_dso_handle_t;
+ apr_os_shm_t: Pointer;
+
+{$else}
+{$ifdef BEOS}
+
+#include <kernel/OS.h>
+#include <kernel/image.h>
+
+ apr_os_proc_mutex_t = record
+ sem_id sem;
+ int32 ben;
+ end;
+
+ apr_os_file_t: cint;
+ DIR apr_os_dir_t;
+ apr_os_sock_t: cint;
+ struct apr_os_proc_mutex_t apr_os_proc_mutex_t;
+ thread_id apr_os_thread_t;
+ thread_id apr_os_proc_t;
+ apr_os_threadkey_t: cint;
+ struct timeval apr_os_imp_time_t;
+ struct tm apr_os_exp_time_t;
+ image_id apr_os_dso_handle_t;
+ apr_os_shm_t: Pointer;
+
+{$else}
+{$ifdef NETWARE}
+ apr_os_file_t: cint;
+ DIR apr_os_dir_t;
+ apr_os_sock_t: cint;
+ NXMutex_t apr_os_proc_mutex_t;
+ NXThreadId_t apr_os_thread_t;
+ long apr_os_proc_t;
+ NXKey_t apr_os_threadkey_t;
+ struct timeval apr_os_imp_time_t;
+ struct tm apr_os_exp_time_t;
+ apr_os_dso_handle_t: Pointer;
+ apr_os_shm_t: Pointer;
+
+{$else}
+{ Any other OS should go above this one. This is the lowest common
+ * denominator typedefs for all UNIX-like systems. :)
+ }
+
+{ Basic OS process mutex structure. }
+ apr_os_proc_mutex_t = record
+{$if defined(APR_HAS_SYSVSEM_SERIALIZE) or defined(APR_HAS_FCNTL_SERIALIZE) or defined(APR_HAS_FLOCK_SERIALIZE)}
+ crossproc: Integer;
+{$endif}
+{$ifdef APR_HAS_PROC_PTHREAD_SERIALIZE}
+ pthread_mutex_t *pthread_interproc;
+{$endif}
+{$ifdef APR_HAS_THREADS}
+ { If no threads, no need for thread locks }
+{$if APR_USE_PTHREAD_SERIALIZE}
+ pthread_mutex_t *intraproc;
+{$endif}
+{$endif}
+ end;
+
+ apr_os_file_t: Integer; {< native file }
+typedef DIR apr_os_dir_t; {< native dir }
+ apr_os_sock_t: Integer; {< native dir }
+typedef struct apr_os_proc_mutex_t apr_os_proc_mutex_t; {< native proces
+ * mutex
+ }
+{$if defined(APR_HAS_THREADS) and defined(APR_HAVE_PTHREAD_H)}
+typedef pthread_t apr_os_thread_t; {< native thread }
+typedef pthread_key_t apr_os_threadkey_t; {< native thread address
+ * space }
+{$endif}
+typedef pid_t apr_os_proc_t; {< native pid }
+typedef struct timeval apr_os_imp_time_t; {< native timeval }
+typedef struct tm apr_os_exp_time_t; {< native tm }
+{ @var apr_os_dso_handle_t
+ * native dso types
+ }
+{$ifdef HPUX}
+#include <dl.h>
+typedef shl_t apr_os_dso_handle_t;
+{$else}
+{$ifdef DARWIN}
+#include <mach-o/dyld.h>
+typedef NSModule apr_os_dso_handle_t;
+{$else}
+typedef void * apr_os_dso_handle_t;
+{$endif}
+{$endif}
+typedef void* apr_os_shm_t; {< native SHM }
+
+{$endif}
+{$endif}
+{$endif}
+{$endif}
+
+ Papr_os_sock_t = ^apr_os_sock_t;
+
+{
+ * @typedef apr_os_sock_info_t
+ * @brief alias for local OS socket
+ }
+{
+ * everything APR needs to know about an active socket to construct
+ * an APR socket from it; currently, this is platform-independent
+ }
+ apr_os_sock_info_t = record
+ os_sock: Papr_os_sock_t; {< always required }
+ local: Psockaddr; {< NULL if not yet bound }
+ remote: Psockaddr; {< NULL if not connected }
+ family: Integer; {< always required (APR_INET, APR_INET6, etc.) }
+ type_: Integer; {< always required (SOCK_STREAM, SOCK_DGRAM, etc.) }
+ protocol: Integer; {< 0 or actual protocol (APR_PROTO_SCTP, APR_PROTO_TCP, etc.) }
+ end;
+
+ Papr_os_sock_info_t = ^apr_os_sock_info_t;
+
+{$if defined(APR_PROC_MUTEX_IS_GLOBAL) or defined(DOXYGEN)}
+{ Opaque global mutex type }
+#define apr_os_global_mutex_t apr_os_proc_mutex_t
+{ @return apr_os_global_mutex }
+#define apr_os_global_mutex_get apr_os_proc_mutex_get
+{$else}
+ { Thread and process mutex for those platforms where process mutexes
+ * are not held in threads.
+ }
+ apr_os_global_mutex_t = record
+ pool: Papr_pool_t;
+ proc_mutex: Papr_proc_mutex_t;
+#if APR_HAS_THREADS
+ thread_mutex: Papr_proc_mutex_t;
+#endif { APR_HAS_THREADS }
+ end;
+ Papr_os_global_mutex_t = ^apr_os_global_mutex_t;
+
+APR_DECLARE(apr_status_t) apr_os_global_mutex_get(apr_os_global_mutex_t *ospmutex,
+ apr_global_mutex_t *pmutex);
+{$endif}
+
+
+{
+ * convert the file from apr type to os specific type.
+ * @param thefile The os specific file we are converting to
+ * @param file The apr file to convert.
+ * @remark On Unix, it is only possible to get a file descriptor from
+ * an apr file type.
+ }
+function apr_os_file_get(thefile, file_: Papr_os_file_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_os_file_get' + LibSuff8;
+
+{
+ * convert the dir from apr type to os specific type.
+ * @param thedir The os specific dir we are converting to
+ * @param dir The apr dir to convert.
+ }
+function apr_os_dir_get(thedir: PPapr_os_dir_t; dir: Papr_dir_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_os_dir_get' + LibSuff8;
+
+{
+ * Convert the socket from an apr type to an OS specific socket
+ * @param thesock The socket to convert.
+ * @param sock The os specifc equivelant of the apr socket..
+ }
+function apr_os_sock_get(thesock, sock: Papr_os_sock_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_os_sock_get' + LibSuff8;
+
+{
+ * Convert the proc mutex from os specific type to apr type
+ * @param ospmutex The os specific proc mutex we are converting to.
+ * @param pmutex The apr proc mutex to convert.
+ }
+function apr_os_proc_mutex_get(ospmutex: Papr_os_proc_mutex_t;
+ pmutex: Papr_proc_mutex_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_os_proc_mutex_get' + LibSuff8;
+
+{
+ * Get the exploded time in the platforms native format.
+ * @param ostime the native time format
+ * @param aprtime the time to convert
+ }
+function apr_os_exp_time_get(ostime: PPapr_os_exp_time_t;
+ aprtime: Papr_time_exp_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_os_exp_time_get' + LibSuff8;
+
+{
+ * Get the imploded time in the platforms native format.
+ * @param ostime the native time format
+ * @param aprtime the time to convert
+ }
+function apr_os_imp_time_get(ostime: PPapr_os_imp_time_t;
+ aprtime: Papr_time_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_os_imp_time_get' + LibSuff8;
+
+{
+ * convert the shm from apr type to os specific type.
+ * @param osshm The os specific shm representation
+ * @param shm The apr shm to convert.
+ }
+function apr_os_shm_get(osshm: Papr_os_shm_t; shm: Papr_shm_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_os_shm_get' + LibSuff8;
+
+{$if defined(APR_HAS_THREADS) or defined(DOXYGEN)}
+{
+ * @defgroup apr_os_thread Thread portability Routines
+ }
+{
+ * convert the thread to os specific type from apr type.
+ * @param thethd The apr thread to convert
+ * @param thd The os specific thread we are converting to
+ }
+function apr_os_thread_get(thethd: PPapr_os_thread_t;
+ thd: Papr_thread_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_os_thread_get' + LibSuff8;
+
+{
+ * convert the thread private memory key to os specific type from an apr type.
+ * @param thekey The apr handle we are converting from.
+ * @param key The os specific handle we are converting to.
+ }
+function apr_os_threadkey_get(thekey: Papr_os_threadkey_t;
+ key: Papr_threadkey_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_os_threadkey_get' + LibSuff8;
+
+{
+ * convert the thread from os specific type to apr type.
+ * @param thd The apr thread we are converting to.
+ * @param thethd The os specific thread to convert
+ * @param cont The pool to use if it is needed.
+ }
+function apr_os_thread_put(thd: PPapr_thread_t;
+ thethd: Papr_os_thread_t; cont: Papr_pool_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_os_thread_put' + LibSuff12;
+
+{
+ * convert the thread private memory key from os specific type to apr type.
+ * @param key The apr handle we are converting to.
+ * @param thekey The os specific handle to convert
+ * @param cont The pool to use if it is needed.
+ }
+function apr_os_threadkey_put(key: PPapr_threadkey_t;
+ thekey: Papr_os_threadkey_t; cont: Papr_pool_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_os_threadkey_put' + LibSuff12;
+
+{
+ * Get the thread ID
+ }
+function apr_os_thread_current: apr_os_thread_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_os_thread_current' + LibSuff0;
+
+{
+ * Compare two thread id's
+ * @param tid1 1st Thread ID to compare
+ * @param tid2 2nd Thread ID to compare
+ }
+function apr_os_thread_equal(tid1, tid2: apr_os_thread_t): Integer;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_os_thread_equal' + LibSuff8;
+
+{$endif} { APR_HAS_THREADS }
+
+{
+ * convert the file from os specific type to apr type.
+ * @param file The apr file we are converting to.
+ * @param thefile The os specific file to convert
+ * @param flags The flags that were used to open this file.
+ * @param cont The pool to use if it is needed.
+ * @remark On Unix, it is only possible to put a file descriptor into
+ * an apr file type.
+ }
+function apr_os_file_put(file_: PPapr_file_t;
+ pthefilemutex: Papr_os_file_t; flags: apr_int32_t; cont: Papr_pool_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_os_file_put' + LibSuff16;
+
+{
+ * convert the file from os specific type to apr type.
+ * @param file The apr file we are converting to.
+ * @param thefile The os specific pipe to convert
+ * @param cont The pool to use if it is needed.
+ * @remark On Unix, it is only possible to put a file descriptor into
+ * an apr file type.
+ }
+function apr_os_pipe_put(file_: PPapr_file_t;
+ thefile: Papr_os_file_t; cont: Papr_pool_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_os_pipe_put' + LibSuff12;
+
+{
+ * convert the file from os specific type to apr type.
+ * @param file The apr file we are converting to.
+ * @param thefile The os specific pipe to convert
+ * @param register_cleanup A cleanup will be registered on the apr_file_t
+ * to issue apr_file_close().
+ * @param cont The pool to use if it is needed.
+ * @remark On Unix, it is only possible to put a file descriptor into
+ * an apr file type.
+ }
+function apr_os_pipe_put_ex(file_: PPapr_file_t;
+ thefile: Papr_os_file_t; register_cleanup: Integer;
+ cont: Papr_pool_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_os_pipe_put_ex' + LibSuff16;
+
+{
+ * convert the dir from os specific type to apr type.
+ * @param dir The apr dir we are converting to.
+ * @param thedir The os specific dir to convert
+ * @param cont The pool to use when creating to apr directory.
+ }
+function apr_os_dir_put(dir: PPapr_dir_t; thedir: Papr_os_dir_t;
+ cont: Papr_pool_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_os_dir_put' + LibSuff12;
+
+{
+ * Convert a socket from the os specific type to the apr type
+ * @param sock The pool to use.
+ * @param thesock The socket to convert to.
+ * @param cont The socket we are converting to an apr type.
+ * @remark If it is a true socket, it is best to call apr_os_sock_make()
+ * and provide APR with more information about the socket.
+ }
+function apr_os_sock_put(sock: PPapr_socket_t; thesock: Papr_socket_t;
+ cont: Papr_pool_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_os_sock_put' + LibSuff8;
+
+{
+ * Create a socket from an existing descriptor and local and remote
+ * socket addresses.
+ * @param apr_sock The new socket that has been set up
+ * @param os_sock_info The os representation of the socket handle and
+ * other characteristics of the socket
+ * @param cont The pool to use
+ * @remark If you only know the descriptor/handle or if it isn't really
+ * a true socket, use apr_os_sock_put() instead.
+ }
+function apr_os_sock_make(apr_sock: PPapr_socket_t;
+ os_sock_info: Papr_os_sock_info_t; cont: Papr_pool_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_os_sock_make' + LibSuff12;
+
+{
+ * Convert the proc mutex from os specific type to apr type
+ * @param pmutex The apr proc mutex we are converting to.
+ * @param ospmutex The os specific proc mutex to convert.
+ * @param cont The pool to use if it is needed.
+ }
+function apr_os_proc_mutex_put(pmutex: PPapr_proc_mutex_t;
+ ospmutex: Papr_os_proc_mutex_t; cont: Papr_pool_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_os_proc_mutex_put' + LibSuff12;
+
+{
+ * Put the imploded time in the APR format.
+ * @param aprtime the APR time format
+ * @param ostime the time to convert
+ * @param cont the pool to use if necessary
+ }
+function apr_os_imp_time_put(aprtime: Papr_time_t;
+ ostime: PPapr_os_imp_time_t; cont: Papr_pool_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_os_imp_time_put' + LibSuff12;
+
+{
+ * Put the exploded time in the APR format.
+ * @param aprtime the APR time format
+ * @param ostime the time to convert
+ * @param cont the pool to use if necessary
+ }
+function apr_os_exp_time_put(aprtime: Papr_time_exp_t;
+ ostime: PPapr_os_exp_time_t; cont: Papr_pool_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_os_exp_time_put' + LibSuff12;
+
+{
+ * convert the shared memory from os specific type to apr type.
+ * @param shm The apr shm representation of osshm
+ * @param osshm The os specific shm identity
+ * @param cont The pool to use if it is needed.
+ * @remark On fork()ed architectures, this is typically nothing more than
+ * the memory block mapped. On non-fork architectures, this is typically
+ * some internal handle to pass the mapping from process to process.
+ }
+function apr_os_shm_put(shm: PPapr_shm_t; osshm: Papr_os_shm_t;
+ cont: Papr_pool_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_os_shm_put' + LibSuff8;
+
+{$if defined(APR_HAS_DSO) or defined(DOXYGEN)}
+{
+ * @defgroup apr_os_dso DSO (Dynamic Loading) Portabiliity Routines
+ }
+{
+ * convert the dso handle from os specific to apr
+ * @param dso The apr handle we are converting to
+ * @param thedso the os specific handle to convert
+ * @param pool the pool to use if it is needed
+ }
+function apr_os_dso_handle_put(dso: PPapr_dso_handle_t;
+ thedso: apr_os_dso_handle_t; pool: Papr_pool_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_os_dso_handle_put' + LibSuff12;
+
+{
+ * convert the apr dso handle into an os specific one
+ * @param aprdso The apr dso handle to convert
+ * @param dso The os specific dso to return
+ }
+function apr_os_dso_handle_get(dso: Papr_os_dso_handle_t;
+ aprdso: Papr_dso_handle_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_os_dso_handle_get' + LibSuff8;
+
+{$ifdef APR_HAS_OS_UUID}
+{
+ * Private: apr-util's apr_uuid module when supported by the platform
+ }
+function apr_os_uuid_get(uuid_data: PChar): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_os_uuid_get' + LibSuff8;
+{$endif}
+
+{$endif} { APR_HAS_DSO }
+
+
+{
+ * Get the name of the system default characer set.
+ * @param pool the pool to allocate the name from, if needed
+ }
+function apr_os_default_encoding(pool: Papr_pool_t): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_os_default_encoding' + LibSuff4;
+
+{
+ * Get the name of the current locale character set.
+ * @param pool the pool to allocate the name from, if needed
+ * @remark Defers to apr_os_default_encoding if the current locale's
+ * data can't be retreved on this system.
+ }
+function apr_os_locale_encoding(pool: Papr_pool_t): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_os_locale_encoding' + LibSuff4;
+
diff --git a/packages/httpd22/src/apr/apr_signal.inc b/packages/httpd22/src/apr/apr_signal.inc
new file mode 100644
index 0000000000..bf9920383d
--- /dev/null
+++ b/packages/httpd22/src/apr/apr_signal.inc
@@ -0,0 +1,103 @@
+{ Copyright 2000-2005 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed 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.
+ }
+
+{
+ * @file apr_signal.h
+ * @brief APR Signal Handling
+ }
+
+{#include "apr.h"
+#include "apr_pools.h"
+
+#if APR_HAVE_SIGNAL_H
+#include <signal.h>
+#endif}
+
+{
+ * @defgroup apr_signal Handling
+ * @ingroup APR
+ }
+
+{$if defined(APR_HAVE_SIGACTION) or defined(DOXYGEN)}
+
+{$ifdef DARWIN}
+{ work around Darwin header file bugs
+ * http://www.opensource.apple.com/bugs/X/BSD%20Kernel/2657228.html
+ }
+#undef SIG_DFL
+#undef SIG_IGN
+#undef SIG_ERR
+#define SIG_DFL (void ( *)(int))0
+#define SIG_IGN (void ( *)(int))1
+#define SIG_ERR (void ( *)(int))-1
+{$endif}
+
+{ Function prototype for signal handlers }
+type apr_sigfunc_t = procedure(para: cint);
+
+{
+ * Set the signal handler function for a given signal
+ * @param signo The signal (eg... SIGWINCH)
+ * @param func the function to get called
+ }
+function apr_signal(signo: Integer; func: apr_sigfunc_t): Papr_sigfunc_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_signal' + LibSuff8;
+
+{if defined(SIG_IGN) && !defined(SIG_ERR)
+#define SIG_ERR ((apr_sigfunc_t *) -1)
+#endif
+
+#else} { !APR_HAVE_SIGACTION }
+{#define apr_signal(a, b) signal(a, b)
+#endif}
+
+
+{
+ * Get the description for a specific signal number
+ * @param signum The signal number
+ * @return The description of the signal
+ }
+function apr_signal_description_get(signo: Integer): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_signal_description_get' + LibSuff4;
+
+{
+ * APR-private function for initializing the signal package
+ * @internal
+ * @param pglobal The internal, global pool
+ }
+//void apr_signal_init(apr_pool_t *pglobal);
+
+{
+ * Block the delivery of a particular signal
+ * @param signum The signal number
+ * @return status
+ }
+function apr_signal_block(signum: Integer): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_signal_block' + LibSuff4;
+
+{
+ * Enable the delivery of a particular signal
+ * @param signum The signal number
+ * @return status
+ }
+function apr_signal_unblock(signum: Integer): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_signal_unblock' + LibSuff4;
+
+{$endif}
diff --git a/packages/httpd22/src/apr/apr_strings.inc b/packages/httpd22/src/apr/apr_strings.inc
new file mode 100644
index 0000000000..7acd0cf91d
--- /dev/null
+++ b/packages/httpd22/src/apr/apr_strings.inc
@@ -0,0 +1,379 @@
+{ Copyright 2000-2005 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed 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.
+ }
+
+{ Portions of this file are covered by }
+{ -*- mode: c; c-file-style: "k&r" -*-
+
+ strnatcmp.c -- Perform 'natural order' comparisons of strings in C.
+ Copyright (C) 2000 by Martin Pool <mbp@humbug.org.au>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+}
+
+{
+ * @file apr_strings.h
+ * @brief APR Strings library
+ }
+
+{#include "apr.h"
+#include "apr_errno.h"
+#include "apr_pools.h"
+#define APR_WANT_IOVEC
+#include "apr_want.h"
+
+#if APR_HAVE_STDARG_H
+#include <stdarg.h>
+#endif}
+
+{
+ * @defgroup apr_strings String routines
+ * @ingroup APR
+ }
+
+{
+ * Do a natural order comparison of two strings.
+ * @param a The first string to compare
+ * @param b The second string to compare
+ * @return Either <0, 0, or >0. If the first string is less than the second
+ * this returns <0, if they are equivalent it returns 0, and if the
+ * first string is greater than second string it retuns >0.
+ }
+function apr_strnatcmp(a, b: PChar): Integer;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_strnatcmp' + LibSuff8;
+
+{
+ * Do a natural order comparison of two strings ignoring the case of the
+ * strings.
+ * @param a The first string to compare
+ * @param b The second string to compare
+ * @return Either <0, 0, or >0. If the first string is less than the second
+ * this returns <0, if they are equivalent it returns 0, and if the
+ * first string is greater than second string it retuns >0.
+ }
+function apr_strnatcasecmp(a, b: PChar): Integer;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_strnatcasecmp' + LibSuff8;
+
+{
+ * duplicate a string into memory allocated out of a pool
+ * @param p The pool to allocate out of
+ * @param s The string to duplicate
+ * @return The new string
+ }
+function apr_pstrdup(p: Papr_pool_t; s: PChar): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_pstrdup' + LibSuff8;
+
+{
+ * Create a null-terminated string by making a copy of a sequence
+ * of characters and appending a null byte
+ * @param p The pool to allocate out of
+ * @param s The block of characters to duplicate
+ * @param n The number of characters to duplicate
+ * @return The new string
+ * @remark This is a faster alternative to apr_pstrndup, for use
+ * when you know that the string being duplicated really
+ * has 'n' or more characters. If the string might contain
+ * fewer characters, use apr_pstrndup.
+ }
+function apr_pstrmemdup(p: Papr_pool_t; s: PChar; n: apr_size_t): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_pstrmemdup' + LibSuff12;
+
+{
+ * duplicate the first n characters of a string into memory allocated
+ * out of a pool; the new string will be null-terminated
+ * @param p The pool to allocate out of
+ * @param s The string to duplicate
+ * @param n The number of characters to duplicate
+ * @return The new string
+ }
+function apr_pstrndup(p: Papr_pool_t; s: PChar; n: apr_size_t): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_pstrndup' + LibSuff12;
+
+{
+ * Duplicate a block of memory.
+ *
+ * @param p The pool to allocate from
+ * @param m The memory to duplicate
+ * @param n The number of bytes to duplicate
+ * @return The new block of memory
+ }
+function apr_pmemdup(p: Papr_pool_t; m: Pointer; n: apr_size_t): Pointer;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_pmemdup' + LibSuff12;
+
+{
+ * Concatenate multiple strings, allocating memory out a pool
+ * @param p The pool to allocate out of
+ * @param ... The strings to concatenate. The final string must be NULL
+ * @return The new string
+ }
+function apr_pstrcat(p: Papr_pool_t; others: array of const): PChar;
+ cdecl; external LibAPR name 'apr_pstrcat';
+
+{
+ * Concatenate multiple strings specified in a writev-style vector
+ * @param p The pool from which to allocate
+ * @param vec The strings to concatenate
+ * @param nvec The number of strings to concatenate
+ * @param nbytes (output) strlen of new string (pass in NULL to omit)
+ * @return The new string
+ }
+function apr_pstrcatv(p: Papr_pool_t; const vec: Piovec;
+ nvec: apr_size_t; nbytes: Papr_size_t): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_pstrcatv' + LibSuff16;
+
+{
+ * printf-style style printing routine. The data is output to a string
+ * allocated from a pool
+ * @param p The pool to allocate out of
+ * @param fmt The format of the string
+ * @param ap The arguments to use while printing the data
+ * @return The new string
+ }
+function apr_pvsprintf(p: Papr_pool_t; const fmt: PChar; ap: va_list): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_pvsprintf' + LibSuff12;
+
+{
+ * printf-style style printing routine. The data is output to a string
+ * allocated from a pool
+ * @param p The pool to allocate out of
+ * @param fmt The format of the string
+ * @param ... The arguments to use while printing the data
+ * @return The new string
+ }
+function apr_psprintf(p: Papr_pool_t; const fmt: PChar; others: array of const): PChar;
+ cdecl; external LibAPR name 'apr_psprintf';
+
+{
+ * Copy up to dst_size characters from src to dst; does not copy
+ * past a NUL terminator in src, but always terminates dst with a NUL
+ * regardless.
+ * @param dst The destination string
+ * @param src The source string
+ * @param dst_size The space available in dst; dst always receives
+ * NUL termination, so if src is longer than
+ * dst_size, the actual number of characters copied is
+ * dst_size - 1.
+ * @return Pointer to the NUL terminator of the destination string, dst
+ * @remark
+ * <PRE>
+ * Note the differences between this function and strncpy():
+ * 1) strncpy() doesn't always NUL terminate; apr_cpystrn() does.
+ * 2) strncpy() pads the destination string with NULs, which is often
+ * unnecessary; apr_cpystrn() does not.
+ * 3) strncpy() returns a pointer to the beginning of the dst string;
+ * apr_cpystrn() returns a pointer to the NUL terminator of dst,
+ * to allow a check for truncation.
+ * </PRE>
+ }
+function apr_cpystrn(dst: PChar; const src: PChar;
+ dst_size: apr_size_t): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_cpystrn' + LibSuff12;
+
+{
+ * Strip spaces from a string
+ * @param dest The destination string. It is okay to modify the string
+ * in place. Namely dest == src
+ * @param src The string to rid the spaces from.
+ }
+function apr_collapse_spaces(dst: PChar; const src: PChar): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_collapse_spaces' + LibSuff8;
+
+{
+ * Convert the arguments to a program from one string to an array of
+ * strings terminated by a NULL pointer
+ * @param arg_str The arguments to convert
+ * @param argv_out Output location. This is a pointer to an array of strings.
+ * @param token_context Pool to use.
+ }
+function apr_tokenize_to_argv(const arg_str: PChar;
+ var argv_out: PPChar; token_context: Papr_pool_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_tokenize_to_argv' + LibSuff12;
+
+{
+ * Split a string into separate null-terminated tokens. The tokens are
+ * delimited in the string by one or more characters from the sep
+ * argument.
+ * @param str The string to separate; this should be specified on the
+ * first call to apr_strtok() for a given string, and NULL
+ * on subsequent calls.
+ * @param sep The set of delimiters
+ * @param last Internal state saved by apr_strtok() between calls.
+ * @return The next token from the string
+ }
+function apr_strtok(str: PChar;
+ const sep: PChar; last: PPChar): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_strtok' + LibSuff12;
+
+{
+ * @defgroup APR_Strings_Snprintf snprintf implementations
+ * @warning
+ * These are snprintf implementations based on apr_vformatter().
+ *
+ * Note that various standards and implementations disagree on the return
+ * value of snprintf, and side-effects due to %n in the formatting string.
+ * apr_snprintf (and apr_vsnprintf) behaves as follows:
+ *
+ * Process the format string until the entire string is exhausted, or
+ * the buffer fills. If the buffer fills then stop processing immediately
+ * (so no further %n arguments are processed), and return the buffer
+ * length. In all cases the buffer is NUL terminated. It will return the
+ * number of characters inserted into the buffer, not including the
+ * terminating NUL. As a special case, if len is 0, apr_snprintf will
+ * return the number of characters that would have been inserted if
+ * the buffer had been infinite (in this case, *buffer can be NULL)
+ *
+ * In no event does apr_snprintf return a negative number.
+ }
+
+{
+ * snprintf routine based on apr_vformatter. This means it understands the
+ * same extensions.
+ * @param buf The buffer to write to
+ * @param len The size of the buffer
+ * @param format The format string
+ * @param ... The arguments to use to fill out the format string.
+ }
+function apr_snprintf(buf: PChar; len: apr_size_t;
+ const format: PChar; others: array of const): PChar;
+ cdecl; external LibAPR name 'apr_snprintf';
+
+{
+ * vsnprintf routine based on apr_vformatter. This means it understands the
+ * same extensions.
+ * @param buf The buffer to write to
+ * @param len The size of the buffer
+ * @param format The format string
+ * @param ap The arguments to use to fill out the format string.
+ }
+function apr_vsnprintf(buf: PChar; len: apr_size_t;
+ const format: PChar; ap: va_list): Integer;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_vsnprintf' + LibSuff16;
+
+{
+ * create a string representation of an int, allocated from a pool
+ * @param p The pool from which to allocate
+ * @param n The number to format
+ * @return The string representation of the number
+ }
+function apr_itoa(p: Papr_pool_t; n: Integer): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_itoa' + LibSuff8;
+
+{
+ * create a string representation of a long, allocated from a pool
+ * @param p The pool from which to allocate
+ * @param n The number to format
+ * @return The string representation of the number
+ }
+function apr_ltoa(p: Papr_pool_t; n: Integer): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_ltoa' + LibSuff8;
+
+{
+ * create a string representation of an apr_off_t, allocated from a pool
+ * @param p The pool from which to allocate
+ * @param n The number to format
+ * @return The string representation of the number
+ }
+function apr_off_t_toa(p: Papr_pool_t; n: apr_off_t): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_off_t_toa' + LibSuff12;
+
+{
+ * Convert a numeric string into an apr_off_t numeric value.
+ * @param offset The value of the parsed string.
+ * @param buf The string to parse. It may contain optional whitespace,
+ * followed by an optional '+' (positive, default) or '-' (negative)
+ * character, followed by an optional '0x' prefix if base is 0 or 16,
+ * followed by numeric digits appropriate for base.
+ * @param end A pointer to the end of the valid character in buf. If
+ * not NULL, it is set to the first invalid character in buf.
+ * @param base A numeric base in the range between 2 and 36 inclusive,
+ * or 0. If base is zero, buf will be treated as base ten unless its
+ * digits are prefixed with '0x', in which case it will be treated as
+ * base 16.
+ }
+function apr_strtoff(offset: Papr_off_t;
+ const buf: PChar; end_: PPChar; base: cint): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_strtoff' + LibSuff16;
+
+{
+ * parse a numeric string into a 64-bit numeric value
+ * @param buf The string to parse. It may contain optional whitespace,
+ * followed by an optional '+' (positive, default) or '-' (negative)
+ * character, followed by an optional '0x' prefix if base is 0 or 16,
+ * followed by numeric digits appropriate for base.
+ * @param end A pointer to the end of the valid character in buf. If
+ * not nil, it is set to the first invalid character in buf.
+ * @param base A numeric base in the range between 2 and 36 inclusive,
+ * or 0. If base is zero, buf will be treated as base ten unless its
+ * digits are prefixed with '0x', in which case it will be treated as
+ * base 16.
+ * @return The numeric value of the string.
+ }
+function apr_strtoi64(const buf: PChar; end_: PPChar; base: Integer): apr_int64_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_strtoi64' + LibSuff12;
+
+{
+ * parse a base-10 numeric string into a 64-bit numeric value.
+ * Equivalent to apr_strtoi64(buf, (char**)NULL, 10).
+ * @param buf The string to parse
+ * @return The numeric value of the string
+ }
+function apr_atoi64(const buf: PChar): apr_int64_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_atoi64' + LibSuff4;
+
+{
+ * Format a binary size (magnitiudes are 2^10 rather than 10^3) from an apr_off_t,
+ * as bytes, K, M, T, etc, to a four character compacted human readable string.
+ * @param size The size to format
+ * @param buf The 5 byte text buffer (counting the trailing null)
+ * @return The buf passed to apr_strfsize()
+ * @remark All negative sizes report ' - ', apr_strfsize only formats positive values.
+ }
+function apr_strfsize(size: apr_off_t; buf: PChar): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_strfsize' + LibSuff12;
+
diff --git a/packages/httpd22/src/apr/apr_tables.inc b/packages/httpd22/src/apr/apr_tables.inc
new file mode 100644
index 0000000000..4035d322c0
--- /dev/null
+++ b/packages/httpd22/src/apr/apr_tables.inc
@@ -0,0 +1,447 @@
+{ Copyright 2000-2005 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed 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.
+ }
+
+{
+ * @file apr_tables.h
+ * @brief APR Table library
+ }
+
+{
+ * @defgroup apr_tables Table and Array Functions
+ * @ingroup APR
+ * Tables are used to store entirely opaque structures
+ * for applications, while Arrays are usually used to
+ * deal with string lists.
+ }
+
+{ the table abstract data type }
+type
+ apr_table_t = record end;
+ Papr_table_t = ^apr_table_t;
+
+{ An opaque array type }
+ apr_array_header_t = record
+ { The pool the array is allocated out of }
+ pool: Papr_pool_t;
+ { The amount of memory allocated for each element of the array }
+ elt_size: Integer;
+ { The number of active elements in the array }
+ nelts: Integer;
+ { The number of elements allocated in the array }
+ nalloc: Integer;
+ { The elements in the array }
+ elts: PChar;
+ end;
+ Papr_array_header_t = ^apr_array_header_t;
+ PPapr_array_header_t = ^Papr_array_header_t;
+
+{
+ * The (opaque) structure for string-content tables.
+ }
+
+{ The type for each entry in a string-content table }
+ apr_table_entry_t = record
+ { The key for the current table entry }
+ key: PChar; { maybe NULL in future;
+ * check when iterating thru table_elts
+ }
+ { The value for the current table entry }
+ val: PChar;
+
+ { A checksum for the key, for use by the apr_table internals }
+ key_checksum: apr_uint32_t;
+ end;
+
+{
+ * Get the elements from a table
+ * @param t The table
+ * @return An array containing the contents of the table
+ }
+function apr_table_elts(const t: Papr_table_t): Papr_array_header_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_table_elts' + LibSuff4;
+
+{
+ * Determine if the table is empty
+ * @param t The table to check
+ * @return True if empty, False otherwise
+ }
+function apr_is_empty_table(const t: Papr_table_t): Integer;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_is_empty_table' + LibSuff4;
+
+{
+ * Determine if the array is empty
+ * @param a The array to check
+ * @return True if empty, False otherwise
+ }
+function apr_is_empty_array(const a: Papr_array_header_t): Integer;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_is_empty_array' + LibSuff4;
+
+{
+ * Create an array
+ * @param p The pool to allocate the memory out of
+ * @param nelts the number of elements in the initial array
+ * @param elt_size The size of each element in the array.
+ * @return The new array
+ }
+function apr_array_make(p: Papr_pool_t;
+ nelts, elt_size: Integer): Papr_array_header_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_array_make' + LibSuff12;
+
+{
+ * Add a new element to an array (as a first-in, last-out stack)
+ * @param arr The array to add an element to.
+ * @return Location for the new element in the array.
+ * @remark If there are no free spots in the array, then this function will
+ * allocate new space for the new element.
+ }
+function apr_array_push(arr: Papr_array_header_t): Pointer;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_array_push' + LibSuff4;
+
+{
+ * Remove an element from an array (as a first-in, last-out stack)
+ * @param arr The array to remove an element from.
+ * @return Location of the element in the array.
+ * @remark If there are no elements in the array, NULL is returned.
+ }
+function apr_array_pop(arr: Papr_array_header_t): Pointer;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_array_pop' + LibSuff4;
+
+{
+ * Concatenate two arrays together
+ * @param dst The destination array, and the one to go first in the combined
+ * array
+ * @param src The source array to add to the destination array
+ }
+procedure apr_array_cat(dst: Papr_array_header_t;
+ const src: Papr_array_header_t);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_array_cat' + LibSuff8;
+
+{
+ * Copy the entire array
+ * @param p The pool to allocate the copy of the array out of
+ * @param arr The array to copy
+ * @return An exact copy of the array passed in
+ * @remark The alternate apr_array_copy_hdr copies only the header, and arranges
+ * for the elements to be copied if (and only if) the code subsequently
+ * does a push or arraycat.
+ }
+function apr_array_copy(p: Papr_pool_t;
+ const arr: Papr_array_header_t): Papr_array_header_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_array_copy' + LibSuff8;
+
+{
+ * Copy the headers of the array, and arrange for the elements to be copied if
+ * and only if the code subsequently does a push or arraycat.
+ * @param p The pool to allocate the copy of the array out of
+ * @param arr The array to copy
+ * @return An exact copy of the array passed in
+ * @remark The alternate apr_array_copy copies the *entire* array.
+ }
+function apr_array_copy_hdr(p: Papr_pool_t;
+ const arr: Papr_array_header_t): Papr_array_header_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_array_copy_hdr' + LibSuff8;
+
+{
+ * Append one array to the end of another, creating a new array in the process.
+ * @param p The pool to allocate the new array out of
+ * @param first The array to put first in the new array.
+ * @param second The array to put second in the new array.
+ * @return A new array containing the data from the two arrays passed in.
+}
+function apr_array_append(p: Papr_pool_t;
+ const first, second: Papr_array_header_t): Papr_array_header_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_array_append' + LibSuff12;
+
+{
+ * Generates a new string from the apr_pool_t containing the concatenated
+ * sequence of substrings referenced as elements within the array. The string
+ * will be empty if all substrings are empty or null, or if there are no
+ * elements in the array. If sep is non-NUL, it will be inserted between
+ * elements as a separator.
+ * @param p The pool to allocate the string out of
+ * @param arr The array to generate the string from
+ * @param sep The separator to use
+ * @return A string containing all of the data in the array.
+ }
+function apr_array_pstrcat(p: Papr_pool_t;
+ const arr: Papr_array_header_t; sep: Char): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_array_pstrcat' + LibSuff12;
+
+{
+ * Make a new table
+ * @param p The pool to allocate the pool out of
+ * @param nelts The number of elements in the initial table.
+ * @return The new table.
+ * @warning This table can only store text data
+ }
+function apr_table_make(p: Papr_pool_t; nelts: Integer): Papr_table_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_table_make' + LibSuff8;
+
+{
+ * Create a new table and copy another table into it
+ * @param p The pool to allocate the new table out of
+ * @param t The table to copy
+ * @return A copy of the table passed in
+ }
+function apr_table_copy(p: Papr_pool_t; const t: Papr_table_t): Papr_table_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_table_copy' + LibSuff8;
+
+{
+ * Delete all of the elements from a table
+ * @param t The table to clear
+ }
+procedure apr_table_clear(t: Papr_table_t);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_table_clear' + LibSuff4;
+
+{
+ * Get the value associated with a given key from the table. After this call,
+ * The data is still in the table
+ * @param t The table to search for the key
+ * @param key The key to search for
+ * @return The value associated with the key, or NULL if the key does not exist.
+ }
+function apr_table_get(t: Papr_table_t; key: PChar): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_table_get' + LibSuff8;
+
+{
+ * Add a key/value pair to a table, if another element already exists with the
+ * same key, this will over-write the old data.
+ * @param t The table to add the data to.
+ * @param key The key fo use
+ * @param val The value to add
+ * @remark When adding data, this function makes a copy of both the key and the
+ * value.
+ }
+procedure apr_table_set(t: Papr_table_t; const key, val: PChar);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_table_set' + LibSuff12;
+
+{
+ * Add a key/value pair to a table, if another element already exists with the
+ * same key, this will over-write the old data.
+ * @param t The table to add the data to.
+ * @param key The key to use
+ * @param val The value to add
+ * @warning When adding data, this function does not make a copy of the key or
+ * the value, so care should be taken to ensure that the values will
+ * not change after they have been added..
+ }
+procedure apr_table_setn(t: Papr_table_t; const key, val: PChar);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_table_setn' + LibSuff12;
+
+{
+ * Remove data from the table
+ * @param t The table to remove data from
+ * @param key The key of the data being removed
+ }
+procedure apr_table_unset(t: Papr_table_t; const key: PChar);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_table_unset' + LibSuff8;
+
+{
+ * Add data to a table by merging the value with data that has already been
+ * stored
+ * @param t The table to search for the data
+ * @param key The key to merge data for
+ * @param val The data to add
+ * @remark If the key is not found, then this function acts like apr_table_add
+ }
+procedure apr_table_merge(t: Papr_table_t; const key, val: PChar);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_table_merge' + LibSuff12;
+
+{
+ * Add data to a table by merging the value with data that has already been
+ * stored
+ * @param t The table to search for the data
+ * @param key The key to merge data for
+ * @param val The data to add
+ * @remark If the key is not found, then this function acts like apr_table_addn
+ }
+procedure apr_table_mergen(t: Papr_table_t; const key, val: PChar);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_table_mergen' + LibSuff12;
+
+{
+ * Add data to a table, regardless of whether there is another element with the
+ * same key.
+ * @param t The table to add to
+ * @param key The key to use
+ * @param val The value to add.
+ * @remark When adding data, this function makes a copy of both the key and the
+ * value.
+ }
+procedure apr_table_add(t: Papr_table_t; const key, val: PChar);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_table_add' + LibSuff12;
+
+{
+ * Add data to a table, regardless of whether there is another element with the
+ * same key.
+ * @param t The table to add to
+ * @param key The key to use
+ * @param val The value to add.
+ * @remark When adding data, this function does not make a copy of the key or the
+ * value, so care should be taken to ensure that the values will not
+ * change after they have been added..
+ }
+procedure apr_table_addn(t: Papr_table_t; const key, val: PChar);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_table_addn' + LibSuff12;
+
+{
+ * Merge two tables into one new table
+ * @param p The pool to use for the new table
+ * @param overlay The first table to put in the new table
+ * @param base The table to add at the end of the new table
+ * @return A new table containing all of the data from the two passed in
+ }
+function apr_table_overlay(t: Papr_table_t;
+ const overlay, base: Papr_table_t): Papr_table_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_table_overlay' + LibSuff12;
+
+{
+ * Declaration prototype for the iterator callback function of apr_table_do()
+ * and apr_table_vdo().
+ * @param rec The data passed as the first argument to apr_table_[v]do()
+ * @param key The key from this iteration of the table
+ * @param value The value from this iteration of the table
+ * @remark Iteration continues while this callback function returns non-zero.
+ * To export the callback function for apr_table_[v]do() it must be declared
+ * in the _NONSTD convention.
+ }
+type
+ apr_table_do_callback_fn_t = function (rec: Pointer;
+ const key, value: PChar): Integer;
+
+ Papr_table_do_callback_fn_t = ^apr_table_do_callback_fn_t;
+
+{
+ * Iterate over a table running the provided function once for every
+ * element in the table. If there is data passed in as a vararg, then the
+ * function is only run on those elements whose key matches something in
+ * the vararg. If the vararg is NULL, then every element is run through the
+ * function. Iteration continues while the function returns non-zero.
+ * @param comp The function to run
+ * @param rec The data to pass as the first argument to the function
+ * @param t The table to iterate over
+ * @param ... The vararg. If this is NULL, then all elements in the table are
+ * run through the function, otherwise only those whose key matches
+ * are run.
+ * @return FALSE if one of the comp() iterations returned zero; TRUE if all
+ * iterations returned non-zero
+ * @see apr_table_do_callback_fn_t
+ }
+{APR_DECLARE_NONSTD(int) apr_table_do(apr_table_do_callback_fn_t *comp,
+ void *rec, const apr_table_t *t, ...);
+}
+{
+ * Iterate over a table running the provided function once for every
+ * element in the table. If there is data passed in as a vararg, then the
+ * function is only run on those element's whose key matches something in
+ * the vararg. If the vararg is NULL, then every element is run through the
+ * function. Iteration continues while the function returns non-zero.
+ * @param comp The function to run
+ * @param rec The data to pass as the first argument to the function
+ * @param t The table to iterate over
+ * @param vp The vararg table. If this is NULL, then all elements in the
+ * table are run through the function, otherwise only those
+ * whose key matches are run.
+ * @return FALSE if one of the comp() iterations returned zero; TRUE if all
+ * iterations returned non-zero
+ * @see apr_table_do_callback_fn_t
+ }
+function apr_table_vdo(comp: Papr_table_do_callback_fn_t;
+ rec: Pointer; const t: Papr_table_t; vp: va_list): Integer;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_table_vdo' + LibSuff16;
+
+const
+ { flag for overlap to use apr_table_setn }
+ APR_OVERLAP_TABLES_SET = 0;
+ { flag for overlap to use apr_table_mergen }
+ APR_OVERLAP_TABLES_MERGE = 1;
+
+{
+ * For each element in table b, either use setn or mergen to add the data
+ * to table a. Which method is used is determined by the flags passed in.
+ * @param a The table to add the data to.
+ * @param b The table to iterate over, adding its data to table a
+ * @param flags How to add the table to table a. One of:
+ * APR_OVERLAP_TABLES_SET Use apr_table_setn
+ * APR_OVERLAP_TABLES_MERGE Use apr_table_mergen
+ * @remark This function is highly optimized, and uses less memory and CPU cycles
+ * than a function that just loops through table b calling other functions.
+ }
+{
+ *<PRE>
+ * Conceptually, apr_table_overlap does this:
+ *
+ * apr_array_header_t *barr = apr_table_elts(b);
+ * apr_table_entry_t *belt = (apr_table_entry_t *)barr->elts;
+ * int i;
+ *
+ * for (i = 0; i < barr->nelts; ++i) (
+ * if (flags & APR_OVERLAP_TABLES_MERGE) (
+ * apr_table_mergen(a, belt[i].key, belt[i].val);
+ * )
+ * else (
+ * apr_table_setn(a, belt[i].key, belt[i].val);
+ * )
+ * )
+ *
+ * Except that it is more efficient (less space and cpu-time) especially
+ * when b has many elements.
+ *
+ * Notice the assumptions on the keys and values in b -- they must be
+ * in an ancestor of a's pool. In practice b and a are usually from
+ * the same pool.
+ * </PRE>
+ }
+procedure apr_table_overlap(a: Papr_table_t;
+ const b: Papr_table_t; flags: cuint);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_table_overlap' + LibSuff12;
+
+{
+ * Eliminate redundant entries in a table by either overwriting
+ * or merging duplicates
+ *
+ * @param t Table.
+ * @param flags APR_OVERLAP_TABLES_MERGE to merge, or
+ * APR_OVERLAP_TABLES_SET to overwrite
+ }
+procedure apr_table_compress(t: Papr_table_t; flags: cuint);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_table_compress' + LibSuff8;
+
diff --git a/packages/httpd22/src/apr/apr_thread_proc.inc b/packages/httpd22/src/apr/apr_thread_proc.inc
new file mode 100644
index 0000000000..eb5ae019d0
--- /dev/null
+++ b/packages/httpd22/src/apr/apr_thread_proc.inc
@@ -0,0 +1,865 @@
+{ Copyright 2000-2005 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed 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.
+ }
+
+{
+ * @file apr_thread_proc.h
+ * @brief APR Thread and Process Library
+ }
+
+{#include "apr.h"
+#include "apr_file_io.h"
+#include "apr_pools.h"
+#include "apr_errno.h"
+
+#if APR_HAVE_STRUCT_RLIMIT
+#include <sys/time.h>
+#include <sys/resource.h>
+#endif}
+
+{
+ * @defgroup apr_thread_proc Threads and Process Functions
+ * @ingroup APR
+ }
+
+type
+ apr_cmdtype_e = (
+ APR_SHELLCMD, {< use the shell to invoke the program }
+ APR_PROGRAM, {< invoke the program directly, no copied env }
+ APR_PROGRAM_ENV, {< invoke the program, replicating our environment }
+ APR_PROGRAM_PATH, {< find program on PATH, use our environment }
+ APR_SHELLCMD_ENV {< use the shell to invoke the program,
+ * replicating our environment }
+ );
+
+ apr_wait_how_e = (
+ APR_WAIT, {< wait for the specified process to finish }
+ APR_NOWAIT {< do not wait -- just see if it has finished }
+ );
+
+{ I am specifically calling out the values so that the macros below make
+ * more sense. Yes, I know I don't need to, but I am hoping this makes what
+ * I am doing more clear. If you want to add more reasons to exit, continue
+ * to use bitmasks.
+ }
+ apr_exit_why_e = (
+ APR_PROC_EXIT = 1, {< process exited normally }
+ APR_PROC_SIGNAL = 2, {< process exited due to a signal }
+ APR_PROC_SIGNAL_CORE = 4 {< process exited and dumped a core file }
+ );
+ Papr_exit_why_e = ^apr_exit_why_e;
+
+{ did we exit the process }
+//#define APR_PROC_CHECK_EXIT(x) (x & APR_PROC_EXIT)
+{ did we get a signal }
+//#define APR_PROC_CHECK_SIGNALED(x) (x & APR_PROC_SIGNAL)
+{ did we get core }
+//#define APR_PROC_CHECK_CORE_DUMP(x) (x & APR_PROC_SIGNAL_CORE)
+
+const
+{ @see apr_procattr_io_set }
+ APR_NO_PIPE = 0;
+
+{ @see apr_procattr_io_set }
+ APR_FULL_BLOCK = 1;
+{ @see apr_procattr_io_set }
+ APR_FULL_NONBLOCK = 2;
+{ @see apr_procattr_io_set }
+ APR_PARENT_BLOCK = 3;
+{ @see apr_procattr_io_set }
+ APR_CHILD_BLOCK = 4;
+
+{ @see apr_procattr_limit_set }
+ APR_LIMIT_CPU = 0;
+{ @see apr_procattr_limit_set }
+ APR_LIMIT_MEM = 1;
+{ @see apr_procattr_limit_set }
+ APR_LIMIT_NPROC = 2;
+{ @see apr_procattr_limit_set }
+ APR_LIMIT_NOFILE = 3;
+
+{
+ * @defgroup APR_OC Other Child Flags
+ }
+ APR_OC_REASON_DEATH = 0; {< child has died, caller must call
+ * unregister still }
+ APR_OC_REASON_UNWRITABLE = 1; {< write_fd is unwritable }
+ APR_OC_REASON_RESTART = 2; {< a restart is occuring, perform
+ * any necessary cleanup (including
+ * sending a special signal to child)
+ }
+ APR_OC_REASON_UNREGISTER = 3; {< unregister has been called, do
+ * whatever is necessary (including
+ * kill the child) }
+ APR_OC_REASON_LOST = 4; {< somehow the child exited without
+ * us knowing ... buggy os? }
+ APR_OC_REASON_RUNNING = 5; {< a health check is occuring,
+ * for most maintainence functions
+ * this is a no-op.
+ }
+
+{ The APR process type }
+type
+ apr_proc_t = record
+ { The process ID }
+ pid: pid_t;
+ { Parent's side of pipe to child's stdin }
+ in_: Papr_file_t;
+ { Parent's side of pipe to child's stdout }
+ out_: Papr_file_t;
+ { Parent's side of pipe to child's stdouterr }
+ err: Papr_file_t;
+{$if defined(APR_HAS_PROC_INVOKED) or defined(DOXYGEN)}
+ { Diagnositics/debugging string of the command invoked for
+ * this process [only present if APR_HAS_PROC_INVOKED is true]
+ * @remark Only enabled on Win32 by default.
+ * @bug This should either always or never be present in release
+ * builds - since it breaks binary compatibility. We may enable
+ * it always in APR 1.0 yet leave it undefined in most cases.
+ }
+ invoked: PChar;
+{$endif}
+{$if defined(WINDOWS) or defined(DOXYGEN)}
+ { (Win32 only) Creator's handle granting access to the process
+ * @remark This handle is closed and reset to NULL in every case
+ * corresponding to a waitpid() on Unix which returns the exit status.
+ * Therefore Win32 correspond's to Unix's zombie reaping characteristics
+ * and avoids potential handle leaks.
+ }
+ hproc: HANDLE;
+{$endif}
+ end;
+
+ Papr_proc_t = ^apr_proc_t;
+
+{
+ * The prototype for APR child errfn functions. (See the description
+ * of apr_procattr_child_errfn_set() for more information.)
+ * It is passed the following parameters:
+ * @param pool Pool associated with the apr_proc_t. If your child
+ * error function needs user data, associate it with this
+ * pool.
+ * @param err APR error code describing the error
+ * @param description Text description of type of processing which failed
+ }
+ apr_child_errfn_t = procedure (proc: Papr_pool_t;
+ err: apr_status_t; const description: PChar);
+
+{ Opaque Thread structure. }
+ apr_thread_t = record end;
+ Papr_thread_t = ^apr_thread_t;
+ PPapr_thread_t = ^Papr_thread_t;
+
+{ Opaque Thread attributes structure. }
+ apr_threadattr_t = record end;
+ Papr_threadattr_t = ^apr_threadattr_t;
+ PPapr_threadattr_t = ^Papr_threadattr_t;
+
+{ Opaque Process attributes structure. }
+ apr_procattr_t = record end;
+ Papr_procattr_t = ^apr_procattr_t;
+ PPapr_procattr_t = ^Papr_procattr_t;
+
+{ Opaque control variable for one-time atomic variables. }
+ apr_thread_once_t = record end;
+ Papr_thread_once_t = ^apr_thread_once_t;
+ PPapr_thread_once_t = ^Papr_thread_once_t;
+
+{ Opaque thread private address space. }
+ apr_threadkey_t = record end;
+ Papr_threadkey_t = ^apr_threadkey_t;
+ PPapr_threadkey_t = ^Papr_threadkey_t;
+
+{ Opaque record of child process. }
+ apr_other_child_rec_t = record end;
+ Papr_other_child_rec_t = ^apr_other_child_rec_t;
+ PPapr_other_child_rec_t = ^Papr_other_child_rec_t;
+
+{
+ * The prototype for any APR thread worker functions.
+ }
+ apr_thread_start_t = function(param: Papr_thread_t; param2: Pointer): Pointer;
+
+ apr_kill_conditions_e = (
+ APR_KILL_NEVER, {< process is never sent any signals }
+ APR_KILL_ALWAYS, {< process is sent SIGKILL on apr_pool_t cleanup }
+ APR_KILL_AFTER_TIMEOUT, {< SIGTERM, wait 3 seconds, SIGKILL }
+ APR_JUST_WAIT, {< wait forever for the process to complete }
+ APR_KILL_ONLY_ONCE {< send SIGTERM and then wait }
+ );
+
+{ Thread Function definitions }
+
+//{$if APR_HAS_THREADS}
+
+{
+ * Create and initialize a new threadattr variable
+ * @param new_attr The newly created threadattr.
+ * @param cont The pool to use
+ }
+function apr_threadattr_create(new_attr: PPapr_threadattr_t; cont: Papr_pool_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_threadattr_create' + LibSuff8;
+
+{
+ * Set if newly created threads should be created in detached state.
+ * @param attr The threadattr to affect
+ * @param on Thread detach state on or off
+ }
+function apr_threadattr_detach_set(attr: Papr_threadattr_t; on_: apr_int32_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_threadattr_detach_set' + LibSuff8;
+
+{
+ * Get the detach state for this threadattr.
+ * @param attr The threadattr to reference
+ }
+function apr_threadattr_detach_get(attr: PPapr_threadattr_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_threadattr_detach_get' + LibSuff4;
+
+{
+ * Set the stack size of newly created threads.
+ * @param attr The threadattr to affect
+ * @param stacksize The stack size in bytes
+ }
+function apr_threadattr_stacksize_set(new_attr: PPapr_threadattr_t; stacksize: apr_size_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_threadattr_stacksize_set' + LibSuff8;
+
+{
+ * Set the stack guard area size of newly created threads.
+ * @param attr The threadattr to affect
+ * @param guardsize The stack guard area size in bytes
+ * @note Thread library implementations commonly use a "guard area"
+ * after each thread's stack which is not readable or writable such that
+ * stack overflows cause a segfault; this consumes e.g. 4K of memory
+ * and increases memory management overhead. Setting the guard area
+ * size to zero hence trades off reliable behaviour on stack overflow
+ * for performance. }
+function apr_threadattr_guardsize_set(attr: Papr_threadattr_t; guardsize: apr_size_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_threadattr_guardsize_set' + LibSuff8;
+
+{
+ * Create a new thread of execution
+ * @param new_thread The newly created thread handle.
+ * @param attr The threadattr to use to determine how to create the thread
+ * @param func The function to start the new thread in
+ * @param data Any data to be passed to the starting function
+ * @param cont The pool to use
+ }
+function apr_thread_create(new_thread: PPapr_thread_t;
+ attr: Papr_threadattr_t; func: apr_thread_start_t;
+ data: Pointer; cont: Papr_pool_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_thread_create' + LibSuff20;
+
+{
+ * stop the current thread
+ * @param thd The thread to stop
+ * @param retval The return value to pass back to any thread that cares
+ }
+function apr_thread_exit(thd: Papr_thread_t; retval: apr_status_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_thread_exit' + LibSuff8;
+
+{
+ * block until the desired thread stops executing.
+ * @param retval The return value from the dead thread.
+ * @param thd The thread to join
+ }
+function apr_thread_join(retval: Papr_status_t; thd: Papr_thread_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_thread_join' + LibSuff8;
+
+{
+ * force the current thread to yield the processor
+ }
+procedure apr_thread_yield;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_thread_yield' + LibSuff0;
+
+{
+ * Initialize the control variable for apr_thread_once. If this isn't
+ * called, apr_initialize won't work.
+ * @param control The control variable to initialize
+ * @param p The pool to allocate data from.
+ }
+function apr_thread_once_init(control: PPapr_thread_once_t; p: Papr_pool_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_thread_once_init' + LibSuff8;
+
+{
+ * Run the specified function one time, regardless of how many threads
+ * call it.
+ * @param control The control variable. The same variable should
+ * be passed in each time the function is tried to be
+ * called. This is how the underlying functions determine
+ * if the function has ever been called before.
+ * @param func The function to call.
+ }
+type
+ func_t = procedure;
+
+function apr_thread_once(control: Papr_thread_once_t; func: func_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_thread_once' + LibSuff8;
+
+{
+ * detach a thread
+ * @param thd The thread to detach
+ }
+function apr_thread_detach(thd: Papr_thread_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_thread_detach' + LibSuff4;
+
+{
+ * Return the pool associated with the current thread.
+ * @param data The user data associated with the thread.
+ * @param key The key to associate with the data
+ * @param thread The currently open thread.
+ }
+function apr_thread_data_get(data: PPointer; const key: PChar;
+ thread: Papr_thread_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_thread_data_get' + LibSuff12;
+
+{
+ * Return the pool associated with the current thread.
+ * @param data The user data to associate with the thread.
+ * @param key The key to use for associating the data with the thread
+ * @param cleanup The cleanup routine to use when the thread is destroyed.
+ * @param thread The currently open thread.
+ }
+function apr_thread_data_set(data: Pointer; const key: PChar;
+ cleanup: cleanup_t; thread: Papr_thread_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_thread_data_set' + LibSuff16;
+
+{
+ * Create and initialize a new thread private address space
+ * @param key The thread private handle.
+ * @param dest The destructor to use when freeing the private memory.
+ * @param cont The pool to use
+ }
+type
+ dest_t = procedure (param: Pointer);
+
+function apr_threadkey_private_create(key: PPapr_threadkey_t;
+ dest: dest_t; cont: Papr_pool_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_threadkey_private_create' + LibSuff12;
+
+{
+ * Get a pointer to the thread private memory
+ * @param new_mem The data stored in private memory
+ * @param key The handle for the desired thread private memory
+ }
+function apr_threadkey_private_get(new_mem: PPointer; key: Papr_threadkey_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_threadkey_private_get' + LibSuff8;
+
+{
+ * Set the data to be stored in thread private memory
+ * @param priv The data to be stored in private memory
+ * @param key The handle for the desired thread private memory
+ }
+function apr_threadkey_private_set(priv: Pointer; key: Papr_threadkey_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_threadkey_private_set' + LibSuff8;
+
+{
+ * Free the thread private memory
+ * @param key The handle for the desired thread private memory
+ }
+function apr_threadkey_private_delete(key: Papr_threadkey_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_threadkey_private_delete' + LibSuff4;
+
+{
+ * Return the pool associated with the current threadkey.
+ * @param data The user data associated with the threadkey.
+ * @param key The key associated with the data
+ * @param threadkey The currently open threadkey.
+ }
+function apr_threadkey_data_get(data: PPointer; const key: PChar;
+ threadkey: Papr_threadkey_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_threadkey_data_get' + LibSuff12;
+
+{
+ * Return the pool associated with the current threadkey.
+ * @param data The data to set.
+ * @param key The key to associate with the data.
+ * @param cleanup The cleanup routine to use when the file is destroyed.
+ * @param threadkey The currently open threadkey.
+ }
+function apr_threadkey_data_set(data: Pointer; const key: PChar;
+ cleanup: cleanup_t; threadkey: Papr_threadkey_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_threadkey_data_set' + LibSuff16;
+
+{.$endif}
+
+{
+ * Create and initialize a new procattr variable
+ * @param new_attr The newly created procattr.
+ * @param cont The pool to use
+ }
+function apr_procattr_create(new_attr: PPapr_procattr_t; cont: Papr_pool_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_procattr_create' + LibSuff8;
+
+{
+ * Determine if any of stdin, stdout, or stderr should be linked to pipes
+ * when starting a child process.
+ * @param attr The procattr we care about.
+ * @param in Should stdin be a pipe back to the parent?
+ * @param out Should stdout be a pipe back to the parent?
+ * @param err Should stderr be a pipe back to the parent?
+ }
+function apr_procattr_io_set(attr: Papr_procattr_t;
+ in_, out_, err: apr_int32_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_procattr_io_set' + LibSuff16;
+
+{
+ * Set the child_in and/or parent_in values to existing apr_file_t values.
+ * @param attr The procattr we care about.
+ * @param child_in apr_file_t value to use as child_in. Must be a valid file.
+ * @param parent_in apr_file_t value to use as parent_in. Must be a valid file.
+ * @remark This is NOT a required initializer function. This is
+ * useful if you have already opened a pipe (or multiple files)
+ * that you wish to use, perhaps persistently across multiple
+ * process invocations - such as a log file. You can save some
+ * extra function calls by not creating your own pipe since this
+ * creates one in the process space for you.
+ }
+function apr_procattr_child_in_set(attr: Papr_procattr_t;
+ child_in, parent_in: Papr_file_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_procattr_child_in_set' + LibSuff12;
+
+{
+ * Set the child_out and parent_out values to existing apr_file_t values.
+ * @param attr The procattr we care about.
+ * @param child_out apr_file_t value to use as child_out. Must be a valid file.
+ * @param parent_out apr_file_t value to use as parent_out. Must be a valid file.
+ * @remark This is NOT a required initializer function. This is
+ * useful if you have already opened a pipe (or multiple files)
+ * that you wish to use, perhaps persistently across multiple
+ * process invocations - such as a log file.
+ }
+function apr_procattr_child_out_set(attr: Papr_procattr_t;
+ child_out, parent_out: Papr_file_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_procattr_child_out_set' + LibSuff12;
+
+{
+ * Set the child_err and parent_err values to existing apr_file_t values.
+ * @param attr The procattr we care about.
+ * @param child_err apr_file_t value to use as child_err. Must be a valid file.
+ * @param parent_err apr_file_t value to use as parent_err. Must be a valid file.
+ * @remark This is NOT a required initializer function. This is
+ * useful if you have already opened a pipe (or multiple files)
+ * that you wish to use, perhaps persistently across multiple
+ * process invocations - such as a log file.
+ }
+function apr_procattr_child_err_set(attr: Papr_procattr_t;
+ child_err, parent_err: Papr_file_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_procattr_child_err_set' + LibSuff12;
+
+{
+ * Set which directory the child process should start executing in.
+ * @param attr The procattr we care about.
+ * @param dir Which dir to start in. By default, this is the same dir as
+ * the parent currently resides in, when the createprocess call
+ * is made.
+ }
+function apr_procattr_dir_set(attr: Papr_procattr_t; const dir: PChar): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_procattr_dir_set' + LibSuff8;
+
+{
+ * Set what type of command the child process will call.
+ * @param attr The procattr we care about.
+ * @param cmd The type of command. One of:
+ * <PRE>
+ * APR_SHELLCMD -- Anything that the shell can handle
+ * APR_PROGRAM -- Executable program (default)
+ * APR_PROGRAM_ENV -- Executable program, copy environment
+ * APR_PROGRAM_PATH -- Executable program on PATH, copy env
+ * </PRE>
+ }
+function apr_procattr_cmdtype_set(attr: Papr_procattr_t; cmd: apr_cmdtype_e): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_procattr_cmdtype_set' + LibSuff8;
+
+{
+ * Determine if the child should start in detached state.
+ * @param attr The procattr we care about.
+ * @param detach Should the child start in detached state? Default is no.
+ }
+function apr_procattr_detach_set(attr: Papr_procattr_t; detach: apr_int32_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_procattr_detach_set' + LibSuff8;
+
+{$ifdef APR_HAVE_STRUCT_RLIMIT}
+{
+ * Set the Resource Utilization limits when starting a new process.
+ * @param attr The procattr we care about.
+ * @param what Which limit to set, one of:
+ * <PRE>
+ * APR_LIMIT_CPU
+ * APR_LIMIT_MEM
+ * APR_LIMIT_NPROC
+ * APR_LIMIT_NOFILE
+ * </PRE>
+ * @param limit Value to set the limit to.
+ }
+function apr_procattr_limit_set(attr: Papr_procattr_t; what: apr_int32_t;
+ limit: Pointer): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_procattr_limit_set' + LibSuff12;
+
+{$endif}
+
+{
+ * Specify an error function to be called in the child process if APR
+ * encounters an error in the child prior to running the specified program.
+ * @param attr The procattr describing the child process to be created.
+ * @param errfn The function to call in the child process.
+ * @remark At the present time, it will only be called from apr_proc_create()
+ * on platforms where fork() is used. It will never be called on other
+ * platforms, on those platforms apr_proc_create() will return the error
+ * in the parent process rather than invoke the callback in the now-forked
+ * child process.
+ }
+function apr_procattr_child_errfn_set(attr: Papr_procattr_t; errfn: apr_child_errfn_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_procattr_child_errfn_set' + LibSuff8;
+
+{
+ * Specify that apr_proc_create() should do whatever it can to report
+ * failures to the caller of apr_proc_create(), rather than find out in
+ * the child.
+ * @param attr The procattr describing the child process to be created.
+ * @param chk Flag to indicate whether or not extra work should be done
+ * to try to report failures to the caller.
+ * @remark This flag only affects apr_proc_create() on platforms where
+ * fork() is used. This leads to extra overhead in the calling
+ * process, but that may help the application handle such
+ * errors more gracefully.
+ }
+function apr_procattr_error_check_set(attr: Papr_procattr_t; chk: apr_int32_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_procattr_error_check_set' + LibSuff8;
+
+{
+ * Determine if the child should start in its own address space or using the
+ * current one from its parent
+ * @param attr The procattr we care about.
+ * @param addrspace Should the child start in its own address space? Default
+ * is no on NetWare and yes on other platforms.
+ }
+function apr_procattr_addrspace_set(attr: Papr_procattr_t; addrspace: apr_int32_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_procattr_addrspace_set' + LibSuff8;
+
+{
+ * Set the username used for running process
+ * @param attr The procattr we care about.
+ * @param username The username used
+ * @param password User password if needed. Password is needed on WIN32
+ * or any other platform having
+ * APR_PROCATTR_USER_SET_REQUIRES_PASSWORD set.
+ }
+function apr_procattr_user_set(attr: Papr_procattr_t;
+ const username, password: PChar): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_procattr_user_set' + LibSuff12;
+
+{
+ * Set the group used for running process
+ * @param attr The procattr we care about.
+ * @param groupname The group name used
+ }
+function apr_procattr_group_set(attr: Papr_procattr_t;
+ const groupname: PChar): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_procattr_group_set' + LibSuff8;
+
+{$ifdef APR_HAS_FORK}
+{
+ * This is currently the only non-portable call in APR. This executes
+ * a standard unix fork.
+ * @param proc The resulting process handle.
+ * @param cont The pool to use.
+ }
+function apr_proc_fork(proc: Papr_proc_t; cont: Papr_pool_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_proc_fork' + LibSuff8;
+
+{$endif}
+
+{
+ * Create a new process and execute a new program within that process.
+ * @param new_proc The resulting process handle.
+ * @param progname The program to run
+ * @param args the arguments to pass to the new program. The first
+ * one should be the program name.
+ * @param env The new environment table for the new process. This
+ * should be a list of NULL-terminated strings. This argument
+ * is ignored for APR_PROGRAM_ENV, APR_PROGRAM_PATH, and
+ * APR_SHELLCMD_ENV types of commands.
+ * @param attr the procattr we should use to determine how to create the new
+ * process
+ * @param pool The pool to use.
+ }
+function apr_proc_create(new_proc: Papr_proc_t;
+ const progname: PChar; args, arnv: PPChar;
+ attr: Papr_procattr_t;
+ pool: Papr_pool_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_proc_create' + LibSuff24;
+
+{
+ * Wait for a child process to die
+ * @param proc The process handle that corresponds to the desired child process
+ * @param exitcode The returned exit status of the child, if a child process
+ * dies, or the signal that caused the child to die.
+ * On platforms that don't support obtaining this information,
+ * the status parameter will be returned as APR_ENOTIMPL.
+ * @param exitwhy Why the child died, the bitwise or of:
+ * <PRE>
+ * APR_PROC_EXIT -- process terminated normally
+ * APR_PROC_SIGNAL -- process was killed by a signal
+ * APR_PROC_SIGNAL_CORE -- process was killed by a signal, and
+ * generated a core dump.
+ * </PRE>
+ * @param waithow How should we wait. One of:
+ * <PRE>
+ * APR_WAIT -- block until the child process dies.
+ * APR_NOWAIT -- return immediately regardless of if the
+ * child is dead or not.
+ * </PRE>
+ * @remark The childs status is in the return code to this process. It is one of:
+ * <PRE>
+ * APR_CHILD_DONE -- child is no longer running.
+ * APR_CHILD_NOTDONE -- child is still running.
+ * </PRE>
+ }
+function apr_proc_wait(proc: Papr_proc_t; exitcode: PInteger;
+ exitwhy: Papr_exit_why_e; waithow: apr_wait_how_e): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_proc_wait' + LibSuff16;
+
+{
+ * Wait for any current child process to die and return information
+ * about that child.
+ * @param proc Pointer to NULL on entry, will be filled out with child's
+ * information
+ * @param exitcode The returned exit status of the child, if a child process
+ * dies, or the signal that caused the child to die.
+ * On platforms that don't support obtaining this information,
+ * the status parameter will be returned as APR_ENOTIMPL.
+ * @param exitwhy Why the child died, the bitwise or of:
+ * <PRE>
+ * APR_PROC_EXIT -- process terminated normally
+ * APR_PROC_SIGNAL -- process was killed by a signal
+ * APR_PROC_SIGNAL_CORE -- process was killed by a signal, and
+ * generated a core dump.
+ * </PRE>
+ * @param waithow How should we wait. One of:
+ * <PRE>
+ * APR_WAIT -- block until the child process dies.
+ * APR_NOWAIT -- return immediately regardless of if the
+ * child is dead or not.
+ * </PRE>
+ * @param p Pool to allocate child information out of.
+ * @bug Passing proc as a *proc rather than **proc was an odd choice
+ * for some platforms... this should be revisited in 1.0
+ }
+function apr_proc_wait_all_procs(proc: Papr_proc_t; exitcode: PInteger;
+ exitwhy: Papr_exit_why_e; waithow: apr_wait_how_e;
+ p: Papr_pool_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_proc_wait_all_procs' + LibSuff20;
+
+const
+ APR_PROC_DETACH_FOREGROUND = 0; {< Do not detach }
+ APR_PROC_DETACH_DAEMONIZE = 1; {< Detach }
+
+{
+ * Detach the process from the controlling terminal.
+ * @param daemonize set to non-zero if the process should daemonize
+ * and become a background process, else it will
+ * stay in the foreground.
+ }
+{ Not present on the dll }
+//function apr_proc_detach(daemonize: Integer): apr_status_t;
+// {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+// external LibAPR name LibNamePrefix + 'apr_proc_detach' + LibSuff4;
+
+{
+ * Register an other_child -- a child associated to its registered
+ * maintence callback. This callback is invoked when the process
+ * dies, is disconnected or disappears.
+ * @param proc The child process to register.
+ * @param maintenance maintenance is a function that is invoked with a
+ * reason and the data pointer passed here.
+ * @param data Opaque context data passed to the maintenance function.
+ * @param write_fd An fd that is probed for writing. If it is ever unwritable
+ * then the maintenance is invoked with reason
+ * OC_REASON_UNWRITABLE.
+ * @param p The pool to use for allocating memory.
+ * @bug write_fd duplicates the proc->out stream, it's really redundant
+ * and should be replaced in the APR 1.0 API with a bitflag of which
+ * proc->in/out/err handles should be health checked.
+ * @bug no platform currently tests the pipes health.
+ }
+type
+ maintenance_t = procedure (reason: Integer; param: Pointer; status: Integer);
+
+procedure apr_proc_other_child_register(proc: Papr_proc_t;
+ maintenance: maintenance_t; data: Pointer; write_fd: Papr_file_t;
+ p: Papr_pool_t);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_proc_other_child_register' + LibSuff20;
+
+{
+ * Stop watching the specified other child.
+ * @param data The data to pass to the maintenance function. This is
+ * used to find the process to unregister.
+ * @warning Since this can be called by a maintenance function while we're
+ * scanning the other_children list, all scanners should protect
+ * themself by loading ocr->next before calling any maintenance
+ * function.
+ }
+procedure apr_proc_other_child_unregister(data: Pointer);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_proc_other_child_unregister' + LibSuff4;
+
+{
+ * Notify the maintenance callback of a registered other child process
+ * that application has detected an event, such as death.
+ * @param proc The process to check
+ * @param reason The reason code to pass to the maintenance function
+ * @param status The status to pass to the maintenance function
+ * @remark An example of code using this behavior;
+ * <pre>
+ * rv = apr_proc_wait_all_procs(&proc, &exitcode, &status, APR_WAIT, p);
+ * if (APR_STATUS_IS_CHILD_DONE(rv)) (
+ * #if APR_HAS_OTHER_CHILD
+ * if (apr_proc_other_child_alert(&proc, APR_OC_REASON_DEATH, status)
+ * == APR_SUCCESS) (
+ * ; (already handled)
+ * )
+ * else
+ * #endif
+ * [... handling non-otherchild processes death ...]
+ * </pre>
+ }
+function apr_proc_other_child_alert(proc: Papr_proc_t;
+ reason, status: Integer): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_proc_other_child_alert' + LibSuff12;
+
+{
+ * Test one specific other child processes and invoke the maintenance callback
+ * with the appropriate reason code, if still running, or the appropriate reason
+ * code if the process is no longer healthy.
+ * @param ocr The registered other child
+ * @param reason The reason code (e.g. APR_OC_REASON_RESTART) if still running
+ }
+procedure apr_proc_other_child_refresh(ocr: Papr_other_child_rec_t; reason: Integer);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_proc_other_child_refresh' + LibSuff8;
+
+{
+ * Test all registered other child processes and invoke the maintenance callback
+ * with the appropriate reason code, if still running, or the appropriate reason
+ * code if the process is no longer healthy.
+ * @param reason The reason code (e.g. APR_OC_REASON_RESTART) to running processes
+ }
+procedure apr_proc_other_child_refresh_all(reason: Integer);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_proc_other_child_refresh_all' + LibSuff4;
+
+{
+ * Terminate a process.
+ * @param proc The process to terminate.
+ * @param sig How to kill the process.
+ }
+function apr_proc_kill(proc: Papr_proc_t; sig: Integer): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_proc_kill' + LibSuff8;
+
+{
+ * Register a process to be killed when a pool dies.
+ * @param a The pool to use to define the processes lifetime
+ * @param proc The process to register
+ * @param how How to kill the process, one of:
+ * <PRE>
+ * APR_KILL_NEVER -- process is never sent any signals
+ * APR_KILL_ALWAYS -- process is sent SIGKILL on apr_pool_t cleanup
+ * APR_KILL_AFTER_TIMEOUT -- SIGTERM, wait 3 seconds, SIGKILL
+ * APR_JUST_WAIT -- wait forever for the process to complete
+ * APR_KILL_ONLY_ONCE -- send SIGTERM and then wait
+ * </PRE>
+ }
+procedure apr_pool_note_subprocess(a: Papr_pool_t;
+ proc: Papr_proc_t; how: apr_kill_conditions_e);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_pool_note_subprocess' + LibSuff12;
+
+{.$ifdef APR_HAS_THREADS}
+
+{$if (defined(APR_HAVE_SIGWAIT) or defined(APR_HAVE_SIGSUSPEND)) and not defined(OS2)}
+
+{
+ * Setup the process for a single thread to be used for all signal handling.
+ * @warning This must be called before any threads are created
+ }
+function apr_setup_signal_thread: apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_setup_signal_thread' + LibSuff0;
+
+{
+ * Make the current thread listen for signals. This thread will loop
+ * forever, calling a provided function whenever it receives a signal. That
+ * functions should return 1 if the signal has been handled, 0 otherwise.
+ * @param signal_handler The function to call when a signal is received
+ * apr_status_t apr_signal_thread((int)( *signal_handler)(int signum))
+ }
+type
+ signal_handler_t = function (signum: Integer): Integer;
+
+function apr_signal_thread(signal_handler: signal_handler_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_signal_thread' + LibSuff8;
+
+{$endif} { (APR_HAVE_SIGWAIT || APR_HAVE_SIGSUSPEND) && !defined(OS2) }
+
+{
+ * Get the child-pool used by the thread from the thread info.
+ * @return apr_pool_t the pool
+ }
+//APR_POOL_DECLARE_ACCESSOR(thread);
+
+//#endif { APR_HAS_THREADS }
+
diff --git a/packages/httpd22/src/apr/apr_time.inc b/packages/httpd22/src/apr/apr_time.inc
new file mode 100644
index 0000000000..857e222a9d
--- /dev/null
+++ b/packages/httpd22/src/apr/apr_time.inc
@@ -0,0 +1,244 @@
+{ Copyright 2000-2005 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed 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.
+ }
+
+{
+ * @file apr_time.h
+ * @brief APR Time Library
+ }
+
+{#include "apr.h"
+#include "apr_pools.h"
+#include "apr_errno.h"}
+
+{
+ * @defgroup apr_time Time Routines
+ * @ingroup APR
+ }
+
+{ month names }
+//APR_DECLARE_DATA extern const char apr_month_snames[12][4];
+{ day names }
+//APR_DECLARE_DATA extern const char apr_day_snames[7][4];
+
+
+{ number of microseconds since 00:00:00 january 1, 1970 UTC }
+type
+ apr_time_t = apr_int64_t;
+ Papr_time_t = ^apr_time_t;
+
+
+{ mechanism to properly type apr_time_t literals }
+//#define APR_TIME_C(val) APR_INT64_C(val)
+
+{ mechanism to properly print apr_time_t values }
+// APR_TIME_T_FMT = APR_INT64_T_FMT;
+
+{ intervals for I/O timeouts, in microseconds }
+ apr_interval_time_t = apr_int64_t;
+ Papr_interval_time_t = ^apr_interval_time_t;
+{ short interval for I/O timeouts, in microseconds }
+ apr_short_interval_time_t = apr_int32_t;
+
+{ number of microseconds per second }
+// APR_USEC_PER_SEC APR_TIME_C(1000000)
+
+{ @return apr_time_t as a second }
+//#define apr_time_sec(time) ((time) / APR_USEC_PER_SEC)
+
+{ @return apr_time_t as a usec }
+//#define apr_time_usec(time) ((time) % APR_USEC_PER_SEC)
+
+{ @return apr_time_t as a msec }
+//#define apr_time_msec(time) (((time) / 1000) % 1000)
+
+{ @return apr_time_t as a msec }
+//#define apr_time_as_msec(time) ((time) / 1000)
+
+{ @return a second as an apr_time_t }
+//#define apr_time_from_sec(sec) ((apr_time_t)(sec) * APR_USEC_PER_SEC)
+
+{ @return a second and usec combination as an apr_time_t }
+//#define apr_time_make(sec, usec) ((apr_time_t)(sec) * APR_USEC_PER_SEC \
+// + (apr_time_t)(usec))
+
+{
+ * @return the current time
+ }
+function apr_time_now: apr_time_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_time_now' + LibSuff0;
+
+{ @see apr_time_exp_t }
+type
+ Papr_time_exp_t = ^apr_time_exp_t;
+
+{
+ * a structure similar to ANSI struct tm with the following differences:
+ * - tm_usec isn't an ANSI field
+ * - tm_gmtoff isn't an ANSI field (it's a bsdism)
+ }
+ apr_time_exp_t = record
+ { microseconds past tm_sec }
+ tm_usec: apr_int32_t;
+ { (0-61) seconds past tm_min }
+ tm_sec: apr_int32_t;
+ { (0-59) minutes past tm_hour }
+ tm_min: apr_int32_t;
+ { (0-23) hours past midnight }
+ tm_hour: apr_int32_t;
+ { (1-31) day of the month }
+ tm_mday: apr_int32_t;
+ { (0-11) month of the year }
+ tm_mon: apr_int32_t;
+ { year since 1900 }
+ tm_year: apr_int32_t;
+ { (0-6) days since sunday }
+ tm_wday: apr_int32_t;
+ { (0-365) days since jan 1 }
+ tm_yday: apr_int32_t;
+ { daylight saving time }
+ tm_isdst: apr_int32_t;
+ { seconds east of UTC }
+ tm_gmtoff: apr_int32_t;
+ end;
+
+{
+ * convert an ansi time_t to an apr_time_t
+ * @param result the resulting apr_time_t
+ * @param input the time_t to convert
+ }
+function apr_time_ansi_put(result: Papr_time_t;
+ input: time_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_time_ansi_put' + LibSuff8;
+
+{
+ * convert a time to its human readable components using an offset
+ * from GMT
+ * @param result the exploded time
+ * @param input the time to explode
+ * @param offs the number of seconds offset to apply
+ }
+function apr_time_exp_tz(result: Papr_time_exp_t;
+ input: apr_time_t; offs: apr_int32_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_time_exp_tz' + LibSuff16;
+
+{
+ * convert a time to its human readable components in GMT timezone
+ * @param result the exploded time
+ * @param input the time to explode
+ }
+function apr_time_exp_gmt(result: Papr_time_exp_t;
+ input: apr_time_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_time_exp_gmt' + LibSuff12;
+
+{
+ * convert a time to its human readable components in local timezone
+ * @param result the exploded time
+ * @param input the time to explode
+ }
+function apr_time_exp_lt(result: Papr_time_exp_t;
+ input: apr_time_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_time_exp_lt' + LibSuff12;
+
+{
+ * Convert time value from human readable format to a numeric apr_time_t
+ * e.g. elapsed usec since epoch
+ * @param result the resulting imploded time
+ * @param input the input exploded time
+ }
+function apr_time_exp_get(result: Papr_time_t;
+ input: Papr_time_exp_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_time_exp_get' + LibSuff8;
+
+{
+ * Convert time value from human readable format to a numeric apr_time_t that
+ * always represents GMT
+ * @param result the resulting imploded time
+ * @param input the input exploded time
+ }
+function apr_time_exp_gmt_get(result: Papr_time_t;
+ input: Papr_time_exp_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_time_exp_gmt_get' + LibSuff8;
+
+{
+ * Sleep for the specified number of micro-seconds.
+ * @param t desired amount of time to sleep.
+ * @warning May sleep for longer than the specified time.
+ }
+procedure apr_sleep(t: apr_interval_time_t);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_sleep' + LibSuff8;
+
+{ length of a RFC822 Date }
+const APR_RFC822_DATE_LEN = (30);
+{
+ * apr_rfc822_date formats dates in the RFC822
+ * format in an efficient manner. It is a fixed length
+ * format which requires the indicated amount of storage,
+ * including the trailing null byte.
+ * @param date_str String to write to.
+ * @param t the time to convert
+ }
+function apr_rfc822_date(date_str: PChar; t: apr_time_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_rfc822_date' + LibSuff12;
+
+{ length of a CTIME date }
+const APR_CTIME_LEN = (25);
+{
+ * apr_ctime formats dates in the ctime() format
+ * in an efficient manner. it is a fixed length format
+ * and requires the indicated amount of storage including
+ * the trailing null byte.
+ * Unlike ANSI/ISO C ctime(), apr_ctime() does not include
+ * a \n at the end of the string.
+ * @param date_str String to write to.
+ * @param t the time to convert
+ }
+function apr_ctime(date_str: PChar; t: apr_time_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_ctime' + LibSuff12;
+
+{
+ * formats the exploded time according to the format specified
+ * @param s string to write to
+ * @param retsize The length of the returned string
+ * @param max The maximum length of the string
+ * @param format The format for the time string
+ * @param tm The time to convert
+ }
+function apr_strftime(s: PChar; retsize: apr_size_t;
+ max: apr_size_t; const format: PChar;
+ tm: Papr_time_exp_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_strftime' + LibSuff20;
+
+{
+ * Improve the clock resolution for the lifetime of the given pool.
+ * Generally this is only desireable on benchmarking and other very
+ * time-sensitive applications, and has no impact on most platforms.
+ * @param p The pool to associate the finer clock resolution
+ }
+procedure apr_time_clock_hires(p: Papr_pool_t);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_time_clock_hires' + LibSuff4;
+
diff --git a/packages/httpd22/src/apr/apr_user.inc b/packages/httpd22/src/apr/apr_user.inc
new file mode 100644
index 0000000000..90383fad37
--- /dev/null
+++ b/packages/httpd22/src/apr/apr_user.inc
@@ -0,0 +1,161 @@
+{ Copyright 2000-2005 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed 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.
+ }
+
+{
+ * @file apr_user.h
+ * @brief APR User ID Services
+ }
+
+{#include "apr.h"
+#include "apr_errno.h"
+#include "apr_pools.h"}
+
+{
+ * @defgroup apr_user User and Group ID Services
+ * @ingroup APR
+ }
+
+{
+ * Structure for determining user ownership.
+ }
+type
+{$ifdef WINDOWS}
+ apr_uid_t = PSID;
+{$else}
+ apr_uid_t = uid_t;
+{$endif}
+
+ Papr_uid_t = ^apr_uid_t;
+
+{
+ * Structure for determining group ownership.
+ }
+{$ifdef WINDOWS}
+ apr_gid_t = PSID;
+{$else}
+ apr_gid_t = gid_t;
+{$endif}
+
+ Papr_gid_t = ^apr_gid_t;
+
+{$define APR_HAS_USER}
+
+{$ifdef APR_HAS_USER}
+
+{
+ * Get the userid (and groupid) of the calling process
+ * @param userid Returns the user id
+ * @param groupid Returns the user's group id
+ * @param p The pool from which to allocate working space
+ * @remark This function is available only if APR_HAS_USER is defined.
+ }
+function apr_uid_current(userid: Papr_uid_t; groupid: Papr_gid_t;
+ p: Papr_pool_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_uid_current' + LibSuff12;
+
+{
+ * Get the user name for a specified userid
+ * @param username Pointer to new string containing user name (on output)
+ * @param userid The userid
+ * @param p The pool from which to allocate the string
+ * @remark This function is available only if APR_HAS_USER is defined.
+ }
+function apr_uid_name_get(username: PPChar; userid: apr_uid_t;
+ p: Papr_pool_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_uid_name_get' + LibSuff12;
+
+{
+ * Get the userid (and groupid) for the specified username
+ * @param userid Returns the user id
+ * @param groupid Returns the user's group id
+ * @param username The username to lookup
+ * @param p The pool from which to allocate working space
+ * @remark This function is available only if APR_HAS_USER is defined.
+ }
+function apr_uid_get(userid: Papr_uid_t; groupid: Papr_gid_t;
+ const username: PChar; p: Papr_pool_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_uid_get' + LibSuff16;
+
+{
+ * Get the home directory for the named user
+ * @param dirname Pointer to new string containing directory name (on output)
+ * @param username The named user
+ * @param p The pool from which to allocate the string
+ * @remark This function is available only if APR_HAS_USER is defined.
+ }
+function apr_uid_homepath_get(dirname: PPChar; const username: PChar;
+ p: Papr_pool_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_uid_homepath_get' + LibSuff12;
+
+{
+ * Compare two user identifiers for equality.
+ * @param left One uid to test
+ * @param right Another uid to test
+ * @return APR_SUCCESS if the apr_uid_t strutures identify the same user,
+ * APR_EMISMATCH if not, APR_BADARG if an apr_uid_t is invalid.
+ * @remark This function is available only if APR_HAS_USER is defined.
+ }
+{$ifdef WINDOWS}
+//APR_DECLARE(apr_status_t) apr_uid_compare(apr_uid_t left, apr_uid_t right);
+
+{$else}
+//#define apr_uid_compare(left,right) (((left) == (right)) ? APR_SUCCESS : APR_EMISMATCH)
+{$endif}
+
+{
+ * Get the group name for a specified groupid
+ * @param groupname Pointer to new string containing group name (on output)
+ * @param groupid The groupid
+ * @param p The pool from which to allocate the string
+ * @remark This function is available only if APR_HAS_USER is defined.
+ }
+function apr_gid_name_get(groupname: PPChar; groupid: apr_gid_t;
+ p: Papr_pool_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_gid_name_get' + LibSuff12;
+
+{
+ * Get the groupid for a specified group name
+ * @param groupid Pointer to the group id (on output)
+ * @param groupname The group name to look up
+ * @param p The pool from which to allocate the string
+ * @remark This function is available only if APR_HAS_USER is defined.
+ }
+function apr_gid_get(groupid: Papr_gid_t; const groupname: PChar;
+ p: Papr_pool_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_gid_get' + LibSuff12;
+
+{
+ * Compare two group identifiers for equality.
+ * @param left One gid to test
+ * @param right Another gid to test
+ * @return APR_SUCCESS if the apr_gid_t strutures identify the same group,
+ * APR_EMISMATCH if not, APR_BADARG if an apr_gid_t is invalid.
+ * @remark This function is available only if APR_HAS_USER is defined.
+ }
+{$ifdef WINDOWS}
+//APR_DECLARE(apr_status_t) apr_gid_compare(apr_gid_t left, apr_gid_t right);
+{$else}
+//#define apr_gid_compare(left,right) (((left) == (right)) ? APR_SUCCESS : APR_EMISMATCH)
+{$endif}
+
+{$endif} { ! APR_HAS_USER }
+
diff --git a/packages/httpd22/src/apr/apr_version.inc b/packages/httpd22/src/apr/apr_version.inc
new file mode 100644
index 0000000000..1427eb45bd
--- /dev/null
+++ b/packages/httpd22/src/apr/apr_version.inc
@@ -0,0 +1,141 @@
+{ Copyright 2000-2005 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed 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.
+ }
+
+//#include "apr.h"
+
+{
+ * @file apr_version.h
+ * @brief APR Versioning Interface
+ *
+ * APR's Version
+ *
+ * There are several different mechanisms for accessing the version. There
+ * is a string form, and a set of numbers; in addition, there are constants
+ * which can be compiled into your application, and you can query the library
+ * being used for its actual version.
+ *
+ * Note that it is possible for an application to detect that it has been
+ * compiled against a different version of APR by use of the compile-time
+ * constants and the use of the run-time query function.
+ *
+ * APR version numbering follows the guidelines specified in:
+ *
+ * http://apr.apache.org/versioning.html
+ }
+
+{ The numeric compile-time version constants. These constants are the
+ * authoritative version numbers for APR.
+ }
+
+const
+{ major version
+ * Major API changes that could cause compatibility problems for older
+ * programs such as structure size changes. No binary compatibility is
+ * possible across a change in the major version.
+ }
+ APR_MAJOR_VERSION = 1;
+
+{ minor version
+ * Minor API changes that do not cause binary compatibility problems.
+ * Reset to 0 when upgrading APR_MAJOR_VERSION
+ }
+ APR_MINOR_VERSION = 2;
+
+{ patch level
+ * The Patch Level never includes API changes, simply bug fixes.
+ * Reset to 0 when upgrading APR_MINOR_VERSION
+ }
+ APR_PATCH_VERSION = 7;
+
+{$if defined(APR_IS_DEV_VERSION) or defined(DOXYGEN)}
+{ Internal: string form of the "is dev" flag }
+ APR_IS_DEV_STRING = '-dev';
+{$else}
+ APR_IS_DEV_STRING = '';
+{$endif}
+
+{ APR_STRINGIFY is defined here, and also in apr_general.h, so wrap it }
+{#ifndef APR_STRINGIFY
+/** Properly quote a value as a string in the C preprocessor */
+#define APR_STRINGIFY(n) APR_STRINGIFY_HELPER(n)
+/** Helper macro for APR_STRINGIFY */
+#define APR_STRINGIFY_HELPER(n) #n
+#endif}
+
+{
+ * The symbol APR_IS_DEV_VERSION is only defined for internal,
+ * "development" copies of APR. It is undefined for released versions
+ * of APR.
+ }
+{$undef APR_IS_DEV_VERSION}
+
+
+{ The formatted string of APR's version }
+{#define APR_VERSION_STRING \
+ APR_STRINGIFY(APR_MAJOR_VERSION) "." \
+ APR_STRINGIFY(APR_MINOR_VERSION) "." \
+ APR_STRINGIFY(APR_PATCH_VERSION) \
+ APR_IS_DEV_STRING}
+
+{ An alternative formatted string of APR's version }
+{ macro for Win32 .rc files using numeric csv representation }
+{#define APR_VERSION_STRING_CSV APR_MAJOR_VERSION ##, \
+ ##APR_MINOR_VERSION ##, \
+ ##APR_PATCH_VERSION}
+
+
+//#ifndef APR_VERSION_ONLY
+
+{ The C language API to access the version at run time,
+ * as opposed to compile time. APR_VERSION_ONLY may be defined
+ * externally when preprocessing apr_version.h to obtain strictly
+ * the C Preprocessor macro declarations.
+ }
+
+//#include "apr.h"
+
+{
+ * The numeric version information is broken out into fields within this
+ * structure.
+ }
+type
+ apr_version_t = record
+ major: Integer; {< major number }
+ minor: Integer; {< minor number }
+ patch: Integer; {< patch number }
+ is_dev: Integer; {< is development (1 or 0) }
+ end;
+
+ Papr_version_t = ^apr_version_t;
+
+{
+ * Return APR's version information information in a numeric form.
+ *
+ * @param pvsn Pointer to a version structure for returning the version
+ * information.
+ }
+procedure apr_version(pvsn: Papr_version_t);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_version' + LibSuff4;
+
+{ Return APR's version information as a string. }
+function apr_version_string: PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPR name LibNamePrefix + 'apr_version_string' + LibSuff0;
+
+
+//#endif
+
diff --git a/packages/httpd22/src/apriconv/api_version.inc b/packages/httpd22/src/apriconv/api_version.inc
new file mode 100644
index 0000000000..e92d5e83f7
--- /dev/null
+++ b/packages/httpd22/src/apriconv/api_version.inc
@@ -0,0 +1,99 @@
+{ Copyright 2000-2004 The Apache Software Foundation
+ *
+ * Licensed 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.
+ }
+
+{#include "apr.h"
+#include "apr_version.h"
+
+#include "apr_iconv.h"}
+
+{
+ * @file api_version.h
+ * @brief
+ *
+ * APR-iconv's Version
+ *
+ * There are several different mechanisms for accessing the version. There
+ * is a string form, and a set of numbers; in addition, there are constants
+ * which can be compiled into your application, and you can query the library
+ * being used for its actual version.
+ *
+ * Note that it is possible for an application to detect that it has been
+ * compiled against a different version of API by use of the compile-time
+ * constants and the use of the run-time query function.
+ *
+ * API version numbering follows the guidelines specified in:
+ *
+ * http://apr.apache.org/versioning.html
+ }
+
+{ The numeric compile-time version constants. These constants are the
+ * authoritative version numbers for API.
+ }
+
+{ major version
+ * Major API changes that could cause compatibility problems for older
+ * programs such as structure size changes. No binary compatibility is
+ * possible across a change in the major version.
+ }
+const
+ API_MAJOR_VERSION = 0;
+
+{
+ * Minor API changes that do not cause binary compatibility problems.
+ * Should be reset to 0 when upgrading API_MAJOR_VERSION
+ }
+ API_MINOR_VERSION = 9;
+
+{ patch level }
+ API_PATCH_VERSION = 7;
+
+{
+ * This symbol is defined for internal, "development" copies of API. This
+ * symbol will be #undef'd for releases.
+ }
+{ #define API_IS_DEV_VERSION }
+
+
+{ The formatted string of API's version }
+{#define API_VERSION_STRING \
+ APR_STRINGIFY(API_MAJOR_VERSION) "." \
+ APR_STRINGIFY(API_MINOR_VERSION) "." \
+ APR_STRINGIFY(API_PATCH_VERSION) \
+ API_IS_DEV_STRING}
+
+{
+ * Return APR-util's version information information in a numeric form.
+ *
+ * @param pvsn Pointer to a version structure for returning the version
+ * information.
+ }
+//procedure api_version(pvsn: Papr_version_t);
+// {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+// external LibAPRIconv name LibNamePrefix + 'api_version' + LibSuff4;
+
+{ Return API's version information as a string. }
+//function api_version_string: PChar;
+// {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+// external LibAPRIconv name LibNamePrefix + 'api_version_string' + LibSuff0;
+
+
+{ Internal: string form of the "is dev" flag }
+const
+{$ifdef API_IS_DEV_VERSION}
+ API_IS_DEV_STRING = '-dev';
+{$else}
+ API_IS_DEV_STRING = '';
+{$endif}
+
diff --git a/packages/httpd22/src/apriconv/apr_iconv.inc b/packages/httpd22/src/apriconv/apr_iconv.inc
new file mode 100644
index 0000000000..6550e17669
--- /dev/null
+++ b/packages/httpd22/src/apriconv/apr_iconv.inc
@@ -0,0 +1,113 @@
+{-
+ * Copyright (c) 1999,2000
+ * Konstantin Chuguev. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by Konstantin Chuguev
+ * and its contributors.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ }
+
+{#include "apr.h"
+#include "apr_pools.h"
+#include <stddef.h>}
+
+{
+ * API_DECLARE_EXPORT is defined when building the libapriconv dynamic
+ * library, so that all public symbols are exported.
+ *
+ * API_DECLARE_STATIC is defined when including the apriconv public headers,
+ * to provide static linkage when the dynamic library may be unavailable.
+ *
+ * API_DECLARE_STATIC and API_DECLARE_EXPORT are left undefined when
+ * including the apr-iconv public headers, to import and link the symbols
+ * from the dynamic libapriconv library and assure appropriate indirection
+ * and calling conventions at compile time.
+ }
+
+//#if !defined(WIN32)
+{
+ * The public apr-iconv functions are declared with API_DECLARE(), so they
+ * use the most portable calling convention. Public apr-iconv functions
+ * with variable arguments must use API_DECLARE_NONSTD().
+ *
+ * @deffunc API_DECLARE(rettype) apr_func(args);
+ }
+//#define API_DECLARE(type) type
+{
+ * The private apr-iconv functions are declared with API_DECLARE_NONSTD(),
+ * so they use the most optimal C language calling conventions.
+ *
+ * @deffunc API_DECLARE(rettype) apr_func(args);
+ }
+//#define API_DECLARE_NONSTD(type) type
+{
+ * All exported apr-iconv variables are declared with API_DECLARE_DATA
+ * This assures the appropriate indirection is invoked at compile time.
+ *
+ * @deffunc API_DECLARE_DATA type apr_variable;
+ * @tip extern API_DECLARE_DATA type apr_variable; syntax is required for
+ * declarations within headers to properly import the variable.
+ }
+{#define API_DECLARE_DATA
+#elif defined(API_DECLARE_STATIC)
+#define API_DECLARE(type) type __stdcall
+#define API_DECLARE_NONSTD(type) type
+#define API_DECLARE_DATA
+#elif defined(API_DECLARE_EXPORT)
+#define API_DECLARE(type) __declspec(dllexport) type __stdcall
+#define API_DECLARE_NONSTD(type) __declspec(dllexport) type
+#define API_DECLARE_DATA __declspec(dllexport)
+#else
+#define API_DECLARE(type) __declspec(dllimport) type __stdcall
+#define API_DECLARE_NONSTD(type) __declspec(dllimport) type
+#define API_DECLARE_DATA __declspec(dllimport)
+#endif}
+
+{
+ * apr_iconv_t: charset conversion descriptor type
+ }
+type
+ apr_iconv_t = Pointer;
+ Papr_iconv_t = ^apr_iconv_t;
+
+{ __BEGIN_DECLS }
+
+function apr_iconv_open(const param1, param2: PChar;
+ param3: Papr_pool_t; param4: Papr_iconv_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPRIconv name LibNamePrefix + 'apr_iconv_open' + LibSuff16;
+
+function apr_iconv(param1: apr_iconv_t; const param2: PPChar;
+ param3: Papr_pool_t; param4: PPchar;
+ param5, param6: Papr_size_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPRIconv name LibNamePrefix + 'apr_iconv' + LibSuff24;
+
+function apr_iconv_close(param1: apr_iconv_t; param2: Papr_pool_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPRIconv name LibNamePrefix + 'apr_iconv_close' + LibSuff8;
+
+{ __END_DECLS }
+
diff --git a/packages/httpd22/src/apriconv/apriconv.pas b/packages/httpd22/src/apriconv/apriconv.pas
new file mode 100644
index 0000000000..1f819e23b5
--- /dev/null
+++ b/packages/httpd22/src/apriconv/apriconv.pas
@@ -0,0 +1,59 @@
+{
+ apriconv.pas
+
+ Copyright (C) 2006 Felipe Monteiro de Carvalho
+
+ This unit is a pascal binding for the Apache 2.0.58 headers.
+ The headers were released under the following copyright:
+}
+{ Copyright 2000-2005 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed 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.
+ }
+unit apriconv;
+
+interface
+
+{$ifdef fpc}
+ {$mode delphi}{$H+}
+{$endif}
+
+{$IFNDEF FPC}
+ {$DEFINE WINDOWS}
+{$ENDIF}
+
+{$IFDEF WIN32}
+ {$DEFINE WINDOWS}
+{$ENDIF}
+
+{$ifdef Unix}
+ {$PACKRECORDS C}
+{$endif}
+
+uses apr;
+
+const
+{$IFDEF WINDOWS}
+ LibAPRIconv = 'libapriconv.dll';
+{$ELSE}
+ LibAPRIconv = '';
+{$ENDIF}
+
+{$include apr_iconv.inc}
+{$include api_version.inc}
+
+implementation
+
+end.
+
diff --git a/packages/httpd22/src/aprutil/apr_md5.inc b/packages/httpd22/src/aprutil/apr_md5.inc
new file mode 100644
index 0000000000..8ce2525156
--- /dev/null
+++ b/packages/httpd22/src/aprutil/apr_md5.inc
@@ -0,0 +1,162 @@
+{
+ * This is work is derived from material Copyright RSA Data Security, Inc.
+ *
+ * The RSA copyright statement and Licence for that original material is
+ * included below. This is followed by the Apache copyright statement and
+ * licence for the modifications made to that material.
+ }
+
+{ Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
+ rights reserved.
+
+ License to copy and use this software is granted provided that it
+ is identified as the "RSA Data Security, Inc. MD5 Message-Digest
+ Algorithm" in all material mentioning or referencing this software
+ or this function.
+
+ License is also granted to make and use derivative works provided
+ that such works are identified as "derived from the RSA Data
+ Security, Inc. MD5 Message-Digest Algorithm" in all material
+ mentioning or referencing the derived work.
+
+ RSA Data Security, Inc. makes no representations concerning either
+ the merchantability of this software or the suitability of this
+ software for any particular purpose. It is provided "as is"
+ without express or implied warranty of any kind.
+
+ These notices must be retained in any copies of any part of this
+ documentation and/or software.
+ }
+
+{ Copyright 2000-2005 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed 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.
+ }
+
+{#include "apu.h"}
+{$include apr_xlate.inc}
+
+{
+ * @file apr_md5.h
+ * @brief APR MD5 Routines
+ }
+
+{
+ * @defgroup APR_MD5 MD5 Routines
+ * @ingroup APR
+ }
+
+const
+{ The MD5 digest size }
+ APR_MD5_DIGESTSIZE = 16;
+
+{ @see apr_md5_ctx_t }
+type
+ TDigestArray = array [0..APR_MD5_DIGESTSIZE] of Char;
+
+ Papr_md5_ctx_t = ^apr_md5_ctx_t;
+
+{ MD5 context. }
+ apr_md5_ctx_t = record
+ { state (ABCD) }
+ state: array [1..4] of apr_uint32_t;
+ { number of bits, modulo 2^64 (lsb first) }
+ count: array [1..2] of apr_uint32_t;
+ { input buffer }
+ buffer: array [1..64] of Char;
+ { translation handle
+ * ignored if xlate is unsupported
+ }
+ xlate: Papr_xlate_t;
+ end;
+
+{
+ * MD5 Initialize. Begins an MD5 operation, writing a new context.
+ * @param context The MD5 context to initialize.
+ }
+function apr_md5_init(context: Papr_md5_ctx_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPRUtil name LibNamePrefix + 'apr_md5_init' + LibSuff4;
+
+{
+ * MD5 translation setup. Provides the APR translation handle to be used
+ * for translating the content before calculating the digest.
+ * @param context The MD5 content to set the translation for.
+ * @param xlate The translation handle to use for this MD5 context
+ }
+function apr_md5_set_xlate(context: Papr_md5_ctx_t;
+ xlate: Papr_xlate_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPRUtil name LibNamePrefix + 'apr_md5_set_xlate' + LibSuff8;
+
+{
+ * MD5 block update operation. Continue an MD5 message-digest operation,
+ * processing another message block, and updating the context.
+ * @param context The MD5 content to update.
+ * @param input next message block to update
+ * @param inputLen The length of the next message block
+ }
+function apr_md5_update(context: Papr_md5_ctx_t;
+ input: Pointer; inputLen: apr_size_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPRUtil name LibNamePrefix + 'apr_md5_update' + LibSuff12;
+
+{
+ * MD5 finalization. Ends an MD5 message-digest operation, writing the
+ * message digest and zeroing the context
+ * @param digest The final MD5 digest
+ * @param context The MD5 content we are finalizing.
+ }
+function apr_md5_final(digest: TDigestArray;
+ context: Papr_md5_ctx_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPRUtil name LibNamePrefix + 'apr_md5_final' + LibSuff8;
+
+{
+ * MD5 in one step
+ * @param digest The final MD5 digest
+ * @param input The message block to use
+ * @param inputLen The length of the message block
+ }
+function apr_md5(digest: TDigestArray;
+ input: Pointer; inputLen: apr_size_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPRUtil name LibNamePrefix + 'apr_md5' + LibSuff12;
+
+{
+ * Encode a password using an MD5 algorithm
+ * @param password The password to encode
+ * @param salt The salt to use for the encoding
+ * @param result The string to store the encoded password in
+ * @param nbytes The length of the string
+ }
+function apr_md5_encode(const password, salt: PChar;
+ result: PChar; nbytes: apr_size_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPRUtil name LibNamePrefix + 'apr_md5_encode' + LibSuff16;
+
+{
+ * Validate hashes created by APR-supported algorithms: md5 and sha1.
+ * hashes created by crypt are supported only on platforms that provide
+ * crypt(3), so don't rely on that function unless you know that your
+ * application will be run only on platforms that support it. On platforms
+ * that don't support crypt(3), this falls back to a clear text string
+ * comparison.
+ * @param passwd The password to validate
+ * @param hash The password to validate against
+ }
+function apr_password_validate(const passwd, hash: PChar): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPRUtil name LibNamePrefix + 'apr_password_validate' + LibSuff8;
+
diff --git a/packages/httpd22/src/aprutil/apr_uri.inc b/packages/httpd22/src/aprutil/apr_uri.inc
new file mode 100644
index 0000000000..0177eae455
--- /dev/null
+++ b/packages/httpd22/src/aprutil/apr_uri.inc
@@ -0,0 +1,170 @@
+{ Copyright 2000-2005 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed 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.
+ }
+
+{
+ * apr_uri.h: External Interface of apr_uri.c
+ }
+
+{
+ * @file apr_uri.h
+ * @brief APR-UTIL URI Routines
+ }
+
+{#include "apu.h"
+
+#include "apr_network_io.h"}
+
+{
+ * @defgroup APR_Util_URI URI
+ * @ingroup APR_Util
+ }
+const
+ APR_URI_FTP_DEFAULT_PORT = 21; {< default FTP port }
+ APR_URI_SSH_DEFAULT_PORT = 22; {< default SSH port }
+ APR_URI_TELNET_DEFAULT_PORT = 23; {< default telnet port }
+ APR_URI_GOPHER_DEFAULT_PORT = 70; {< default Gopher port }
+ APR_URI_HTTP_DEFAULT_PORT = 80; {< default HTTP port }
+ APR_URI_POP_DEFAULT_PORT = 110; {< default POP port }
+ APR_URI_NNTP_DEFAULT_PORT = 119; {< default NNTP port }
+ APR_URI_IMAP_DEFAULT_PORT = 143; {< default IMAP port }
+ APR_URI_PROSPERO_DEFAULT_PORT = 191; {< default Prospero port }
+ APR_URI_WAIS_DEFAULT_PORT = 210; {< default WAIS port }
+ APR_URI_LDAP_DEFAULT_PORT = 389; {< default LDAP port }
+ APR_URI_HTTPS_DEFAULT_PORT = 443; {< default HTTPS port }
+ APR_URI_RTSP_DEFAULT_PORT = 554; {< default RTSP port }
+ APR_URI_SNEWS_DEFAULT_PORT = 563; {< default SNEWS port }
+ APR_URI_ACAP_DEFAULT_PORT = 674; {< default ACAP port }
+ APR_URI_NFS_DEFAULT_PORT = 2049; {< default NFS port }
+ APR_URI_TIP_DEFAULT_PORT = 3372; {< default TIP port }
+ APR_URI_SIP_DEFAULT_PORT = 5060; {< default SIP port }
+
+{ Flags passed to unparse_uri_components(): }
+{ suppress "scheme://user\@site:port" }
+ APR_URI_UNP_OMITSITEPART = (1 shl 0);
+{ Just omit user }
+ APR_URI_UNP_OMITUSER = (1 shl 1);
+{ Just omit password }
+ APR_URI_UNP_OMITPASSWORD = (1 shl 2);
+{ omit "user:password\@" part }
+ APR_URI_UNP_OMITUSERINFO = (APR_URI_UNP_OMITUSER or APR_URI_UNP_OMITPASSWORD);
+{ Show plain text password (default: show XXXXXXXX) }
+ APR_URI_UNP_REVEALPASSWORD = (1 shl 3);
+{ Show "scheme://user\@site:port" only }
+ APR_URI_UNP_OMITPATHINFO = (1 shl 4);
+{ Omit the "?queryarg" from the path }
+ APR_URI_UNP_OMITQUERY = (1 shl 5);
+
+type
+{ @see apr_uri_t }
+ Papr_uri_t = ^apr_uri_t;
+
+{
+ * A structure to encompass all of the fields in a uri
+ }
+ apr_uri_t = record
+ { scheme ("http"/"ftp"/...) }
+ scheme: PChar;
+ { combined [user[:password]\@]host[:port] }
+ hostinfo: PChar;
+ { user name, as in http://user:passwd\@host:port/ }
+ user: PChar;
+ { password, as in http://user:passwd\@host:port/ }
+ password: PChar;
+ { hostname from URI (or from Host: header) }
+ hostname: PChar;
+ { port string (integer representation is in "port") }
+ port_str: PChar;
+ { the request path (or "/" if only scheme://host was given) }
+ path: PChar;
+ { Everything after a '?' in the path, if present }
+ query: PChar;
+ { Trailing "#fragment" string, if present }
+ fragment: PChar;
+
+ { structure returned from gethostbyname() }
+ hostent: Pointer;
+
+ { The port number, numeric, valid only if port_str != NULL }
+ port: apr_port_t;
+
+ { has the structure been initialized }
+// unsigned is_initialized:1;
+
+ { has the DNS been looked up yet }
+// unsigned dns_looked_up:1;
+ { has the dns been resolved yet }
+// unsigned dns_resolved:1;
+ end;
+
+{ apr_uri.c }
+{
+ * Return the default port for a given scheme. The schemes recognized are
+ * http, ftp, https, gopher, wais, nntp, snews, and prospero
+ * @param scheme_str The string that contains the current scheme
+ * @return The default port for this scheme
+ }
+function apr_uri_port_of_scheme(const scheme_str: PChar): apr_port_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPRUtil name LibNamePrefix + 'apr_uri_port_of_scheme' + LibSuff4;
+
+{
+ * Unparse a apr_uri_t structure to an URI string. Optionally
+ * suppress the password for security reasons.
+ * @param p The pool to allocate out of
+ * @param uptr All of the parts of the uri
+ * @param flags How to unparse the uri. One of:
+ * <PRE>
+ * APR_URI_UNP_OMITSITEPART Suppress "scheme://user\@site:port"
+ * APR_URI_UNP_OMITUSER Just omit user
+ * APR_URI_UNP_OMITPASSWORD Just omit password
+ * APR_URI_UNP_OMITUSERINFO Omit "user:password\@" part
+ * APR_URI_UNP_REVEALPASSWORD Show plain text password (default: show XXXXXXXX)
+ * APR_URI_UNP_OMITPATHINFO Show "scheme://user\@site:port" only
+ * APR_URI_UNP_OMITQUERY Omit "?queryarg" or "#fragment"
+ * </PRE>
+ * @return The uri as a string
+ }
+function apr_uri_unparse(p: Papr_pool_t; const uptr: Papr_uri_t;
+ flags: cuint): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPRUtil name LibNamePrefix + 'apr_uri_unparse' + LibSuff12;
+
+{
+ * Parse a given URI, fill in all supplied fields of a apr_uri_t
+ * structure. This eliminates the necessity of extracting host, port,
+ * path, query info repeatedly in the modules.
+ * @param p The pool to allocate out of
+ * @param uri The uri to parse
+ * @param uptr The apr_uri_t to fill out
+ * @return APR_SUCCESS for success or error code
+ }
+function apr_uri_parse(p: Papr_pool_t; const uri: PChar;
+ uptr: Papr_uri_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPRUtil name LibNamePrefix + 'apr_uri_parse' + LibSuff12;
+
+{
+ * Special case for CONNECT parsing: it comes with the hostinfo part only
+ * @param p The pool to allocate out of
+ * @param hostinfo The hostinfo string to parse
+ * @param uptr The apr_uri_t to fill out
+ * @return APR_SUCCESS for success or error code
+ }
+function apr_uri_parse_hostinfo(p: Papr_pool_t;
+ const hostinfo: PChar; uptr: Papr_uri_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPRUtil name LibNamePrefix + 'apr_uri_parse_hostinfo' + LibSuff12;
+
diff --git a/packages/httpd22/src/aprutil/apr_xlate.inc b/packages/httpd22/src/aprutil/apr_xlate.inc
new file mode 100644
index 0000000000..580c62ce3c
--- /dev/null
+++ b/packages/httpd22/src/aprutil/apr_xlate.inc
@@ -0,0 +1,155 @@
+{ Copyright 2000-2005 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed 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.
+ }
+
+{#include "apu.h"
+#include "apr_pools.h"
+#include "apr_errno.h"}
+
+{
+ * @file apr_xlate.h
+ * @brief APR I18N translation library
+ }
+
+{
+ * @defgroup APR_XLATE I18N translation library
+ * @ingroup APR
+ }
+{ Opaque translation buffer }
+type
+ Papr_xlate_t = Pointer;
+ PPapr_xlate_t = ^Papr_xlate_t;
+
+{
+ * Set up for converting text from one charset to another.
+ * @param convset The handle to be filled in by this function
+ * @param topage The name of the target charset
+ * @param frompage The name of the source charset
+ * @param pool The pool to use
+ * @remark
+ * Specify APR_DEFAULT_CHARSET for one of the charset
+ * names to indicate the charset of the source code at
+ * compile time. This is useful if there are literal
+ * strings in the source code which must be translated
+ * according to the charset of the source code.
+ * APR_DEFAULT_CHARSET is not useful if the source code
+ * of the caller was not encoded in the same charset as
+ * APR at compile time.
+ *
+ * @remark
+ * Specify APR_LOCALE_CHARSET for one of the charset
+ * names to indicate the charset of the current locale.
+ *
+ * @remark
+ * Return APR_EINVAL if unable to procure a convset, or APR_ENOTIMPL
+ * if charset transcoding is not available in this instance of
+ * apr-util at all (i.e., APR_HAS_XLATE is undefined).
+ }
+function apr_xlate_open(convset: PPapr_xlate_t;
+ const topage, frompage: PChar; pool: Papr_pool_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPRUtil name LibNamePrefix + 'apr_xlate_open' + LibSuff16;
+
+{
+ * This is to indicate the charset of the sourcecode at compile time
+ * names to indicate the charset of the source code at
+ * compile time. This is useful if there are literal
+ * strings in the source code which must be translated
+ * according to the charset of the source code.
+ }
+//#define APR_DEFAULT_CHARSET (const char *)0
+{
+ * To indicate charset names of the current locale
+ }
+//#define APR_LOCALE_CHARSET (const char *)1
+
+{
+ * Find out whether or not the specified conversion is single-byte-only.
+ * @param convset The handle allocated by apr_xlate_open, specifying the
+ * parameters of conversion
+ * @param onoff Output: whether or not the conversion is single-byte-only
+ * @remark
+ * Return APR_ENOTIMPL if charset transcoding is not available
+ * in this instance of apr-util (i.e., APR_HAS_XLATE is undefined).
+ }
+function apr_xlate_sb_get(convset: Papr_xlate_t; onoff: PInteger): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPRUtil name LibNamePrefix + 'apr_xlate_sb_get' + LibSuff8;
+
+{
+ * Convert a buffer of text from one codepage to another.
+ * @param convset The handle allocated by apr_xlate_open, specifying
+ * the parameters of conversion
+ * @param inbuf The address of the source buffer
+ * @param inbytes_left Input: the amount of input data to be translated
+ * Output: the amount of input data not yet translated
+ * @param outbuf The address of the destination buffer
+ * @param outbytes_left Input: the size of the output buffer
+ * Output: the amount of the output buffer not yet used
+ * @remark
+ * Returns APR_ENOTIMPL if charset transcoding is not available
+ * in this instance of apr-util (i.e., APR_HAS_XLATE is undefined).
+ * Returns APR_INCOMPLETE if the input buffer ends in an incomplete
+ * multi-byte character.
+ *
+ * To correctly terminate the output buffer for some multi-byte
+ * character set encodings, a final call must be made to this function
+ * after the complete input string has been converted, passing
+ * the inbuf and inbytes_left parameters as NULL. (Note that this
+ * mode only works from version 1.1.0 onwards)
+ }
+function apr_xlate_conv_buffer(convset: Papr_xlate_t; const inbuf: PChar;
+ inbytes_left: Papr_size_t; outbuf: PChar; outbytes_left: Papr_size_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPRUtil name LibNamePrefix + 'apr_xlate_conv_buffer' + LibSuff20;
+
+{ @see apr_file_io.h the comment in apr_file_io.h about this hack }
+{$ifdef APR_NOT_DONE_YET}
+{
+ * The purpose of apr_xlate_conv_char is to translate one character
+ * at a time. This needs to be written carefully so that it works
+ * with double-byte character sets.
+ * @param convset The handle allocated by apr_xlate_open, specifying the
+ * parameters of conversion
+ * @param inchar The character to convert
+ * @param outchar The converted character
+ }
+APU_DECLARE(apr_status_t) apr_xlate_conv_char(apr_xlate_t *convset,
+ char inchar, char outchar);
+{$endif}
+
+{
+ * Convert a single-byte character from one charset to another.
+ * @param convset The handle allocated by apr_xlate_open, specifying the
+ * parameters of conversion
+ * @param inchar The single-byte character to convert.
+ * @warning This only works when converting between single-byte character sets.
+ * -1 will be returned if the conversion can't be performed.
+ }
+function apr_xlate_conv_byte(convset: Papr_xlate_t; inchar: Char): apr_int32_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPRUtil name LibNamePrefix + 'apr_xlate_conv_byte' + LibSuff8;
+
+{
+ * Close a codepage translation handle.
+ * @param convset The codepage translation handle to close
+ * @remark
+ * Return APR_ENOTIMPL if charset transcoding is not available
+ * in this instance of apr-util (i.e., APR_HAS_XLATE is undefined).
+ }
+function apr_xlate_close(convset: Papr_xlate_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPRUtil name LibNamePrefix + 'apr_xlate_close' + LibSuff4;
+
diff --git a/packages/httpd22/src/aprutil/apr_xml.inc b/packages/httpd22/src/aprutil/apr_xml.inc
new file mode 100644
index 0000000000..89c2284a3c
--- /dev/null
+++ b/packages/httpd22/src/aprutil/apr_xml.inc
@@ -0,0 +1,367 @@
+{ Copyright 2000-2005 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed 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.
+ }
+{
+ * @file apr_xml.h
+ * @brief APR-UTIL XML Library
+ }
+
+{
+ * @defgroup APR_Util_XML XML
+ * @ingroup APR_Util
+ }
+{#include "apr_pools.h"
+#include "apr_tables.h"
+#include "apr_file_io.h"
+
+#include "apu.h"
+#if APR_CHARSET_EBCDIC
+#include "apr_xlate.h"
+#endif
+}
+
+{
+ * @package Apache XML library
+ }
+
+{ -------------------------------------------------------------------- }
+
+{ ### these will need to move at some point to a more logical spot }
+
+{ @see apr_text }
+type
+ Papr_text = ^apr_text;
+
+ { Structure to keep a linked list of pieces of text }
+
+ apr_text = record
+ { The current piece of text }
+ text: PChar;
+ { a pointer to the next piece of text }
+ next: Papr_text;
+ end;
+
+{ @see apr_text_header }
+ Papr_text_header = ^apr_text_header;
+
+{ A list of pieces of text }
+ apr_text_header = record
+ { The first piece of text in the list }
+ first: Papr_text;
+ { The last piece of text in the list }
+ last: Papr_text;
+ end;
+
+{
+ * Append a piece of text to the end of a list
+ * @param p The pool to allocate out of
+ * @param hdr The text header to append to
+ * @param text The new text to append
+ }
+procedure apr_text_append(p: Papr_pool_t; hdr: Papr_text_header;
+ const text: PChar);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPRUtil name LibNamePrefix + 'apr_text_append' + LibSuff12;
+
+{ --------------------------------------------------------------------
+**
+** XML PARSING
+}
+
+{
+** Qualified namespace values
+**
+** APR_XML_NS_DAV_ID
+** We always insert the "DAV:" namespace URI at the head of the
+** namespace array. This means that it will always be at ID==0,
+** making it much easier to test for.
+**
+** APR_XML_NS_NONE
+** This special ID is used for two situations:
+**
+** 1) The namespace prefix begins with "xml" (and we do not know
+** what it means). Namespace prefixes with "xml" (any case) as
+** their first three characters are reserved by the XML Namespaces
+** specification for future use. mod_dav will pass these through
+** unchanged. When this identifier is used, the prefix is LEFT in
+** the element/attribute name. Downstream processing should not
+** prepend another prefix.
+**
+** 2) The element/attribute does not have a namespace.
+**
+** a) No prefix was used, and a default namespace has not been
+** defined.
+** b) No prefix was used, and the default namespace was specified
+** to mean "no namespace". This is done with a namespace
+** declaration of: xmlns=""
+** (this declaration is typically used to override a previous
+** specification for the default namespace)
+**
+** In these cases, we need to record that the elem/attr has no
+** namespace so that we will not attempt to prepend a prefix.
+** All namespaces that are used will have a prefix assigned to
+** them -- mod_dav will never set or use the default namespace
+** when generating XML. This means that "no prefix" will always
+** mean "no namespace".
+**
+** In both cases, the XML generation will avoid prepending a prefix.
+** For the first case, this means the original prefix/name will be
+** inserted into the output stream. For the latter case, it means
+** the name will have no prefix, and since we never define a default
+** namespace, this means it will have no namespace.
+**
+** Note: currently, mod_dav understands the "xmlns" prefix and the
+** "xml:lang" attribute. These are handled specially (they aren't
+** left within the XML tree), so the APR_XML_NS_NONE value won't ever
+** really apply to these values.
+}
+const
+ APR_XML_NS_DAV_ID = 0; {< namespace ID for "DAV:" }
+ APR_XML_NS_NONE = -10; {< no namespace for this elem/attr }
+
+ APR_XML_NS_ERROR_BASE = -100; {< used only during processing }
+{ Is this namespace an error? }
+// APR_XML_NS_IS_ERROR(e) ((e) <= APR_XML_NS_ERROR_BASE)
+
+type
+{ @see apr_xml_attr }
+ Papr_xml_attr = ^apr_xml_attr;
+{ @see apr_xml_elem }
+ Papr_xml_elem = ^apr_xml_elem;
+{ @see apr_xml_doc }
+ Papr_xml_doc = ^apr_xml_doc;
+ PPapr_xml_doc = ^Papr_xml_doc;
+
+{ apr_xml_attr: holds a parsed XML attribute }
+ apr_xml_attr = record
+ { attribute name }
+ name: PChar;
+ { index into namespace array }
+ ns: Integer;
+
+ { attribute value }
+ value: PChar;
+
+ { next attribute }
+ next: Papr_xml_attr;
+ end;
+
+{ apr_xml_elem: holds a parsed XML element }
+ apr_xml_elem = record
+ { element name }
+ name: PChar;
+ { index into namespace array }
+ ns: Integer;
+ { xml:lang for attrs/contents }
+ lang: PChar;
+
+ { cdata right after start tag }
+ first_cdata: apr_text_header;
+ { cdata after MY end tag }
+ following_cdata: apr_text_header;
+
+ { parent element }
+ parent: Papr_xml_elem;
+ { next (sibling) element }
+ next: Papr_xml_elem;
+ { first child element }
+ first_child: Papr_xml_elem;
+ { first attribute }
+ attr: Papr_xml_attr;
+
+ { used only during parsing }
+ { last child element }
+ last_child: Papr_xml_elem;
+ { namespaces scoped by this elem }
+ ns_scope: Papr_xml_ns_scope;
+
+ { used by modules during request processing }
+ { Place for modules to store private data }
+ priv: Pointer;
+ end;
+
+{ Is this XML element empty? }
+//#define APR_XML_ELEM_IS_EMPTY(e) ((e)->first_child == NULL && \
+// (e)->first_cdata.first == NULL)
+
+{ apr_xml_doc: holds a parsed XML document }
+ apr_xml_doc = record
+ { root element }
+ root: Papr_xml_elem;
+ { array of namespaces used }
+ namespaces: Papr_array_header_t;
+ end;
+
+{ Opaque XML parser structure }
+ apr_xml_parser = record end;
+ Papr_xml_parser = ^apr_xml_parser;
+ PPapr_xml_parser = ^Papr_xml_parser;
+
+{
+ * Create an XML parser
+ * @param pool The pool for allocating the parser and the parse results.
+ * @return The new parser.
+ }
+function apr_xml_parser_create(pool: Papr_pool_t): Papr_xml_parser;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPRUtil name LibNamePrefix + 'apr_xml_parser_create' + LibSuff4;
+
+{
+ * Parse a File, producing a xml_doc
+ * @param p The pool for allocating the parse results.
+ * @param parser A pointer to *parser (needed so calling function can get
+ * errors), will be set to NULL on successfull completion.
+ * @param ppdoc A pointer to *apr_xml_doc (which has the parsed results in it)
+ * @param xmlfd A file to read from.
+ * @param buffer_length Buffer length which would be suitable
+ * @return Any errors found during parsing.
+ }
+function apr_xml_parse_file(p: Papr_pool_t;
+ parser: PPapr_xml_parser; ppdoc: PPapr_xml_doc;
+ xmlfd: Papr_file_t; buffer_length: apr_size_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPRUtil name LibNamePrefix + 'apr_xml_parse_file' + LibSuff20;
+
+{
+ * Feed input into the parser
+ * @param parser The XML parser for parsing this data.
+ * @param data The data to parse.
+ * @param len The length of the data.
+ * @return Any errors found during parsing.
+ * @remark Use apr_xml_parser_geterror() to get more error information.
+ }
+function apr_xml_parser_feed(parser: Papr_xml_parser;
+ const data: PChar; len: apr_size_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPRUtil name LibNamePrefix + 'apr_xml_parser_feed' + LibSuff12;
+
+{
+ * Terminate the parsing and return the result
+ * @param parser The XML parser for parsing this data.
+ * @param pdoc The resulting parse information. May be NULL to simply
+ * terminate the parsing without fetching the info.
+ * @return Any errors found during the final stage of parsing.
+ * @remark Use apr_xml_parser_geterror() to get more error information.
+ }
+function apr_xml_parser_done(parser: Papr_xml_parser;
+ pdoc: PPapr_xml_doc): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPRUtil name LibNamePrefix + 'apr_xml_parser_done' + LibSuff8;
+
+{
+ * Fetch additional error information from the parser.
+ * @param parser The XML parser to query for errors.
+ * @param errbuf A buffer for storing error text.
+ * @param errbufsize The length of the error text buffer.
+ * @return The error buffer
+ }
+function apr_xml_parser_geterror(parser: Papr_xml_parser;
+ errbuf: PChar; errbufsize: apr_size_t): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPRUtil name LibNamePrefix + 'apr_xml_parser_geterror' + LibSuff12;
+
+{
+ * Converts an XML element tree to flat text
+ * @param p The pool to allocate out of
+ * @param elem The XML element to convert
+ * @param style How to covert the XML. One of:
+ * <PRE>
+ * APR_XML_X2T_FULL start tag, contents, end tag
+ * APR_XML_X2T_INNER contents only
+ * APR_XML_X2T_LANG_INNER xml:lang + inner contents
+ * APR_XML_X2T_FULL_NS_LANG FULL + ns defns + xml:lang
+ * </PRE>
+ * @param namespaces The namespace of the current XML element
+ * @param ns_map Namespace mapping
+ * @param pbuf Buffer to put the converted text into
+ * @param psize Size of the converted text
+ }
+procedure apr_xml_to_text(p: Papr_pool_t; const elem: Papr_xml_elem;
+ style: Integer; namespaces: Papr_array_header_t;
+ ns_map: PInteger; const pbuf: PPChar; psize: Papr_size_t);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPRUtil name LibNamePrefix + 'apr_xml_to_text' + LibSuff28;
+
+{ style argument values: }
+const
+ APR_XML_X2T_FULL = 0; {< start tag, contents, end tag }
+ APR_XML_X2T_INNER = 1; {< contents only }
+ APR_XML_X2T_LANG_INNER = 2; {< xml:lang + inner contents }
+ APR_XML_X2T_FULL_NS_LANG = 3; {< FULL + ns defns + xml:lang }
+
+{
+ * empty XML element
+ * @param p The pool to allocate out of
+ * @param elem The XML element to empty
+ * @return the string that was stored in the XML element
+ }
+function apr_xml_empty_elem(p: Papr_pool_t; const elem: Papr_xml_elem): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPRUtil name LibNamePrefix + 'apr_xml_empty_elem' + LibSuff8;
+
+{
+ * quote an XML string
+ * Replace '<', '>', and '&' with '&lt;', '&gt;', and '&amp;'.
+ * @param p The pool to allocate out of
+ * @param s The string to quote
+ * @param quotes If quotes is true, then replace '"' with '&quot;'.
+ * @return The quoted string
+ * @note If the string does not contain special characters, it is not
+ * duplicated into the pool and the original string is returned.
+ }
+function apr_xml_quote_string(p: Papr_pool_t; const s: PChar;
+ quotes: Integer): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPRUtil name LibNamePrefix + 'apr_xml_quote_string' + LibSuff12;
+
+{
+ * Quote an XML element
+ * @param p The pool to allocate out of
+ * @param elem The element to quote
+ }
+procedure apr_xml_quote_elem(p: Papr_pool_t; elem: Papr_xml_elem);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPRUtil name LibNamePrefix + 'apr_xml_quote_elem' + LibSuff8;
+
+{ manage an array of unique URIs: apr_xml_insert_uri() and APR_XML_URI_ITEM() }
+
+{
+ * return the URI's (existing) index, or insert it and return a new index
+ * @param uri_array array to insert into
+ * @param uri The uri to insert
+ * @return int The uri's index
+ }
+function apr_xml_insert_uri(uri_array: Papr_array_header_t;
+ const uri: PChar): Integer;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPRUtil name LibNamePrefix + 'apr_xml_insert_uri' + LibSuff8;
+
+{ Get the URI item for this XML element }
+//#define APR_XML_GET_URI_ITEM(ary, i) (((const char * const *)(ary)->elts)[i])
+
+{$ifdef APR_CHARSET_EBCDIC}
+{
+ * Convert parsed tree in EBCDIC
+ * @param p The pool to allocate out of
+ * @param pdoc The apr_xml_doc to convert.
+ * @param xlate The translation handle to use.
+ * @return Any errors found during conversion.
+ }
+function apr_xml_parser_convert_doc(p: Papr_pool_t;
+ pdoc: Papr_xml_doc; convset: Papr_xlate_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibAPRUtil name LibNamePrefix + 'apr_xml_parser_convert_doc' + LibSuff12;
+{$endif}
+
diff --git a/packages/httpd22/src/aprutil/aprutil.pas b/packages/httpd22/src/aprutil/aprutil.pas
new file mode 100644
index 0000000000..e20627c5dc
--- /dev/null
+++ b/packages/httpd22/src/aprutil/aprutil.pas
@@ -0,0 +1,64 @@
+{
+ aprutil.pas
+
+ Copyright (C) 2006 Felipe Monteiro de Carvalho
+
+ This unit is a pascal binding for the Apache 2.0.58 headers.
+ The headers were released under the following copyright:
+}
+{ Copyright 2000-2005 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed 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.
+ }
+unit aprutil;
+
+interface
+
+{$ifdef fpc}
+ {$mode delphi}{$H+}
+{$endif}
+
+{$IFNDEF FPC}
+ {$DEFINE WINDOWS}
+{$ENDIF}
+
+{$IFDEF WIN32}
+ {$DEFINE WINDOWS}
+{$ENDIF}
+
+{$ifdef Unix}
+ {$PACKRECORDS C}
+{$endif}
+
+uses
+{$ifdef WINDOWS}
+ Windows,
+{$ENDIF}
+ apr, ctypes;
+
+const
+{$IFDEF WINDOWS}
+ LibAPRUtil = 'libaprutil.dll';
+{$ELSE}
+ LibAPRUtil = '';
+{$ENDIF}
+
+{$include apr_xml.inc}
+{$include apr_uri.inc}
+{$include apr_md5.inc}
+
+implementation
+
+end.
+
diff --git a/packages/httpd22/src/http_config.inc b/packages/httpd22/src/http_config.inc
new file mode 100644
index 0000000000..913cd1d7f7
--- /dev/null
+++ b/packages/httpd22/src/http_config.inc
@@ -0,0 +1,1206 @@
+{ 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.
+ }
+
+{
+ Declarations from other files centered here
+}
+const
+ (* Hook orderings *)
+ (** run this hook first, before ANYTHING *)
+ APR_HOOK_REALLY_FIRST = -10;
+ (** run this hook first *)
+ APR_HOOK_FIRST = 0;
+ (** run this hook somewhere *)
+ APR_HOOK_MIDDLE = 10;
+ (** run this hook after every other hook which is defined*)
+ APR_HOOK_LAST = 20;
+ (** run this hook last, after EVERYTHING *)
+ APR_HOOK_REALLY_LAST = 30;
+
+
+{
+ * @file http_config.h
+ * @brief Apache Configuration
+ *
+ * @defgroup APACHE_CORE_CONFIG Configuration
+ * @ingroup APACHE_CORE
+ }
+
+//#include "apr_hooks.h"
+{.$include util_cfgtree.inc}
+
+{
+ * @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.
+ }
+const
+ OR_NONE = 0; {< *.conf is not available anywhere in this override }
+ OR_LIMIT = 1; {< *.conf inside <Directory> or <Location>
+ and .htaccess when AllowOverride Limit }
+ OR_OPTIONS = 2; {< *.conf anywhere
+ and .htaccess when AllowOverride Options }
+ OR_FILEINFO = 4; {< *.conf anywhere
+ and .htaccess when AllowOverride FileInfo }
+ OR_AUTHCFG = 8; {< *.conf inside <Directory> or <Location>
+ and .htaccess when AllowOverride AuthConfig }
+ OR_INDEXES = 16; {< *.conf anywhere
+ and .htaccess when AllowOverride Indexes }
+ OR_UNSET = 32; {< unset a directive (in Allow) }
+ ACCESS_CONF = 64; {< *.conf inside <Directory> or <Location> }
+ RSRC_CONF = 128; {< *.conf outside <Directory> or <Location> }
+ 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 }
+ OR_ALL = (OR_LIMIT or OR_OPTIONS or OR_FILEINFO or OR_AUTHCFG or 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.
+ }
+const
+ DECLINE_CMD = '\a\b';
+
+{
+ * 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...
+ }
+type
+ 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 }
+ TAKE_ARGV {< an argc and argv are passed }
+ );
+
+{
+ * 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*...
+ }
+ Pcmd_parms = ^cmd_parms_struct;
+
+//#if defined(AP_HAVE_DESIGNATED_INITIALIZER) || defined(DOXYGEN)
+
+{
+ * All the types of functions that can be used in directives
+ * @internal
+ }
+
+ { function to call for a no-args }
+ no_args_t = function (parms: Pcmd_parms; mconfig: Pointer): PChar; cdecl;
+ { function to call for a raw-args }
+ raw_args_t = function (parms: Pcmd_parms; mconfig: Pointer; const args: PChar): PChar; cdecl;
+ { function to call for a argv/argc }
+ take_argv_t = function (parms: Pcmd_parms; mconfig: Pointer; argc: cint; argv: array of PChar): PChar; cdecl;
+ { function to call for a take1 }
+ take1_t = function (parms: Pcmd_parms; mconfig: Pointer; const w: PChar): PChar; cdecl;
+ { function to call for a take2 }
+ take2_t = function (parms: Pcmd_parms; mconfig: Pointer; const w, w2: PChar): PChar; cdecl;
+ { function to call for a take3 }
+ take3_t = function (parms: Pcmd_parms; mconfig: Pointer; const w, w2, w3: PChar): PChar; cdecl;
+ { function to call for a flag }
+ flag_t = function (parms: Pcmd_parms; mconfig: Pointer; on_: Integer): PChar; cdecl;
+
+ cmd_func_kind = ( cfk_no_args, cfk_raw_args, cfk_take_argv, cfk_take1, cfk_take2, cfk_take3, cfk_flag);
+ cmd_func = record
+ case cmd_func_kind of
+ cfk_no_args : ( func_no_args : no_args_t );
+ cfk_raw_args : ( func_raw_args : raw_args_t );
+ cfk_take_argv : ( func_take_argv : take_argv_t);
+ cfk_take1 : ( func_take1 : take1_t);
+ cfk_take2 : ( func_take2 : take2_t);
+ cfk_take3 : ( func_take3 : take3_t);
+ cfk_flag : ( func_flag : flag_t);
+ end;
+ Pcmd_func = ^cmd_func;
+
+//const
+ { This configuration directive does not take any arguments }
+// AP_NO_ARGS = func.no_args;
+ { This configuration directive will handle it's own parsing of arguments}
+// AP_RAW_ARGS = func.raw_args;
+ { This configuration directive will handle it's own parsing of arguments}
+//# define AP_TAKE_ARGV func.take_argv
+ { This configuration directive takes 1 argument}
+// AP_TAKE1 = func.take1;
+ { This configuration directive takes 2 arguments }
+// AP_TAKE2 = func.take2;
+ { This configuration directive takes 3 arguments }
+// AP_TAKE3 = func.take3;
+ { This configuration directive takes a flag (on/off) as a argument}
+// 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 with raw argument parsing }
+//# define AP_INIT_TAKE_ARGV(directive, func, mconfig, where, help) \
+// { directive, { .take_argv=func }, mconfig, where, TAKE_ARGV, 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_TAKE_ARGV 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_TAKE_ARGV(directive, func, mconfig, where, help) \
+ { directive, func, mconfig, where, TAKE_ARGV, 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.
+ }
+ command_struct = record
+ { Name of this command }
+ name: PChar;
+ { The function to be called when this directive is parsed }
+ func: cmd_func;
+ { Extra data, for functions which implement multiple commands... }
+ cmd_data: Pointer;
+ { What overrides need to be allowed to enable this command. }
+ req_override: Integer;
+ { What the command expects as arguments
+ * @defvar cmd_how args_how}
+ args_how: cmd_how;
+
+ { 'usage' message, in case of syntax errors }
+ errmsg: PChar;
+ end;
+ command_rec = command_struct;
+ Pcommand_rec = ^command_rec;
+
+ { Constants here were moved up }
+
+ { Common structure for reading of config files / passwd files etc. }
+
+ getch_t = function (param: Pointer): Integer;
+
+ getstr_t = function (buf: Pointer; bufsiz: size_t; param: Pointer): Pointer;
+
+ close_t = function (param: Pointer): Integer;
+
+ ap_configfile_t = record
+ getch: getch_t; {< a getc()-like function }
+ getstr: getstr_t; {< a fgets()-like function }
+ close: close_t; {< a close handler function }
+ param: Pointer; {< the argument passed to getch/getstr/close }
+ name: PChar; {< the filename / description }
+ line_number: cuint;{< current line number, starting at 1 }
+ end;
+
+ Pap_configfile_t = ^ap_configfile_t;
+ PPap_configfile_t = ^Pap_configfile_t;
+
+{
+ * 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*...
+ }
+ cmd_parms_struct = record
+ { Argument to command from cmd_table }
+ info: Pointer;
+ { Which allow-override bits are set }
+ override_: Integer;
+ { Which methods are <Limit>ed }
+ limited: apr_int64_t;
+ { methods which are limited }
+ limited_xmethods: Papr_array_header_t;
+ { methods which are xlimited }
+ xlimited: Pap_method_list_t;
+
+ { Config file structure. }
+ config_file: Pap_configfile_t;
+ { the directive specifying this command }
+ directive: Pap_directive_t;
+
+ { Pool to allocate new storage in }
+ pool: Papr_pool_t;
+ { Pool for scratch memory; persists during configuration, but
+ * wiped before the first request is served... }
+ temp_pool: Papr_pool_t;
+ { Server_rec being configured for }
+ server: Pserver_rec;
+ { 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). }
+ path: PChar;
+ { configuration command }
+ cmd: Pcommand_rec;
+
+ { per_dir_config vector passed to handle_command }
+ context: Pap_conf_vector_t;
+ { directive with syntax error }
+ err_directive: Pap_directive_t;
+
+ { Which allow-override-opts bits are set }
+ override_opts: cint;
+ end;
+
+ cmd_parms = cmd_parms_struct;
+
+{
+ * Module structures. Just about everything is dispatched through
+ * these, directly or indirectly (through the command and handler
+ * tables).
+ }
+type
+ Pmodule_struct = ^module_struct;
+
+ module_struct = record
+ { API version, *not* module version; check that module is
+ * compatible with this version of the server.
+ }
+ version: Integer;
+ { API minor version. Provides API feature milestones. Not checked
+ * during module init }
+ minor_version: Integer;
+ { Index to this modules structures in config vectors. }
+ module_index: Integer;
+
+ { The name of the module's C file }
+ name: PChar;
+ { The handle for the DSO. Internal use only }
+ dynamic_load_handle: Pointer;
+
+ { A pointer to the next module in the list
+ * @defvar module_struct *next }
+ next: Pmodule_struct;
+
+ { Magic Cookie to identify a module structure; It's mainly
+ * important for the DSO facility (see also mod_so). }
+ magic: Cardinal;
+
+ { 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.
+ }
+ rewrite_args: procedure(process: Pprocess_rec); cdecl;
+
+ { 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
+ }
+ create_dir_config: function(p: Papr_pool_t; dir: PChar): Pointer; cdecl;
+
+ { 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
+ }
+ merge_dir_config: function(p: Papr_pool_t; base_conf: Pointer;
+ new_conf: Pointer): Pointer; cdecl;
+
+ { 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
+ }
+ create_server_config: function(p: Papr_pool_t; s: Pserver_rec): Pointer; cdecl;
+
+ { 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
+ }
+ merge_server_config: function(p: Papr_pool_t; base_conf: Pointer;
+ new_conf: Pointer): Pointer; cdecl;
+
+ { A command_rec table that describes all of the directives this module
+ * defines. }
+ cmds: Pcommand_rec;
+
+ { 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
+ }
+ register_hooks: procedure(p: Papr_pool_t); cdecl;
+ end;
+
+ module = module_struct;
+ Pmodule = ^module;
+ PPmodule = ^Pmodule;
+
+{
+ * @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 }
+procedure STANDARD20_MODULE_STUFF(var mod_: module);
+
+{ Use this only in MPMs }
+procedure MPM20_MODULE_STUFF(var mod_: module);
+
+{ CONFIGURATION VECTOR FUNCTIONS }
+
+{ configuration vector structure - Moved to httpd.pas}
+
+{
+ ap_get_module_config, ap_set_module_config are both commented out because even thought
+ they are on the headers, they are not present on the libhttpd.dll library.
+}
+
+{
+ * 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
+ }
+{
+ Function not found on the dll
+}
+//function ap_get_module_config(const cv: Pap_conf_vector_t; const m: Pmodule): Pointer;
+// {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+// external LibHTTPD name LibNamePrefix + 'ap_get_module_config' + LibSuff8;
+
+{
+ * 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
+ }
+//procedure ap_set_module_config(const cv: Pap_conf_vector_t; const m: Pmodule;
+// val: Pointer);
+// {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+// external LibHTTPD name LibNamePrefix + 'ap_set_module_config' + LibSuff12;
+
+{$ifndef AP_DEBUG}
+
+function ap_get_module_config(v: Pap_conf_vector_t; m: Pmodule): Pap_conf_vector_t;
+
+procedure ap_set_module_config(v: Pap_conf_vector_t; m: Pmodule; val: Pap_conf_vector_t);
+
+{$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
+ }
+function ap_set_string_slot(cmd: Pcmd_parms; struct_ptr: Pointer; const arg: PChar): PChar;
+ cdecl; external LibHTTPD name 'ap_set_string_slot';
+
+{
+ * 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
+ }
+function ap_set_int_slot(cmd: Pcmd_parms; struct_ptr: Pointer; const arg: PChar): PChar;
+ cdecl; external LibHTTPD name 'ap_set_int_slot';
+
+{
+ * 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
+ }
+function ap_method_is_limited(cmd: Pcmd_parms; const method: PChar): Integer;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_method_is_limited' + LibSuff8;
+
+{
+ * 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
+ }
+function ap_set_string_slot_lower(cmd: Pcmd_parms; struct_ptr: Pointer; const arg: PChar): PChar;
+ cdecl; external LibHTTPD name 'ap_set_string_slot_lower';
+
+{
+ * 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
+ }
+function ap_set_flag_slot(cmd: Pcmd_parms; struct_ptr: Pointer; const arg: PChar): PChar;
+ cdecl; external LibHTTPD name 'ap_set_flag_slot';
+
+{
+ * 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
+ }
+function ap_set_file_slot(cmd: Pcmd_parms; struct_ptr: Pointer; const arg: PChar): PChar;
+ cdecl; external LibHTTPD name 'ap_set_file_slot';
+
+{
+ * 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>
+ }
+function ap_set_deprecated(cmd: Pcmd_parms; struct_ptr: Pointer; const arg: PChar): PChar;
+ cdecl; external LibHTTPD name 'ap_set_deprecated';
+
+{
+ * 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
+ }
+function ap_server_root_relative(p: Papr_pool_t; const fname: PChar): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_server_root_relative' + LibSuff8;
+
+{ 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
+ }
+function ap_add_module(m: Pmodule; p: Papr_pool_t): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_add_module' + LibSuff8;
+
+{
+ * 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
+ }
+procedure ap_remove_module(m: Pmodule);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_remove_module' + LibSuff4;
+
+{
+ * 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
+ }
+procedure ap_add_loaded_module(mod_: Pmodule; p: Papr_pool_t);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_add_loaded_module' + LibSuff8;
+
+{
+ * Remove a module fromthe chained modules list and the list of loaded modules
+ * @param m the module structure of the module to remove
+ }
+procedure ap_remove_loaded_module(m: Pmodule);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_remove_loaded_module' + LibSuff4;
+
+{
+ * Find the name of the specified module
+ * @param m The module to get the name for
+ * @return the name of the module
+ }
+function ap_find_module_name(m: Pmodule): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_find_module_name' + LibSuff4;
+
+{
+ * 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
+ }
+function ap_find_linked_module(const name: PChar): Pmodule;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_find_linked_module' + LibSuff4;
+
+{
+ * 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
+ }
+function ap_pcfg_openfile(ret_cfg: PPap_configfile_t;
+ p: Papr_pool_t; const name: PChar): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_pcfg_openfile' + LibSuff12;
+
+{
+ * 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
+ }
+type
+ getc_func_t = function (param: Pointer): Integer;
+ gets_func_t = function (buf: Pointer; bufsiz: size_t; param: Pointer): Pointer;
+ close_func_t = function (param: Pointer): Integer;
+
+function ap_pcfg_open_custom(p: Papr_pool_t;
+ const descr: PChar; param: Pointer;
+ getc_func: getc_func_t; gets_func: gets_func_t;
+ close_func: close_func_t): Pap_configfile_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_pcfg_open_custom' + LibSuff24;
+
+{
+ * 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
+ }
+function ap_cfg_getline(bug: PChar;
+ bufsize: size_t; cfp: Pap_configfile_t): Integer;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_cfg_getline' + LibSuff12;
+
+{
+ * Read one char from open configfile_t, increase line number upon LF
+ * @param cfp The file to read from
+ * @return the character read
+ }
+function ap_cfg_getc(cfp: Pap_configfile_t): Integer;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_cfg_getc' + LibSuff4;
+
+{
+ * Detach from open ap_configfile_t, calling the close handler
+ * @param cfp The file to close
+ * @return 1 on sucess, 0 on failure
+ }
+function ap_cfg_closefile(cfp: Pap_configfile_t): Integer;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_cfg_closefile' + LibSuff4;
+
+{
+ * 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
+ }
+function ap_soak_end_container(cmd: Pcmd_parms; directive: PChar): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_soak_end_container' + LibSuff8;
+
+{
+ * 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
+}
+function ap_build_cont_config(p, temp_pool: Papr_pool_t;
+ parms: Pcmd_parms; current, curr_parent: PPap_directive_t;
+ orig_directive: PChar): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_build_cont_config' + LibSuff24;
+
+{
+ * 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
+ }
+function ap_build_config(parms: Pcmd_parms;
+ conf_pool, temp_pool: Papr_pool_t; conftree: PPap_directive_t): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_build_config' + LibSuff16;
+
+{
+ * 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
+ }
+function ap_walk_config(conftree: Pap_directive_t;
+ parms: Pcmd_parms; section_vector: Pap_conf_vector_t): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_walk_config' + LibSuff12;
+
+{
+ * @defgroup ap_check_cmd_context Check command 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
+ }
+function ap_check_cmd_context(cmd: Pcmd_parms;
+ forbidden: cuint): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_check_cmd_context' + LibSuff8;
+
+const
+ NOT_IN_VIRTUALHOST = $01; {< Forbidden in <Virtualhost> }
+ NOT_IN_LIMIT = $02; {< Forbidden in <Limit> }
+ NOT_IN_DIRECTORY = $04; {< Forbidden in <Directory> }
+ NOT_IN_LOCATION = $08; {< Forbidden in <Location> }
+ NOT_IN_FILES = $10; {< Forbidden in <Files> }
+{ Forbidden in <Directory>/<Location>/<Files>}
+ NOT_IN_DIR_LOC_FILE = (NOT_IN_DIRECTORY or NOT_IN_LOCATION or NOT_IN_FILES);
+{ Forbidden in <VirtualHost>/<Limit>/<Directory>/<Location>/<Files> }
+ GLOBAL_ONLY = (NOT_IN_VIRTUALHOST or NOT_IN_LIMIT or NOT_IN_DIR_LOC_FILE);
+
+//#ifdef CORE_PRIVATE
+
+{
+ * @brief This structure is used to assign symbol names to module pointers
+ }
+type
+ ap_module_symbol_t = record
+ name: PChar;
+ modp: Pmodule;
+ end;
+
+{
+ * 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 statically linked modulenames (symbols)
+ * @defvar ap_module_symbol_t ap_prelinked_modulenames[]
+ }
+//AP_DECLARE_DATA extern ap_module_symbol_t ap_prelinked_module_symbols[];
+{
+ * 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
+ }
+procedure ap_single_module_configure(p: Papr_pool_t;
+ s: Pserver_rec; m: Pmodule);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_single_module_configure' + LibSuff12;
+
+{ 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
+ }
+function ap_setup_prelinked_modules(process: Pprocess_rec): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_setup_prelinked_modules' + LibSuff4;
+
+{
+ * 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.
+ }
+procedure ap_show_directives;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_show_directives' + LibSuff0;
+
+{
+ * Show the preloaded module names. Used for httpd -l.
+ }
+procedure ap_show_modules;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_show_modules' + LibSuff0;
+
+{
+ * Show the MPM name. Used in reporting modules such as mod_info to
+ * provide extra information to the user
+ }
+function ap_show_mpm: PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_show_mpm' + LibSuff0;
+
+{
+ * 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.
+ }
+function ap_read_config(process: Pprocess_rec;
+ temp_pool: Papr_pool_t; const config_name: PChar;
+ conftree: PPap_directive_t): Pserver_rec;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_read_config' + LibSuff16;
+
+{
+ * Run all rewrite args hooks for loaded modules
+ * @param process The process currently running the server
+ }
+procedure ap_run_rewrite_args(process: Pprocess_rec);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_run_rewrite_args' + LibSuff4;
+
+{
+ * 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
+ }
+procedure ap_register_hooks(m: Pmodule; p: Papr_pool_t);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_register_hooks' + LibSuff8;
+
+{
+ * Setup all virtual hosts
+ * @param p The pool to allocate from
+ * @param main_server The head of the server_rec list
+ }
+procedure ap_fixup_virtual_hosts(p: Papr_pool_t; main_server: Pserver_rec);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_fixup_virtual_hosts' + LibSuff8;
+
+{ 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
+ }
+function ap_create_request_config(p: Papr_pool_t): Pap_conf_vector_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_create_request_config' + LibSuff4;
+
+{
+ * Setup the config vector for per dir module configs
+ * @param p The pool to allocate the config vector from
+ * @return The config vector
+ }
+function ap_create_per_dir_config(p: Papr_pool_t): Pap_conf_vector_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_create_per_dir_config' + LibSuff4;
+
+{
+ * 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
+ }
+function ap_merge_per_dir_configs(p: Papr_pool_t;
+ base, new_conf: Pap_conf_vector_t): Pap_conf_vector_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_merge_per_dir_configs' + LibSuff12;
+
+{ 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
+ }
+function ap_create_conn_config(p: Papr_pool_t): Pap_conf_vector_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_create_conn_config' + LibSuff4;
+
+{ 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
+ }
+function ap_parse_htaccess(result: PPap_conf_vector_t;
+ r: Prequest_rec; override_: Integer; override_opts: cint;
+ const path, access_name: PChar): Integer;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_parse_htaccess' + LibSuff24;
+
+{
+ * 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
+ }
+function ap_init_virtual_host(p: Papr_pool_t;
+ const hostname: PChar; main_server: Pserver_rec;
+ ps: PPserver_rec): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_init_virtual_host' + LibSuff16;
+
+{
+ * 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
+ }
+function ap_process_resource_config(s: Pserver_rec;
+ const fname: PChar; conftree: PPap_directive_t;
+ p, ptemp: Papr_pool_t): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_process_resource_config' + LibSuff20;
+
+{
+ * 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
+ }
+function ap_process_config_tree(s: Pserver_rec;
+ conftree: Pap_directive_t; p, ptemp: Papr_pool_t): cint;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_process_config_tree' + LibSuff16;
+
+{ 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
+ }
+function ap_invoke_handler(r: Prequest_rec): Integer;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_invoke_handler' + LibSuff4;
+
+{ 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
+ }
+function ap_find_command(const name: PChar;
+ const cmds: Pcommand_rec): Pcommand_rec;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_find_command' + LibSuff8;
+
+{
+ * 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
+ }
+function ap_find_command_in_modules(const cmd_name: PChar;
+ mod_: PPmodule): Pcommand_rec;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_find_command_in_modules' + LibSuff8;
+
+{
+ * 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.
+ }
+function ap_set_config_vectors(server: Pserver_rec;
+ ection_vector: Pap_conf_vector_t; const section: PChar;
+ mod_: Pmodule; pconf: Papr_pool_t): Pointer;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_set_config_vectors' + LibSuff20;
+
+{#endif}
+
+{ Hooks }
+
+{
+ * Run the header parser functions for each module
+ * @param r The current request
+ * @return OK or DECLINED
+ }
+type
+ ap_HOOK_header_parser_t = function(r: Prequest_rec): Integer; cdecl;
+
+procedure ap_hook_header_parser(pf: ap_HOOK_header_parser_t;
+ const aszPre: PPChar; const aszSucc:
+ PPChar; nOrder: Integer);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_hook_header_parser' + LibSuff16;
+
+{
+ * 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
+ }
+type
+ ap_HOOK_pre_config_t = function(pconf: Papr_pool_t; plog: Papr_pool_t;
+ ptemp: Papr_pool_t): Integer; cdecl;
+
+procedure ap_hook_pre_config(pf: ap_HOOK_pre_config_t; const aszPre: PPChar;
+ const aszSucc: PPChar; nOrder: Integer);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_hook_pre_config' + LibSuff16;
+
+{
+ * Run the test_config function for each module; this hook is run
+ * only if the server was invoked to test the configuration syntax.
+ * @param pconf The config pool
+ * @param s The list of server_recs
+ }
+type
+ ap_HOOK_test_config_t = procedure (pconf: Papr_pool_t; s: Pserver_rec); cdecl;
+
+procedure ap_hook_test_config(pf: ap_HOOK_test_config_t; const aszPre: PPChar;
+ const aszSucc: PPChar; nOrder: Integer);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_hook_test_config' + LibSuff16;
+
+{
+ * 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
+ }
+type
+ ap_HOOK_post_config_t = function(pconf, plog, ptemp: Papr_pool_t; s: Pserver_rec): Integer; cdecl;
+
+procedure ap_hook_post_config(pf: ap_HOOK_post_config_t; const aszPre: PPChar;
+ const aszSucc: PPChar; nOrder: Integer);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_hook_post_config' + LibSuff16;
+
+{
+ * 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
+ }
+type
+ ap_HOOK_open_logs_t = function(pconf: Papr_pool_t; plog: Papr_pool_t;
+ ptemp: Papr_pool_t; s: Pserver_rec): Integer; cdecl;
+
+procedure ap_hook_open_logs(pf: ap_HOOK_open_logs_t; const aszPre: PPChar;
+ const aszSucc: PPChar; nOrder: Integer);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_hook_open_logs' + LibSuff16;
+
+{
+ * Run the child_init functions for each module
+ * @param pchild The child pool
+ * @param s The list of server_recs in this server
+ }
+type
+ ap_HOOK_child_init_t = procedure(pchild: Papr_pool_t; s: Pserver_rec); cdecl;
+
+procedure ap_hook_child_init(pf: ap_HOOK_child_init_t; const aszPre: PPChar;
+ const aszSucc: PPChar; nOrder: Integer);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_hook_child_init' + LibSuff16;
+
+{
+ * Run the handler functions for each module
+ * @param r The request_rec
+ * @remark non-wildcard handlers should HOOK_MIDDLE, wildcard HOOK_LAST
+ }
+type
+ ap_HOOK_handler_t = function(r: Prequest_rec): Integer; cdecl;
+
+procedure ap_hook_handler(pf: ap_HOOK_handler_t; const aszPre: PPChar;
+ const aszSucc: PPChar; nOrder: Integer);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_hook_handler' + LibSuff16;
+
+{
+ * 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()
+ }
+type
+ ap_HOOK_quick_handler_t = function(r: Prequest_rec;
+ lookup_uri: Integer): Integer; cdecl;
+
+procedure ap_hook_quick_handler(pf: ap_HOOK_quick_handler_t;
+ const aszPre: PPChar; const aszSucc: PPChar; nOrder: Integer);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_hook_quick_handler' + LibSuff16;
+
+{
+ * 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.
+ }
+type
+ ap_HOOK_optional_fn_retrieve_t = procedure; cdecl;
+
+procedure ap_hook_optional_fn_retrieve(pf: ap_HOOK_optional_fn_retrieve_t;
+ const aszPre: PPChar; const aszSucc: PPChar; nOrder: Integer);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_hook_optional_fn_retrieve' + LibSuff16;
+
+
diff --git a/packages/httpd22/src/http_connection.inc b/packages/httpd22/src/http_connection.inc
new file mode 100644
index 0000000000..d89dbb45d2
--- /dev/null
+++ b/packages/httpd22/src/http_connection.inc
@@ -0,0 +1,167 @@
+{ 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.
+ }
+
+{
+ * @package Apache connection library
+ }
+
+{#include "apr_hooks.h"
+#include "apr_network_io.h"
+#include "apr_buckets.h"}
+
+{
+ * @file http_connection.h
+ * @brief 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)
+ }
+procedure ap_process_connection(c: Pconn_rec; csd: Pointer);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_process_connection' + LibSuff8;
+
+{
+ * Flushes all remain data in the client send buffer
+ * @param c The connection to flush
+ }
+procedure ap_flush_conn(c: Pconn_rec);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_flush_conn' + LibSuff4;
+
+{
+ * 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
+ }
+procedure ap_lingering_close(c: Pconn_rec);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_lingering_close' + LibSuff4;
+
+//#endif COREPRIVATE
+
+ { 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.
+ }
+type
+ ap_HOOK_create_connection_t = function (p: Papr_pool_t; server: Pserver_rec;
+ csd: Papr_socket_t; conn_id: cLong; sbh: Pointer;
+ alloc: Papr_bucket_alloc_t): Pconn_rec; cdecl;
+
+procedure ap_hook_create_connection(pf: ap_HOOK_create_connection_t; const aszPre: PPChar;
+ const aszSucc: PPChar; nOrder: Integer);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_hook_create_connection' + LibSuff16;
+
+{
+ * 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)
+ }
+type
+ ap_HOOK_pre_connection_t = function (c: Pconn_rec; csd: Pointer): Integer; cdecl;
+
+procedure ap_hook_pre_connection(pf: ap_HOOK_pre_connection_t; const aszPre: PPChar;
+ const aszSucc: PPChar; nOrder: Integer);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_hook_pre_connection' + LibSuff16;
+
+{
+ * 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)
+ }
+type
+ ap_HOOK_process_connection_t = function (c: Pconn_rec): Integer; cdecl;
+
+procedure ap_hook_process_connection(pf: ap_HOOK_process_connection_t; const aszPre: PPChar;
+ const aszSucc: PPChar; nOrder: Integer);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_hook_process_connection' + LibSuff16;
+
+{ 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)
+ }
+function ap_bucket_eoc_make(b: Papr_bucket): Papr_bucket;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_bucket_eoc_make' + LibSuff4;
+
+{
+ * 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)
+ }
+function ap_bucket_eoc_create(list: Papr_bucket_alloc_t): Papr_bucket;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_bucket_eoc_create' + LibSuff4;
+
+
diff --git a/packages/httpd22/src/http_core.inc b/packages/httpd22/src/http_core.inc
new file mode 100644
index 0000000000..c4e126165f
--- /dev/null
+++ b/packages/httpd22/src/http_core.inc
@@ -0,0 +1,741 @@
+{ 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.
+ }
+
+//#include "apr.h"
+{$include apr/apr_hash.inc}
+{#include "apr_optional.h"}
+{$include util_filter.inc}
+
+{#if APR_HAVE_STRUCT_RLIMIT
+#include <sys/time.h>
+#include <sys/resource.h>
+#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).
+ }
+
+const
+{ No directives }
+ OPT_NONE = 0;
+{ Indexes directive }
+ OPT_INDEXES = 1;
+{ Includes directive }
+ OPT_INCLUDES = 2;
+{ FollowSymLinks directive }
+ OPT_SYM_LINKS = 4;
+{ ExecCGI directive }
+ OPT_EXECCGI = 8;
+{ directive unset }
+ OPT_UNSET = 16;
+{ IncludesNOEXEC directive }
+ OPT_INCNOEXEC = 32;
+{ SymLinksIfOwnerMatch directive }
+ OPT_SYM_OWNER = 64;
+{ MultiViews directive }
+ OPT_MULTI = 128;
+{ All directives }
+ OPT_ALL = (OPT_INDEXES or OPT_INCLUDES or OPT_SYM_LINKS or OPT_EXECCGI);
+
+{
+ * @defgroup get_remote_host Remote Host Resolution
+ * @ingroup APACHE_CORE_HTTPD
+ }
+{ REMOTE_HOST returns the hostname, or NULL if the hostname
+ * lookup fails. It will force a DNS lookup according to the
+ * HostnameLookups setting.
+ }
+ 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.
+ }
+ REMOTE_NAME = (1);
+
+{ REMOTE_NOLOOKUP is like REMOTE_NAME except that a DNS lookup is
+ * never forced.
+ }
+ 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.
+ }
+ REMOTE_DOUBLE_REV = (3);
+
+{ all of the requirements must be met }
+ SATISFY_ALL = 0;
+{ any of the requirements must be met }
+ SATISFY_ANY = 1;
+{ There are no applicable satisfy lines }
+ SATISFY_NOSPEC = 2;
+
+{ Make sure we don't write less than 8000 bytes at any one time.
+ }
+ AP_MIN_BYTES_TO_WRITE = 8000;
+
+{ default maximum of internal redirects }
+ AP_DEFAULT_MAX_INTERNAL_REDIRECTS = 10;
+
+{ default maximum subrequest nesting level }
+ 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)
+ }
+function ap_allow_options(r: Prequest_rec): Integer;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_allow_options' + LibSuff4;
+
+{
+ * 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)
+ }
+function ap_allow_overrides(r: Prequest_rec): Integer;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_allow_overrides' + LibSuff4;
+
+{
+ * 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)
+ }
+function ap_default_type(r: Prequest_rec): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_default_type' + LibSuff4;
+
+{
+ * 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)
+ }
+function ap_document_root(r: Prequest_rec): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_document_root' + LibSuff4;
+
+{
+ * 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)
+ }
+function ap_get_remote_host(conn: Pconn_rec; dir_config: Pointer;
+ _type: Integer; str_is_ip: PInteger): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_get_remote_host' + LibSuff16;
+
+{
+ * 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)
+ }
+function ap_get_remote_logname(r: Prequest_rec): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_get_remote_logname' + LibSuff4;
+
+{ 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)
+ }
+function ap_construct_url(p: Papr_pool_t; const uri: PChar; r: Prequest_rec): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_construct_url' + LibSuff12;
+
+{
+ * 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)
+ }
+function ap_get_server_name(r: Prequest_rec): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_get_server_name' + LibSuff4;
+
+{
+ * 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)
+ }
+function ap_get_server_port(r: Prequest_rec): apr_port_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_get_server_port' + LibSuff4;
+
+{
+ * 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)
+ }
+function ap_get_limit_req_body(r: Prequest_rec): apr_off_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_get_limit_req_body' + LibSuff4;
+
+{
+ * 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)
+ }
+function ap_get_limit_xml_body(r: Prequest_rec): size_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_get_limit_xml_body' + LibSuff4;
+
+{
+ * 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
+ }
+procedure ap_custom_response(r: Prequest_rec; status: Integer; const str: PChar);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_custom_response' + LibSuff12;
+
+{
+ * 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)
+ }
+function ap_is_recursion_limit_exceeded(r: Prequest_rec): Integer;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_is_recursion_limit_exceeded' + LibSuff4;
+
+{
+ * 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)
+ }
+function ap_exists_config_define(name: PChar): Integer;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_exists_config_define' + LibSuff4;
+
+{ FIXME! See STATUS about how }
+function ap_core_translate(r: Prequest_rec): Integer;
+ cdecl; external LibHTTPD name 'ap_core_translate';
+
+{ 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.
+ }
+
+{ A structure to keep track of authorization requirements }
+type
+ require_line = record
+ { Where the require line is in the config file. }
+ method_mask: apr_int64_t;
+ { The complete string from the command line }
+ requirement: PChar;
+ end;
+
+{
+ * 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)
+ }
+function ap_auth_type(r: Prequest_rec): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_auth_type' + LibSuff4;
+
+{
+ * Return the current Authorization realm
+ * @param r The current request
+ * @return The current authorization realm
+ * @deffunc const char *ap_auth_name(request_rec *r)
+ }
+function ap_auth_name(r: Prequest_rec): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_auth_name' + LibSuff4;
+
+{
+ * 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)
+ }
+function ap_satisfies(r: Prequest_rec): Integer;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_satisfies' + LibSuff4;
+
+{
+ * 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)
+ }
+function ap_requires(p: Papr_array_header_t): Integer;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_requires' + LibSuff4;
+
+//#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 }
+
+type
+ core_request_config = record
+ { bucket brigade used by getline for look-ahead and
+ * ap_get_client_block for holding left-over request body }
+ bb: Papr_bucket_brigade;
+
+ { 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)
+ }
+ notes: PPointer;
+
+ { 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.
+ }
+ deliver_script: Integer;
+
+ { Custom response strings registered via ap_custom_response(),
+ * or NULL; check per-dir config if nothing found here
+ }
+ response_code_strings: PPChar; { from ap_custom_response(), not from
+ * ErrorDocument
+ }
+ { Should addition of charset= be suppressed for this request?
+ }
+ suppress_charset: Integer;
+ end;
+
+{ 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())
+ }
+const
+ AP_NOTE_DIRECTORY_WALK = 0;
+ AP_NOTE_LOCATION_WALK = 1;
+ AP_NOTE_FILE_WALK = 2;
+ 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.
+ }
+function ap_register_request_note: apr_size_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_register_request_note' + LibSuff0;
+
+{
+ * 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.
+ }
+function ap_get_request_note(r: Prequest_rec; note_num: apr_size_t): PPointer;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_get_request_note' + LibSuff8;
+
+{ Per-directory configuration }
+
+type
+ allow_options_t = cuchar;
+ overrides_t = cuchar;
+
+{
+ * 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.
+ }
+ etag_components_t = culong;
+
+const
+ ETAG_UNSET = 0;
+ ETAG_NONE = (1 shl 0);
+ ETAG_MTIME = (1 shl 1);
+ ETAG_INODE = (1 shl 2);
+ ETAG_SIZE = (1 shl 3);
+ ETAG_BACKWARD = (ETAG_MTIME or ETAG_INODE or ETAG_SIZE);
+ ETAG_ALL = (ETAG_MTIME or ETAG_INODE or ETAG_SIZE);
+
+ { Hostname resolution etc }
+
+ HOSTNAME_LOOKUP_OFF = 0;
+ HOSTNAME_LOOKUP_ON = 1;
+ HOSTNAME_LOOKUP_DOUBLE = 2;
+ OSTNAME_LOOKUP_UNSET = 3;
+
+ { Hostname resolution etc }
+
+ USE_CANONICAL_NAME_OFF = (0);
+ USE_CANONICAL_NAME_ON = (1);
+ USE_CANONICAL_NAME_DNS = (2);
+ USE_CANONICAL_NAME_UNSET = (3);
+
+ { should we force a charset on any outgoing parameterless content-type?
+ * if so, which charset?
+ }
+ ADD_DEFAULT_CHARSET_OFF = (0);
+ ADD_DEFAULT_CHARSET_ON = (1);
+ ADD_DEFAULT_CHARSET_UNSET = (2);
+
+ {
+ * Run-time performance tuning
+ }
+ ENABLE_MMAP_OFF = (0);
+ ENABLE_MMAP_ON = (1);
+ ENABLE_MMAP_UNSET = (2);
+
+ ENABLE_SENDFILE_OFF = (0);
+ ENABLE_SENDFILE_ON = (1);
+ ENABLE_SENDFILE_UNSET = (2);
+
+ USE_CANONICAL_PHYS_PORT_OFF = (0);
+ USE_CANONICAL_PHYS_PORT_ON = (1);
+ USE_CANONICAL_PHYS_PORT_UNSET = (2);
+
+type
+ server_signature_e = (
+ srv_sig_unset,
+ srv_sig_off,
+ srv_sig_on,
+ srv_sig_withmail
+ );
+
+ core_dir_config = record
+
+ { path of the directory/regex/etc. see also d_is_fnmatch/absolute below }
+ d: PChar;
+ { the number of slashes in d }
+ d_components: Cardinal;
+
+ { 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.
+ }
+ opts: allow_options_t;
+ opts_add: allow_options_t;
+ opts_remove: allow_options_t;
+ override_: overrides_t;
+ override_opts: allow_options_t;
+
+ { 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...
+ }
+
+ ap_default_type: PChar;
+
+ { Authentication stuff. Groan... }
+
+ satisfy: PInteger; { for every method one }
+ ap_auth_type: PChar;
+ ap_auth_name: PChar;
+ ap_requires: Papr_array_header_t;
+
+ { 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().
+ }
+
+ response_code_strings: PPChar; { from ErrorDocument, not from
+ * ap_custom_response() }
+
+ { Hostname resolution etc }
+{ unsigned int hostname_lookups : 4; }
+
+{ signed int content_md5 : 2; }{ calculate Content-MD5? }
+
+{ 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?
+ }
+{ unsigned add_default_charset : 2; }
+ add_default_charset_name: PChar;
+
+ { System Resource Control }
+{$ifdef RLIMIT_CPU}
+ limit_cpu: Prlimit;
+{$endif}
+{$if defined(RLIMIT_DATA) or defined (RLIMIT_VMEM) or defined(RLIMIT_AS)}
+ limit_mem: Prlimit;
+{$endif}
+{$ifdef RLIMIT_NPROC}
+ limit_nproc: Prlimit;
+{$endif}
+ limit_req_body: apr_off_t; { limit on bytes in request msg body }
+ limit_xml_body: cLong; { limit on bytes in XML request msg body }
+
+ { logging options }
+
+ server_signature: server_signature_e;
+
+ loglevel: Integer;
+
+ { Access control }
+ sec_file: Papr_array_header_t;
+ r: Pap_regex_t;
+
+ mime_type: PChar; { forced with ForceType }
+ handler: PChar; { forced with SetHandler }
+ output_filters: PChar; { forced with SetOutputFilters }
+ input_filters: PChar; { forced with SetInputFilters }
+ accept_path_info: Integer; { forced with AcceptPathInfo }
+
+ ct_output_filters: Papr_hash_t; { added with AddOutputFilterByType }
+
+ {
+ * What attributes/data should be included in ETag generation?
+ }
+ etag_bits: etag_components_t;
+ etag_add: etag_components_t;
+ etag_remove: etag_components_t;
+
+ {
+ * Run-time performance tuning
+ }
+{ unsigned int enable_mmap : 2; }{ whether files in this dir can be mmap'ed }
+
+{ 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 }
+{ unsigned use_canonical_phys_port : 2;}
+ end;
+
+{ Per-server core configuration }
+
+const
+ { TRACE control }
+
+ AP_TRACE_UNSET = -1;
+ AP_TRACE_DISABLE = 0;
+ AP_TRACE_ENABLE = 1;
+ AP_TRACE_EXTENDED = 2;
+
+type
+ core_server_config = record
+
+{$ifdef GPROF}
+ gprof_dir: PChar;
+{$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:
+ }
+ ap_document_root: PChar;
+
+ { Access control }
+
+ access_name: PChar;
+ sec_dir: Papr_array_header_t;
+ sec_url: Papr_array_header_t;
+
+ { recursion backstopper }
+ redirect_limit: Integer; { maximum number of internal redirects }
+ subreq_limit: Integer; { maximum nesting level of subrequests }
+
+ protocol: PChar;
+ accf_map: Papr_table_t;
+
+ { TRACE control }
+ trace_enable: Integer;
+ end;
+
+{ 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);}
+
+{ Core filters; not exported. }
+{int ap_core_input_filter(ap_filter_t *f, apr_bucket_brigade *b,
+ ap_input_mode_t mode, apr_read_type_e block,
+ apr_off_t readbytes);
+apr_status_t ap_core_output_filter(ap_filter_t *f, apr_bucket_brigade *b);
+
+#endif} { CORE_PRIVATE }
+
+//AP_DECLARE(const char*) ap_get_server_protocol(server_rec* s);
+//AP_DECLARE(void) ap_set_server_protocol(server_rec* s, const char* proto);
+
+
+{ ----------------------------------------------------------------------
+ *
+ * Runtime status/management
+ }
+
+type
+ ap_mgmt_type_e = (
+ ap_mgmt_type_string,
+ ap_mgmt_type_long,
+ ap_mgmt_type_hash
+ );
+
+ ap_mgmt_value = record
+ case Integer of
+ 0: (s_value: PChar);
+ 1: (i_value: cLong);
+ 2: (h_value: Papr_hash_t);
+ end;
+
+ ap_mgmt_item_t = record
+ description: PChar;
+ name: PChar;
+ vtype: ap_mgmt_type_e;
+ v: ap_mgmt_value;
+ end;
+
+{ 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_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
+ }
+type
+ ap_HOOK_get_mgmt_items_t = function(p: Papr_pool_t; const val: PChar;
+ ht: Papr_hash_t): Integer; cdecl;
+
+procedure ap_hook_get_mgmt_items(pf: ap_HOOK_get_mgmt_items_t;
+ const aszPre: PPChar; const aszSucc: PPChar; nOrder: Integer);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_hook_get_mgmt_items' + LibSuff16;
+
+{ ---------------------------------------------------------------------- }
+
+{ ----------------------------------------------------------------------
+ *
+ * I/O logging with mod_logio
+ }
+
+{APR_DECLARE_OPTIONAL_FN(void, ap_logio_add_bytes_out,
+ (conn_rec *c, apr_off_t bytes));}
+
+{ ----------------------------------------------------------------------
+ *
+ * ident lookups with mod_ident
+ }
+
+{APR_DECLARE_OPTIONAL_FN(const char *, ap_ident_lookup,
+ (request_rec *r));}
+
diff --git a/packages/httpd22/src/http_log.inc b/packages/httpd22/src/http_log.inc
new file mode 100644
index 0000000000..2428d61f72
--- /dev/null
+++ b/packages/httpd22/src/http_log.inc
@@ -0,0 +1,349 @@
+{ 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.
+ }
+
+//#include "apr_thread_proc.h"
+
+{
+ * @package Apache logging library
+ }
+
+{#ifdef HAVE_SYSLOG
+#include <syslog.h>}
+
+const
+ LOG_PRIMASK = 7;
+
+ APLOG_EMERG = 0; { system is unusable }
+ APLOG_ALERT = 1; { action must be taken immediately }
+ APLOG_CRIT = 2; { critical conditions }
+ APLOG_ERR = 3; { error conditions }
+ APLOG_WARNING = 4; { warning conditions }
+ APLOG_NOTICE = 5; { normal but significant condition }
+ APLOG_INFO = 6; { informational }
+ APLOG_DEBUG = 7; { debug-level messages }
+
+ APLOG_LEVELMASK = 7; { mask off the level value }
+
+{ APLOG_NOERRNO is ignored and should not be used. It will be
+ * removed in a future release of Apache.
+ }
+ 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.
+ }
+ APLOG_TOCLIENT = ((APLOG_LEVELMASK + 1) * 2);
+
+{ normal but significant condition on startup, usually printed to stderr }
+ APLOG_STARTUP = ((APLOG_LEVELMASK + 1) * 4);
+
+ DEFAULT_LOGLEVEL = APLOG_WARNING;
+
+//extern int AP_DECLARE_DATA ap_default_loglevel;
+
+// APLOG_MARK = __FILE__,__LINE__;
+
+{
+ * Set up for logging to stderr.
+ * @param p The pool to allocate out of
+ }
+procedure ap_open_stderr_log(p: Papr_pool_t);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_open_stderr_log' + LibSuff4;
+
+{
+ * 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
+ }
+function ap_replace_stderr_log(p: Papr_pool_t;
+ file_: PChar): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_replace_stderr_log' + LibSuff8;
+
+{
+ * 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, ...)
+ }
+procedure ap_log_error(
+ const file_: PChar; line, level: Integer;
+ status: apr_status_t; const s: Pserver_rec;
+ const fmt: PChar; others: array of const);
+ cdecl; external LibHTTPD name 'ap_log_error';
+
+// __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, ...)
+ }
+procedure ap_log_perror(
+ const file_: PChar; line, level: Integer;
+ status: apr_status_t; p: Papr_pool_t;
+ const fmt: PChar; others: array of const);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name 'ap_log_perror';
+
+{ __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, ...)
+ }
+procedure ap_log_rerror(
+ const file_: PChar; line, level: Integer;
+ status: apr_status_t; const r: Prequest_rec;
+ const fmt: PChar; others: array of const);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name 'ap_log_rerror';
+
+{ __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, ...)
+ }
+procedure ap_log_cerror(
+ const file_: PChar; line, level: Integer;
+ status: apr_status_t; const c: Pconn_rec;
+ const fmt: PChar; others: array of const);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name 'ap_log_cerror';
+
+{ __attribute__((format(printf,6,7)));}
+
+{
+ * Convert stderr to the error log
+ * @param s The current server
+ * @deffunc void ap_error_log2stderr(server_rec *s)
+ }
+procedure ap_error_log2stderr(s: Pserver_rec);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_error_log2stderr' + LibSuff4;
+
+{
+ * 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
+ }
+procedure ap_log_pid(p: Papr_pool_t; const fname: PChar);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_log_pid' + LibSuff8;
+
+{
+ * 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)
+ }
+function ap_read_pid(p: Papr_pool_t; const filename: PChar; mypid: Ppid_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_read_pid' + LibSuff12;
+
+{
+ * 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.
+ }
+type
+ piped_log = record
+ { The pool to use for the piped log }
+ p: Papr_pool_t;
+ { The pipe between the server and the logging process }
+ fds: array[0..2] of Papr_file_t;
+ { 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 }
+ program: PChar;
+ { The pid of the logging process }
+ pid: Papr_proc_t;
+{$endif}
+ end;
+ Ppiped_log = ^piped_log;
+{
+ * 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)
+ }
+function ap_open_piped_log(p: Papr_pool_t; const program_: PChar): Ppiped_log;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_open_piped_log' + LibSuff8;
+
+{
+ * Close the piped log and kill the logging process
+ * @param pl The piped log structure
+ * @deffunc void ap_close_piped_log(piped_log *pl)
+ }
+procedure ap_close_piped_log(pl: Ppiped_log);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_close_piped_log' + LibSuff4;
+
+{
+ * 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])
+
+type
+ ap_HOOK_error_log_t = procedure(const _file: PChar; line: Integer;
+ level: Integer; status: apr_status_t; const s: Pserver_rec;
+ const r: Prequest_rec; p: Papr_pool_t; const errstr: PChar); cdecl;
+
+{
+ * hook method to log error messages
+ * @ingroup hooks
+ * @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 which we are logging for
+ * @param r The request which we are logging for
+ * @param pool Memory pool to allocate from
+ * @param errstr message to log
+ }
+procedure ap_hook_error_log(pf: ap_HOOK_error_log_t; const aszPre: PPChar;
+ const aszSucc: PPChar; nOrder: Integer);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_hook_error_log' + LibSuff16;
+
diff --git a/packages/httpd22/src/http_main.inc b/packages/httpd22/src/http_main.inc
new file mode 100644
index 0000000000..484f2a173b
--- /dev/null
+++ b/packages/httpd22/src/http_main.inc
@@ -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.
+ }
+
+//#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.
+ }
+const
+ AP_SERVER_BASEARGS = 'C:c:D:d:E:e:f:vVlLtSMh?X';
+
+{
+ * @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;
+
+{
+ * An optional function to send signal to server on presence of '-k'
+ * command line argument.
+ * Called if MPM defines AP_MPM_WANT_SIGNAL_SERVER
+ * @param status The exit status after sending signal
+ * @param pool Memory pool to allocate from
+ }
+//APR_DECLARE_OPTIONAL_FN(int, ap_signal_server, (int *, apr_pool_t *));
+
diff --git a/packages/httpd22/src/http_protocol.inc b/packages/httpd22/src/http_protocol.inc
new file mode 100644
index 0000000000..8ab5a5f3c7
--- /dev/null
+++ b/packages/httpd22/src/http_protocol.inc
@@ -0,0 +1,824 @@
+{ 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.
+ }
+
+{#include "httpd.h"
+#include "apr_hooks.h"
+#include "apr_portable.h"
+#include "apr_mmap.h"
+#include "apr_buckets.h"
+#include "util_filter.h"}
+
+{
+ * @package HTTP protocol handling
+ }
+
+{
+ * This hook allows modules to insert filters for the current error response
+ * @param r the current request
+ * @ingroup hooks
+ }
+type
+ ap_HOOK_insert_error_filter_t = procedure(r: Prequest_rec); cdecl;
+
+procedure ap_hook_insert_error_filter(pf: ap_HOOK_insert_error_filter_t; const aszPre: PPChar;
+ const aszSucc: PPChar; nOrder: Integer);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_hook_insert_error_filter' + LibSuff16;
+
+{ 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
+ }
+procedure ap_get_mime_headers(r: Prequest_rec);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_get_mime_headers' + LibSuff4;
+
+{
+ * Optimized version of ap_get_mime_headers() that requires a
+ * temporary brigade to work with
+ * @param r The current request
+ * @param bb temp brigade
+ }
+procedure ap_get_mime_headers_core(r: Prequest_rec; bb: Papr_bucket_brigade);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_get_mime_headers_core' + LibSuff8;
+
+{ 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)
+ }
+procedure ap_finalize_request_protocol(r: Prequest_rec);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_finalize_request_protocol' + LibSuff4;
+
+{
+ * 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)
+ }
+procedure ap_send_error_response(r: Prequest_rec; recursive_error: Integer);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_send_error_response' + LibSuff8;
+
+{ 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)
+ }
+procedure ap_set_content_length(r: Prequest_rec; length: apr_off_t);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_set_content_length' + LibSuff12;
+
+{
+ * 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)
+ }
+function ap_set_keepalive(r: Prequest_rec): Integer;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_set_keepalive' + LibSuff4;
+
+{
+ * 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)
+ }
+function ap_rationalize_mtime(r: Prequest_rec; mtime: apr_time_t): apr_time_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_rationalize_mtime' + LibSuff12;
+
+{
+ * 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);
+ }
+function ap_make_content_type(r: Prequest_rec; type_: PChar): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_make_content_type' + LibSuff8;
+
+//#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)
+ }
+procedure ap_setup_make_content_type(pool: Papr_pool_t);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_setup_make_content_type' + LibSuff4;
+
+//#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)
+ }
+function ap_make_etag(r: Prequest_rec; force_weak: Integer): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_make_etag' + LibSuff8;
+
+{
+ * Set the E-tag outgoing header
+ * @param The current request
+ * @deffunc void ap_set_etag(request_rec *r)
+ }
+procedure ap_set_etag(r: Prequest_rec);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_set_etag' + LibSuff4;
+
+{
+ * Set the last modified time for the file being sent
+ * @param r The current request
+ * @deffunc void ap_set_last_modified(request_rec *r)
+ }
+procedure ap_set_last_modified(r: Prequest_rec);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_set_last_modified' + LibSuff4;
+
+{
+ * 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)
+ }
+function ap_meets_conditions(r: Prequest_rec): Integer;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_meets_conditions' + LibSuff4;
+
+{ 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);
+ }
+function ap_send_fd(fd: Papr_file_t; r: Prequest_rec; offset: apr_off_t;
+ length: apr_size_t; nbytes: Papr_size_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_send_fd' + LibSuff24;
+
+{$ifdef 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)
+ }
+function ap_send_mmap(mm: Papr_mmap_t; r: Prequest_rec; offset, length: size_t): size_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_send_mmap' + LibSuff20;
+
+{$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.
+ }
+function ap_method_register(p: Papr_pool_t; methname: PChar): Integer;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_method_register' + LibSuff8;
+
+{
+ * Initialize the method_registry and allocate memory for it.
+ *
+ * @param p Pool to allocate memory for the registry from.
+ }
+procedure ap_method_registry_init(p: Papr_pool_t);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_method_registry_init' + LibSuff4;
+
+{
+ * 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)
+ }
+function ap_make_method_list(p: Papr_pool_t; nelts: Integer): Pap_method_list_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_make_method_list' + LibSuff8;
+
+{
+ * Copy a method list
+ *
+ * @param dest List to copy to
+ * @param src List to copy from
+ }
+procedure ap_copy_method_list(dest, src: Pap_method_list_t);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_copy_method_list' + LibSuff8;
+
+{
+ * 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)
+ }
+function ap_method_in_list(l: Pap_method_list_t; const method: PChar): Integer;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_method_in_list' + LibSuff8;
+
+{
+ * 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)
+ }
+procedure ap_method_list_add(l: Pap_method_list_t; const method: PChar);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_method_list_add' + LibSuff8;
+
+{
+ * 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)
+ }
+procedure ap_method_list_remove(l: Pap_method_list_t; const method: PChar);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_method_list_remove' + LibSuff8;
+
+{
+ * 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)
+ }
+procedure ap_clear_method_list(l: Pap_method_list_t);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_clear_method_list' + LibSuff4;
+
+{
+ * 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.
+ }
+procedure ap_set_content_type(r: Prequest_rec; const ct: PChar);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_set_content_type' + LibSuff8;
+
+{ 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)
+ }
+function ap_rputc(c: Integer; r: Prequest_rec): Integer;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_rputc' + LibSuff8;
+
+{
+ * 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)
+ }
+function ap_rputs(const str: PChar; r: Prequest_rec): Integer;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_rputs' + LibSuff8;
+
+{
+ * 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)
+ }
+function ap_rwrite(const buf: Pointer; nbyte: Integer; r: Prequest_rec): Integer;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_rwrite' + LibSuff12;
+
+{
+ * 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, ...)
+ }
+function ap_rvputs(r: Prequest_rec; others: array of const): Integer;
+ cdecl; external LibHTTPD name 'ap_rvputs';
+
+//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)
+ }
+function ap_vrprintf(r: Prequest_rec; const fmt: PChar; vlist: va_list): Integer;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_vrprintf' + LibSuff12;
+
+{
+ * 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, ...)
+ }
+function ap_rprintf(r: Prequest_rec; const fmt: PChar; others: array of const): Integer;
+ cdecl; external LibHTTPD name 'ap_rprintf';
+
+//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)
+ }
+function ap_rflush(r: Prequest_rec): Integer;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_rflush' + LibSuff4;
+
+{
+ * 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)
+ }
+function ap_index_of_response(status: Integer): Integer;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_index_of_response' + LibSuff4;
+
+{
+ * 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)
+ }
+function ap_get_status_line(status: Integer): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_get_status_line' + LibSuff4;
+
+{ 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)
+ }
+function ap_setup_client_block(r: Prequest_rec; read_policy: Integer): Integer;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_setup_client_block' + LibSuff8;
+
+{
+ * 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)
+ }
+function ap_should_client_block(r: Prequest_rec): Integer;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_should_client_block' + LibSuff4;
+
+{
+ * 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)
+ }
+function ap_get_client_block(r: Prequest_rec; buffer: PChar; bufsiz: apr_size_t): cLong;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_get_client_block' + LibSuff12;
+
+{
+ * 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)
+ }
+function ap_discard_request_body(r: Prequest_rec): Integer;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_discard_request_body' + LibSuff4;
+
+{
+ * 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)
+ }
+procedure ap_note_auth_failure(r: Prequest_rec);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_note_auth_failure' + LibSuff4;
+
+{
+ * 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)
+ }
+procedure ap_note_basic_auth_failure(r: Prequest_rec);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_note_basic_auth_failure' + LibSuff4;
+
+{
+ * 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)
+ }
+procedure ap_note_digest_auth_failure(r: Prequest_rec);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_note_digest_auth_failure' + LibSuff4;
+
+{
+ * 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)
+ }
+function ap_get_basic_auth_pw(r: Prequest_rec; pw: PPChar): Integer;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_get_basic_auth_pw' + LibSuff8;
+
+{
+ * 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)
+ }
+procedure ap_parse_uri(r: Prequest_rec; const uri: PChar);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_parse_uri' + LibSuff8;
+
+{
+ * 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)
+ }
+function ap_getline(s: PChar; n: Integer; r: Prequest_rec; fold: Integer): Integer;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_getline' + LibSuff16;
+
+{
+ * 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
+ }
+function ap_method_number_of(const method: PChar): Integer;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_method_number_of' + LibSuff4;
+
+{
+ * 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
+ }
+function ap_method_name_of(p: Papr_pool_t; methnum: Integer): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_method_name_of' + LibSuff8;
+
+
+ { 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)
+ }
+type
+ ap_HOOK_post_read_request_t = function(r: Prequest_rec): Integer; cdecl;
+
+procedure ap_hook_post_read_request(pf: ap_HOOK_post_read_request_t;
+ const aszPre: PPChar; const aszSucc: PPChar; nOrder: Integer);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_hook_post_read_request' + LibSuff16;
+
+{
+ * 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)
+ }
+type
+ ap_HOOK_log_transaction_t = function(r: Prequest_rec): Integer; cdecl;
+
+procedure ap_hook_log_transaction(pf: ap_HOOK_log_transaction_t;
+ const aszPre: PPChar; const aszSucc: PPChar; nOrder: Integer);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_hook_log_transaction' + LibSuff16;
+
+{
+ * This hook allows modules to retrieve the http scheme for a request. This
+ * allows Apache modules to easily extend the scheme that Apache understands
+ * @param r The current request
+ * @return The http method from the request
+ }
+type
+ ap_HOOK_http_method_t = function(const r: Prequest_rec): PChar; cdecl;
+
+procedure ap_hook_http_scheme(pf: ap_HOOK_http_method_t;
+ const aszPre: PPChar; const aszSucc: PPChar; nOrder: Integer);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_hook_http_scheme' + LibSuff16;
+
+{
+ * 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)
+ }
+type
+ ap_HOOK_default_port_t = function(const r: Prequest_rec): apr_port_t; cdecl;
+
+procedure ap_hook_default_port(pf: ap_HOOK_default_port_t;
+ const aszPre: PPChar; const aszSucc: PPChar; nOrder: Integer);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_hook_default_port' + LibSuff16;
+
+{
+ * 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.
+ }
+type
+ ap_bucket_error = record
+ { Number of buckets using this memory }
+ refcount: apr_bucket_refcount;
+ { The error code }
+ status: Integer;
+ { The error string }
+ data: PChar;
+ end;
+ Pap_bucket_error = ^ap_bucket_error;
+
+//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)
+ }
+function ap_bucket_error_make(b: Papr_bucket; error: Integer;
+ const buf: PChar; p: Papr_pool_t): Papr_bucket;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_bucket_error_make' + LibSuff16;
+
+{
+ * 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)
+ }
+function ap_bucket_error_create(error: Integer; const buf: PChar;
+ p: Papr_pool_t; list: Papr_bucket_alloc_t): Papr_bucket;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_bucket_error_create' + LibSuff16;
+
+function ap_byterange_filter(f: Pap_filter_t; b: Papr_bucket_brigade): apr_status_t;
+ cdecl; external LibHTTPD name 'ap_byterange_filter';
+
+function ap_http_header_filter(f: Pap_filter_t; b: Papr_bucket_brigade): apr_status_t;
+ cdecl; external LibHTTPD name 'ap_http_header_filter';
+
+function ap_content_length_filter(f: Pap_filter_t; b: Papr_bucket_brigade): apr_status_t;
+ cdecl; external LibHTTPD name 'ap_content_length_filter';
+
+function ap_old_write_filter(f: Pap_filter_t; b: Papr_bucket_brigade): apr_status_t;
+ cdecl; external LibHTTPD name 'ap_old_write_filter';
+
+{
+ * Sett up the protocol fields for subsidiary requests
+ * @param rnew New Sub Request
+ * @param r current request
+ }
+procedure ap_set_sub_req_protocol(rnew: Prequest_rec; const r: Prequest_rec);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_set_sub_req_protocol' + LibSuff8;
+
+{
+ * A wrapup function to keep the internal accounting straight.
+ * Indicates that there is no more content coming.
+ * @param sub_r Subrequest that is now compete
+ }
+procedure ap_finalize_sub_req_protocol(sub_r: Prequest_rec);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_finalize_sub_req_protocol' + LibSuff4;
+
diff --git a/packages/httpd22/src/http_request.inc b/packages/httpd22/src/http_request.inc
new file mode 100644
index 0000000000..c06eba4239
--- /dev/null
+++ b/packages/httpd22/src/http_request.inc
@@ -0,0 +1,460 @@
+{ 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.
+ }
+
+{
+ * @file http_request.h
+ * @brief Apache Request library
+ }
+
+{ 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.
+ }
+
+{#include "apr_hooks.h"
+#include "util_filter.h"}
+
+const
+ AP_SUBREQ_NO_ARGS = 0;
+ AP_SUBREQ_MERGE_ARGS = 1;
+
+{
+ * 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
+ }
+function ap_process_request_internal(r: Prequest_rec): Integer;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_process_request_internal' + LibSuff4;
+
+{
+ * 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)
+ }
+function ap_sub_req_lookup_uri(const new_uri: PChar;
+ const r: Prequest_rec; next_filter: Pap_filter_t): Prequest_rec;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_sub_req_lookup_uri' + LibSuff12;
+
+{
+ * 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)
+ }
+function ap_sub_req_lookup_file(const new_file: PChar;
+ const r: Prequest_rec; next_filter: Pap_filter_t): Prequest_rec;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_sub_req_lookup_file' + LibSuff12;
+
+{
+ * 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.
+ }
+function ap_sub_req_lookup_dirent(const finfo: Papr_finfo_t;
+ const r: Prequest_rec; subtype: Integer; next_filter: Pap_filter_t): Prequest_rec;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_sub_req_lookup_dirent' + LibSuff16;
+
+{
+ * 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)
+ }
+function ap_sub_req_method_uri(const method, new_uri: PChar;
+ const r: Prequest_rec; next_filter: Pap_filter_t): Prequest_rec;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_sub_req_method_uri' + LibSuff16;
+
+{
+ * 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)
+ }
+function ap_sub_req_output_filter(f: Pap_filter_t;
+ bb: Papr_bucket_brigade): apr_status_t;
+ cdecl; external LibHTTPD name 'ap_sub_req_output_filter';
+
+{
+ * 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)
+ }
+function ap_run_sub_req(r: Prequest_rec): Prequest_rec;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_run_sub_req' + LibSuff4;
+
+{
+ * Free the memory associated with a subrequest
+ * @param r The subrequest to finish
+ * @deffunc void ap_destroy_sub_req(request_rec *r)
+ }
+procedure ap_destroy_sub_req(r: Prequest_rec);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_destroy_sub_req' + LibSuff4;
+
+{
+ * 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)
+ }
+procedure ap_internal_redirect(const new_uri: PChar; r: Prequest_rec);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_internal_redirect' + LibSuff8;
+
+{
+ * 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)
+ }
+procedure ap_internal_redirect_handler(const new_uri: PChar; r: Prequest_rec);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_internal_redirect_handler' + LibSuff8;
+
+{
+ * 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!
+ }
+procedure ap_internal_fast_redirect(sub_req, r: Prequest_rec);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_internal_fast_redirect' + LibSuff8;
+
+{
+ * 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)
+ }
+function ap_some_auth_required(r: Prequest_rec): Integer;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_some_auth_required' + LibSuff4;
+
+{
+ * 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)
+ }
+function ap_is_initial_req(r: Prequest_rec): Integer;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_is_initial_req' + LibSuff4;
+
+{
+ * 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)
+ }
+procedure ap_update_mtime(r: Prequest_rec; dependency_mtime: apr_time_t);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_update_mtime' + LibSuff12;
+
+{
+ * 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, ...)
+ }
+procedure ap_allow_methods(r: Prequest_rec; reset: Integer; others: array of const);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name 'ap_allow_methods';
+
+//AP_DECLARE(void) (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, ...)
+ }
+procedure ap_allow_standard_methods(r: Prequest_rec; reset: Integer; others: array of const);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name 'ap_allow_standard_methods';
+
+//AP_DECLARE(void) (request_rec *r, int reset, ...);
+
+const
+ MERGE_ALLOW = 0;
+ 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)
+ }
+procedure ap_die(type_: Integer; r: Prequest_rec);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_die' + LibSuff8;
+
+//#endif COREPRIVATE
+
+{ Hooks }
+
+{
+ * Gives modules a chance to create their request_config entry when the
+ * request is created.
+ * @param r The current request
+ * @ingroup hooks
+ }
+type
+ ap_HOOK_create_request_t = function (r: Prequest_rec): Integer; cdecl;
+
+procedure ap_hook_create_request(pf: ap_HOOK_create_request_t; const aszPre: PPChar;
+ const aszSucc: PPChar; nOrder: Integer);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_hook_create_request' + LibSuff16;
+
+{
+ * 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
+ }
+type
+ ap_HOOK_translate_name_t = function (r: Prequest_rec): Integer; cdecl;
+
+procedure ap_hook_translate_name(pf: ap_HOOK_translate_name_t; const aszPre: PPChar;
+ const aszSucc: PPChar; nOrder: Integer);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_hook_translate_name' + LibSuff16;
+
+{
+ * 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
+ }
+type
+ ap_HOOK_map_to_storage_t = function (r: Prequest_rec): Integer; cdecl;
+
+procedure ap_hook_map_to_storage(pf: ap_HOOK_map_to_storage_t; const aszPre: PPChar;
+ const aszSucc: PPChar; nOrder: Integer);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_hook_map_to_storage' + LibSuff16;
+
+{
+ * 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
+ }
+type
+ ap_HOOK_check_user_id_t = function (r: Prequest_rec): Integer; cdecl;
+
+procedure ap_hook_check_user_id(pf: ap_HOOK_check_user_id_t; const aszPre: PPChar;
+ const aszSucc: PPChar; nOrder: Integer);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_hook_check_user_id' + LibSuff16;
+
+{
+ * 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
+ }
+type
+ ap_HOOK_fixups_t = function (r: Prequest_rec): Integer; cdecl;
+
+procedure ap_hook_fixups(pf: ap_HOOK_fixups_t; const aszPre: PPChar;
+ const aszSucc: PPChar; nOrder: Integer);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_hook_fixups' + LibSuff16;
+
+{
+ * 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
+ }
+type
+ ap_HOOK_type_checker_t = function (r: Prequest_rec): Integer; cdecl;
+
+procedure ap_hook_type_checker(pf: ap_HOOK_type_checker_t; const aszPre: PPChar;
+ const aszSucc: PPChar; nOrder: Integer);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_hook_type_checker' + LibSuff16;
+
+{
+ * 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
+ }
+type
+ ap_HOOK_access_checker_t = function (r: Prequest_rec): Integer; cdecl;
+
+procedure ap_hook_access_checker(pf: ap_HOOK_access_checker_t; const aszPre: PPChar;
+ const aszSucc: PPChar; nOrder: Integer);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_hook_access_checker' + LibSuff16;
+
+{
+ * 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
+ }
+type
+ ap_HOOK_auth_checker_t = function (r: Prequest_rec): Integer; cdecl;
+
+procedure ap_hook_auth_checker(pf: ap_HOOK_auth_checker_t; const aszPre: PPChar;
+ const aszSucc: PPChar; nOrder: Integer);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_hook_auth_checker' + LibSuff16;
+
+{
+ * This hook allows modules to insert filters for the current request
+ * @param r the current request
+ * @ingroup hooks
+ }
+type
+ ap_HOOK_insert_filter_t = procedure (r: Prequest_rec); cdecl;
+
+procedure ap_hook_insert_filter(pf: ap_HOOK_insert_filter_t; const aszPre: PPChar;
+ const aszSucc: PPChar; nOrder: Integer);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_hook_insert_filter' + LibSuff16;
+
+function ap_location_walk(r: Prequest_rec): Integer;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_location_walk' + LibSuff4;
+
+function ap_directory_walk(r: Prequest_rec): Integer;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_directory_walk' + LibSuff4;
+
+function ap_file_walk(r: Prequest_rec): Integer;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_file_walk' + LibSuff4;
+
diff --git a/packages/httpd22/src/http_vhost.inc b/packages/httpd22/src/http_vhost.inc
new file mode 100644
index 0000000000..4b71ddc124
--- /dev/null
+++ b/packages/httpd22/src/http_vhost.inc
@@ -0,0 +1,114 @@
+{ 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.
+ }
+
+{
+ * @package Virtual Host package
+ }
+
+{
+ * called before any config is read
+ * @param p Pool to allocate out of
+ }
+procedure ap_init_vhost_config(p: Papr_pool_t);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_init_vhost_config' + LibSuff4;
+
+{
+ * 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)
+ }
+procedure ap_fini_vhost_config(p: Papr_pool_t; main_server: Pserver_rec);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_fini_vhost_config' + LibSuff8;
+
+{
+ * 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
+ * @param cmd Command Parameters structure
+ * @param dummy NOT USED
+ * @param arg a host of the form "<address>[:port]"
+ }
+//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.
+ }
+type
+ ap_vhost_iterate_conn_cb = function (baton: Pointer; conn: Pconn_rec; s: Pserver_rec): Integer;
+
+{
+ * 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.
+ }
+function ap_vhost_iterate_given_conn(conn: Pconn_rec;
+ func_cb: ap_vhost_iterate_conn_cb; baton: Pointer): Integer;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_vhost_iterate_given_conn' + LibSuff12;
+
+{
+ * given an ip address only, give our best guess as to what vhost it is
+ * @param conn The current connection
+ }
+procedure ap_update_vhost_given_ip(conn: Pconn_rec);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_update_vhost_given_ip' + LibSuff4;
+
+{
+ * 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
+ }
+procedure ap_update_vhost_from_headers(r: Prequest_rec);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_update_vhost_from_headers' + LibSuff4;
+
+{
+ * 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)
+ }
+function ap_matches_request_vhost(r: Prequest_rec; const host: PChar;
+ port: apr_port_t): Integer;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_matches_request_vhost' + LibSuff12;
+
diff --git a/packages/httpd22/src/httpd.inc b/packages/httpd22/src/httpd.inc
new file mode 100644
index 0000000000..53db814dcd
--- /dev/null
+++ b/packages/httpd22/src/httpd.inc
@@ -0,0 +1,1783 @@
+{
+ * @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.inc}
+{$include ap_mmn.inc}
+
+{$include ap_release.inc}
+
+{#include "apr_general.h"}
+{#include "apr_time.h"
+#include "apr_network_io.h"}
+
+{$ifdef windows}
+ {$include apr\apr_buckets.inc}
+{$else}
+ {$include apr/apr_buckets.inc}
+{$endif}
+
+{#include "os.h"}
+
+{$include ap_regex.inc}
+
+// Note: util_uri.h is also included, see below
+
+{ ----------------------------- 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.
+}
+const
+ {$ifdef OS2}
+ { Set default for OS/2 file system }
+ HTTPD_ROOT = '/os2httpd';
+ {$else}{$ifdef WINDOWS}
+ { Set default for Windows file system }
+ HTTPD_ROOT = '/apache';
+ {$else}{$ifdef BEOS}
+ { Set the default for BeOS }
+ HTTPD_ROOT = '/boot/home/apache';
+ {$else}{$ifdef NETWARE}
+ { Set the default for NetWare }
+ HTTPD_ROOT = '/apache';
+ {$else}
+ { Set for all other OSes }
+ HTTPD_ROOT = '/usr/local/apache';
+ {$endif}
+ {$endif}
+ {$endif}
+ {$endif}
+
+{
+ * --------- 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.
+ *
+}
+const
+
+{ Default location of documents. Can be overridden by the DocumentRoot
+ * directive.
+}
+ DOCUMENT_LOCATION = HTTPD_ROOT + '/htdocs';
+
+// Maximum number of dynamically loaded modules
+ DYNAMIC_MODULE_LIMIT = 128;
+
+// Default administrator's address
+ DEFAULT_ADMIN = '[no address given]';
+
+// The name of the log files
+{$if defined(OS2) or defined(WINDOWS)}
+ DEFAULT_ERRORLOG = 'logs/error.log';
+{$else}
+ DEFAULT_ERRORLOG = 'logs/error_log';
+{$endif}
+
+{ Define this to be what your per-directory security files are called }
+ DEFAULT_ACCESS_FNAME = '.htaccess';
+
+{ The name of the server config file }
+ SERVER_CONFIG_FILE = 'conf/httpd.conf';
+
+{ The default path for CGI scripts if none is currently set }
+ DEFAULT_PATH = '/bin:/usr/bin:/usr/ucb:/usr/bsd:/usr/local/bin';
+
+{ The path to the suExec wrapper, can be overridden in Configuration }
+ SUEXEC_BIN = HTTPD_ROOT + '/bin/suexec';
+
+{ The timeout for waiting for messages }
+ DEFAULT_TIMEOUT = 300 ;
+
+{ The timeout for waiting for keepalive timeout until next request }
+ DEFAULT_KEEPALIVE_TIMEOUT = 15;
+
+{ The number of requests to entertain per connection }
+ DEFAULT_KEEPALIVE = 100;
+
+{ 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.
+}
+ DEFAULT_LIMIT_REQUEST_LINE = 8190;
+
+ DEFAULT_LIMIT_REQUEST_FIELDSIZE = 8190;
+
+ DEFAULT_LIMIT_REQUEST_FIELDS = 100;
+
+
+{
+ * The default default character set name to add if AddDefaultCharset is
+ * enabled. Overridden with AddDefaultCharsetName.
+}
+ DEFAULT_ADD_DEFAULT_CHARSET_NAME = 'iso-8859-1';
+
+{ default HTTP Server protocol }
+ AP_SERVER_PROTOCOL = 'HTTP/1.1';
+
+
+{ ------------------ stuff that modules are allowed to look at ----------- }
+
+ AP_DEFAULT_INDEX = 'index.html';
+
+
+{
+ * Define this to be what type you'd like returned for files with unknown
+ * suffixes.
+ * @warning MUST be all lower case.
+}
+ DEFAULT_CONTENT_TYPE = 'text/plain';
+
+{ The name of the MIME types file }
+ AP_TYPES_CONFIG_FILE = 'conf/mime.types';
+
+{
+ * Define the HTML doctype strings centrally.
+}
+{ HTML 2.0 Doctype }
+ DOCTYPE_HTML_2_0 = '<!DOCTYPE HTML PUBLIC "-//IETF//' +
+ 'DTD HTML 2.0//EN">' + LineEnding;
+{ HTML 3.2 Doctype }
+ DOCTYPE_HTML_3_2 = '<!DOCTYPE HTML PUBLIC "-//W3C//' +
+ 'DTD HTML 3.2 Final//EN">' + LineEnding;
+{ HTML 4.0 Strict Doctype }
+ DOCTYPE_HTML_4_0S = '<!DOCTYPE HTML PUBLIC "-//W3C//' +
+ 'DTD HTML 4.0//EN"' + LineEnding +
+ '"http://www.w3.org/TR/REC-html40/strict.dtd">' + LineEnding;
+{ HTML 4.0 Transitional Doctype }
+ DOCTYPE_HTML_4_0T = '<!DOCTYPE HTML PUBLIC "-//W3C//' +
+ 'DTD HTML 4.0 Transitional//EN"' + LineEnding +
+ '"http://www.w3.org/TR/REC-html40/loose.dtd">' + LineEnding;
+{ HTML 4.0 Frameset Doctype }
+ DOCTYPE_HTML_4_0F = '<!DOCTYPE HTML PUBLIC "-//W3C//' +
+ 'DTD HTML 4.0 Frameset//EN"' + LineEnding +
+ '"http://www.w3.org/TR/REC-html40/frameset.dtd">' + LineEnding;
+{ XHTML 1.0 Strict Doctype }
+ DOCTYPE_XHTML_1_0S = '<!DOCTYPE html PUBLIC "-//W3C//' +
+ 'DTD XHTML 1.0 Strict//EN"' + LineEnding +
+ '"http://www.w3.org/TR/xhtml1/DTD/' +
+ 'xhtml1-strict.dtd\">' + LineEnding;
+{ XHTML 1.0 Transitional Doctype }
+ DOCTYPE_XHTML_1_0T = '<!DOCTYPE html PUBLIC "-//W3C//' +
+ 'DTD XHTML 1.0 Transitional//EN"' + LineEnding +
+ '"http://www.w3.org/TR/xhtml1/DTD/' +
+ 'xhtml1-transitional.dtd">' + LineEnding;
+{ XHTML 1.0 Frameset Doctype }
+ DOCTYPE_XHTML_1_0F = '<!DOCTYPE html PUBLIC "-//W3C//' +
+ 'DTD XHTML 1.0 Frameset//EN"' + LineEnding +
+ '"http://www.w3.org/TR/xhtml1/DTD/' +
+ 'xhtml1-frameset.dtd">' + LineEnding;
+
+{ Internal representation for a HTTP protocol number, e.g., HTTP/1.1 }
+
+function HTTP_VERSION(major, minor: Integer): Integer;
+{ Major part of HTTP protocol }
+function HTTP_VERSION_MAJOR(number: Integer): Integer;
+{ Minor part of HTTP protocol }
+function HTTP_VERSION_MINOR(number: Integer): Integer;
+
+{ -------------- Port number for server running standalone --------------- }
+
+const
+{ default HTTP Port }
+ DEFAULT_HTTP_PORT = 80;
+{ default HTTPS Port }
+ 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_scheme(r) ap_run_http_scheme(r)
+
+{ The default string lengths }
+// MAX_STRING_LEN = HUGE_STRING_LEN;
+ HUGE_STRING_LEN = 8192;
+
+{ The size of the server's internal read-write buffers }
+ AP_IOBUFSIZE = 8192;
+
+{ The max number of regex captures that can be expanded by ap_pregsub }
+ 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.
+ }
+ 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 }
+ APEXIT_OK = $0;
+{ A fatal error arising during the server's init sequence }
+ APEXIT_INIT = $2;
+{ The child died during its init sequence }
+ APEXIT_CHILDINIT = $3;
+{
+ * The child exited due to a resource shortage.
+ * The parent should limit the rate of forking until
+ * the situation is resolved.
+}
+ APEXIT_CHILDSICK = $7;
+{
+ * 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.
+}
+ APEXIT_CHILDFATAL = $f;
+
+{
+ * 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
+
+{
+ * 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
+
+{$define AP_DECLARE_DATA}
+
+
+//# define AP_MODULE_DECLARE(type) type
+//# define AP_MODULE_DECLARE_NONSTD(type) type
+
+{$define AP_MODULE_DECLARE_DATA}
+
+{
+ * @internal
+ * modules should not used functions marked AP_CORE_DECLARE
+}
+// AP_CORE_DECLARE = AP_DECLARE;
+
+{
+ * @internal
+ * modules should not used functions marked AP_CORE_DECLARE_NONSTD
+}
+
+// AP_CORE_DECLARE_NONSTD = AP_DECLARE_NONSTD;
+
+{
+ * The numeric version information is broken out into fields within this
+ * structure.
+ }
+type
+ ap_version_t = record
+ major: Integer; {< major number }
+ minor: Integer; {< minor number }
+ patch: Integer; {< patch number }
+ add_string: PChar; {< additional string like "-dev" }
+ end;
+
+ Pap_version_t = ^ap_version_t;
+
+{
+ * Return httpd's version information in a numeric form.
+ *
+ * @param version Pointer to a version structure for returning the version
+ * information.
+ }
+procedure ap_get_server_revision(version: Pap_version_t);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_get_server_revision' + LibSuff4;
+
+{
+ * Get the server version string
+ * @return The server version string
+ }
+function ap_get_server_version: PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_get_server_version' + LibSuff0;
+
+{
+ * Add a component to the version string
+ * @param pconf The pool to allocate the component from
+ * @param component The string to add
+}
+procedure ap_add_version_component(pconf: Papr_pool_t; const component: PChar);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_add_version_component' + LibSuff8;
+
+{
+ * Get the date a time that the server was built
+ * @return The server build time string
+}
+function ap_get_server_built: PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_get_server_built' + LibSuff0;
+
+const
+ DECLINED = -1; {< Module declines to handle }
+ DONE = -2; {< Module has served the response completely
+ * - it's safe to die() with no more output
+ }
+ 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.
+}
+ RESPONSE_CODES = 57;
+
+ HTTP_CONTINUE = 100;
+ HTTP_SWITCHING_PROTOCOLS = 101;
+ HTTP_PROCESSING = 102;
+ HTTP_OK = 200;
+ HTTP_CREATED = 201;
+ HTTP_ACCEPTED = 202;
+ HTTP_NON_AUTHORITATIVE = 203;
+ HTTP_NO_CONTENT = 204;
+ HTTP_RESET_CONTENT = 205;
+ HTTP_PARTIAL_CONTENT = 206;
+ HTTP_MULTI_STATUS = 207;
+ HTTP_MULTIPLE_CHOICES = 300;
+ HTTP_MOVED_PERMANENTLY = 301;
+ HTTP_MOVED_TEMPORARILY = 302;
+ HTTP_SEE_OTHER = 303;
+ HTTP_NOT_MODIFIED = 304;
+ HTTP_USE_PROXY = 305;
+ HTTP_TEMPORARY_REDIRECT = 307;
+ HTTP_BAD_REQUEST = 400;
+ HTTP_UNAUTHORIZED = 401;
+ HTTP_PAYMENT_REQUIRED = 402;
+ HTTP_FORBIDDEN = 403;
+ HTTP_NOT_FOUND = 404;
+ HTTP_METHOD_NOT_ALLOWED = 405;
+ HTTP_NOT_ACCEPTABLE = 406;
+ HTTP_PROXY_AUTHENTICATION_REQUIRED = 407;
+ HTTP_REQUEST_TIME_OUT = 408;
+ HTTP_CONFLICT = 409;
+ HTTP_GONE = 410;
+ HTTP_LENGTH_REQUIRED = 411;
+ HTTP_PRECONDITION_FAILED = 412;
+ HTTP_REQUEST_ENTITY_TOO_LARGE = 413;
+ HTTP_REQUEST_URI_TOO_LARGE = 414;
+ HTTP_UNSUPPORTED_MEDIA_TYPE = 415;
+ HTTP_RANGE_NOT_SATISFIABLE = 416;
+ HTTP_EXPECTATION_FAILED = 417;
+ HTTP_UNPROCESSABLE_ENTITY = 422;
+ HTTP_LOCKED = 423;
+ HTTP_FAILED_DEPENDENCY = 424;
+ HTTP_UPGRADE_REQUIRED = 426;
+ HTTP_INTERNAL_SERVER_ERROR = 500;
+ HTTP_NOT_IMPLEMENTED = 501;
+ HTTP_BAD_GATEWAY = 502;
+ HTTP_SERVICE_UNAVAILABLE = 503;
+ HTTP_GATEWAY_TIME_OUT = 504;
+ HTTP_VERSION_NOT_SUPPORTED = 505;
+ HTTP_VARIANT_ALSO_VARIES = 506;
+ _INSUFFICIENT_STORAGE = 507;
+ 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().
+}
+const
+ M_GET = 0; // RFC 2616: HTTP
+ M_PUT = 1; // :
+ M_POST = 2;
+ M_DELETE = 3;
+ M_CONNECT = 4;
+ M_OPTIONS = 5;
+ M_TRACE = 6; // RFC 2616: HTTP }
+ M_PATCH = 7; // no rfc(!) ### remove this one? }
+ M_PROPFIND = 8; // RFC 2518: WebDAV }
+ M_PROPPATCH = 9; // : }
+ M_MKCOL = 10;
+ M_COPY = 11;
+ M_MOVE = 12;
+ M_LOCK = 13;
+ M_UNLOCK = 14; // RFC 2518: WebDAV }
+ M_VERSION_CONTROL = 15; // RFC 3253: WebDAV Versioning }
+ M_CHECKOUT = 16; // : }
+ M_UNCHECKOUT = 17;
+ M_CHECKIN = 18;
+ M_UPDATE = 19;
+ M_LABEL = 20;
+ M_REPORT = 21;
+ M_MKWORKSPACE = 22;
+ M_MKACTIVITY = 23;
+ M_BASELINE_CONTROL = 24;
+ M_MERGE = 25;
+ M_INVALID = 26; // RFC 3253: WebDAV Versioning }
+
+{
+ * METHODS needs to be equal to the number of bits
+ * we are using for limit masks.
+}
+ METHODS = 64;
+
+{
+ * The method mask bit to shift for anding with a bitmask.
+}
+ 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.
+}
+type
+ ap_method_list_t = record
+ { The bitmask used for known methods }
+ method_mask: apr_int64_t;
+ { the array used for extension methods }
+// method_list: ^apr_array_header_t;
+ end;
+{
+ * @defgroup module_magic Module Magic mime types
+ * @
+ }
+{ Magic for mod_cgi[d] }
+const
+ CGI_MAGIC_TYPE = 'application/x-httpd-cgi';
+{ Magic for mod_include }
+ INCLUDES_MAGIC_TYPE = 'text/x-server-parsed-html';
+{ Magic for mod_include }
+ INCLUDES_MAGIC_TYPE3 = 'text/x-server-parsed-html3';
+{ Magic for mod_dir }
+ DIR_MAGIC_TYPE = 'httpd/unix-directory';
+
+{ Just in case your linefeed isn't the one the other end is expecting. }
+{ linefeed }
+ LF = 10;
+{ carrige return }
+ CR = 13;
+{ carrige return /Line Feed Combo }
+ CRLF = #015#012;
+
+{
+ * @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 }
+ REQUEST_NO_BODY = 0;
+{ Send 411 error if body without Content-Length }
+ REQUEST_CHUNKED_ERROR = 1;
+{ If chunked, remove the chunks for me. }
+ 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 }
+ AP_REQ_ACCEPT_PATH_INFO = 0;
+{ Return a 404 error if path_info was given }
+ AP_REQ_REJECT_PATH_INFO = 1;
+{ Module may chose to use the given path_info }
+ 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.
+}
+type
+ Phtaccess_result = ^htaccess_result;
+ htaccess_result = record
+ { the directory to which this applies }
+ dir: PChar;
+ { the overrides allowed for the .htaccess file }
+ override_: Integer;
+ { the configuration directives }
+ htaccess: Pap_conf_vector_t;
+ { the next one, or NULL if no more; N.B. never change this }
+ next: Phtaccess_result;
+ end;
+
+{ 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. }
+
+
+{ ### would be nice to not include this from httpd.h ... }
+{ This comes after we have defined the request_rec type }
+//#include "apr_uri.h"
+
+type
+ { Forward declarations of pointer to record types}
+ Pconn_rec = ^conn_rec;
+ Prequest_rec = ^request_rec;
+ Pserver_rec = ^server_rec;
+ PPserver_rec = ^Pserver_rec;
+ Pserver_addr_rec = ^server_addr_rec;
+ Pprocess_rec = ^process_rec;
+
+ { A structure that represents one process }
+ process_rec = record
+ { Global pool. Cleared upon normal exit }
+ pool: Papr_pool_t;
+ { Configuration pool. Cleared upon restart }
+ pconf: Papr_pool_t;
+ { Number of command line arguments passed to the program }
+ argc: Integer;
+ { The command line arguments }
+ argv: PChar;
+ { The program name used to execute the program }
+ short_name: PChar;
+ end;
+
+ { A structure that represents the current request }
+ request_rec = record
+ { The pool associated with the request }
+ pool: Papr_pool_t;
+ { The connection to the client }
+ connection: Pconn_rec;
+ { The virtual host for this request }
+ server: Pserver_rec;
+
+ { Pointer to the redirected request if this is an external redirect }
+ next: Prequest_rec;
+ { Pointer to the previous request if this is an internal redirect }
+ prev: Prequest_rec;
+
+ { Pointer to the main request if this is a sub-request
+ * (see http_request.h) }
+ main: Prequest_rec;
+
+ { Info about the request itself... we begin with stuff that only
+ * protocol.c should ever touch...
+ }
+ { First line of request }
+ the_request: PChar;
+ { HTTP/0.9, "simple" request (e.g. GET /foo\n w/no headers) }
+ assbackwards: Integer;
+ { A proxy request (calculated during post_read_request/translate_name)
+ * possible values PROXYREQ_NONE, PROXYREQ_PROXY, PROXYREQ_REVERSE,
+ * PROXYREQ_RESPONSE
+ }
+ proxyreq: Integer;
+ { HEAD request, as opposed to GET }
+ header_only: Integer;
+ { Protocol string, as given to us, or HTTP/0.9 }
+ protocol: PChar;
+ { Protocol version number of protocol; 1.1 = 1001 }
+ proto_num: Integer;
+ { Host, as set by full URI or Host: }
+ hostname: PChar;
+
+ { Time when the request started }
+ request_time: apr_time_t;
+
+ { Status line, if set by script }
+ status_line: PChar;
+ { Status line }
+ status: Integer;
+
+ { Request method, two ways; also, protocol, etc.. Outside of protocol.c,
+ * look, but don't touch.
+ }
+
+ { Request method (eg. GET, HEAD, POST, etc.) }
+ method: PChar;
+ { M_GET, M_POST, etc. }
+ method_number: Integer;
+
+ {
+ * '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.
+ }
+ allowed: apr_int64_t;
+ { Array of extension methods }
+ allowed_xmethods: Papr_array_header_t;
+ { List of allowed methods }
+ allowed_methods: Pap_method_list_t;
+
+ { byte count in stream is for body }
+ sent_bodyct: apr_off_t;
+ { body byte count, for easy access }
+ bytes_sent: apr_off_t;
+ { Last modified time of the requested resource }
+ mtime: apr_time_t;
+
+ { HTTP/1.1 connection-level features }
+
+ { sending chunked transfer-coding }
+ chunked: Integer;
+ { The Range: header }
+ range: PChar;
+ { The "real" content length }
+ clength: apr_off_t;
+
+ { Remaining bytes left to read from the request body }
+ remaining: apr_off_t;
+ { Number of bytes that have been read from the request body }
+ read_length: apr_off_t;
+ { Method for reading the request body
+ * (eg. REQUEST_CHUNKED_ERROR, REQUEST_NO_BODY,
+ * REQUEST_CHUNKED_DECHUNK, etc...) }
+ read_body: Integer;
+ { reading chunked transfer-coding }
+ read_chunked: Integer;
+ { is client waiting for a 100 response? }
+ expecting_100: Cardinal;
+
+ { 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 }
+ headers_in: Papr_table_t;
+ { MIME header environment for the response }
+ headers_out: Papr_table_t;
+ { MIME header environment for the response, printed even on errors and
+ * persist across internal redirects }
+ err_headers_out: Papr_table_t;
+ { Array of environment variables to be used for sub processes }
+ subprocess_env: Papr_table_t;
+ { Notes from one module to another }
+ notes: Papr_table_t;
+
+ { 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 }
+ content_type: PChar; // Break these out --- we dispatch on 'em
+ { The handler string that we use to call a handler function }
+ handler: PChar; // What we *really* dispatch on
+
+ { How to encode the data }
+ content_encoding: PChar;
+ { Array of strings representing the content languages }
+ content_languages: Papr_array_header_t;
+
+ { variant list validator (if negotiated) }
+ vlist_validator: PChar;
+
+ { If an authentication check was made, this gets set to the user name. }
+ user: PChar;
+ { If an authentication check was made, this gets set to the auth type. }
+ ap_auth_type: PChar;
+
+ { This response can not be cached }
+ no_cache: Integer;
+ { There is no local copy of this response }
+ no_local_copy: Integer;
+
+ { What object is being requested (either directly, or via include
+ * or content-negotiation mapping).
+ }
+
+ { The URI without any parsing performed }
+ unparsed_uri: PChar;
+ { The path portion of the URI }
+ uri: PChar;
+ { The filename on disk corresponding to this response }
+ filename: PChar;
+ { XXX: What does this mean? Please define "canonicalize" -aaron }
+ { The true filename, we canonicalize r->filename if these don't match }
+ canonical_filename: PChar;
+ { The PATH_INFO extracted from this request }
+ path_info: PChar;
+ { The QUERY_ARGS extracted from this request }
+ args: PChar;
+ { finfo.protection (st_mode) set to zero if no such file }
+ finfo: apr_finfo_t;
+ { A struct containing the components of URI }
+ parsed_uri: apr_uri_t;
+
+ {
+ * 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.
+ }
+ used_path_info: Integer;
+
+ { 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.}
+ per_dir_config: Pap_conf_vector_t;
+ { Notes on *this* request }
+ request_config: Pap_conf_vector_t;
+
+ {
+ * 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
+ }
+ htaccess: Phtaccess_result;
+
+ { A list of output filters to be used for this request }
+ output_filters: Pap_filter_t;
+ { A list of input filters to be used for this request }
+ input_filters: Pap_filter_t;
+
+ { A list of protocol level output filters to be used for this
+ * request }
+ proto_output_filters: Pap_filter_t;
+ { A list of protocol level input filters to be used for this
+ * request }
+ proto_input_filters: Pap_filter_t;
+
+ { A flag to determine if the eos bucket has been sent yet }
+ eos_sent: Integer;
+
+{ 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.
+}
+ end;
+
+{
+ * @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.
+}
+
+ ap_conn_keepalive_e = (AP_CONN_UNKNOWN, AP_CONN_CLOSE, AP_CONN_KEEPALIVE);
+
+ Pconn_state_t = ^conn_state_t;
+
+{ Structure to store things which are per connection }
+ conn_rec = record
+ { Pool associated with this connection }
+ pool: Papr_pool_t;
+ { Physical vhost this conn came in on }
+ base_server: Pserver_rec;
+ { used by http_vhost.c }
+ vhost_lookup_data: Pointer;
+
+ { Information about the connection itself }
+ { local address }
+ local_addr: Papr_sockaddr_t;
+ { remote address }
+ remote_addr: Papr_sockaddr_t;
+
+ { Client's IP address }
+ remote_ip: PChar;
+ { 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() }
+ remote_host: PChar;
+ { Only ever set if doing rfc1413 lookups. N.B. Only access this through
+ * get_remote_logname() }
+ remote_logname: PChar;
+
+ { Are we still talking? }
+ flags: Cardinal;
+
+ (* Useless bitset variables to make the code obscure
+
+ Are we still talking?
+ unsigned aborted:1;
+
+ Are we going to keep the connection alive for another request?
+ * @see ap_conn_keepalive_e
+ signed int keepalive:2;
+
+ 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? }
+ keepalives: Integer;
+ { server IP address }
+ local_ip: PChar;
+ { used for ap_get_server_name when UseCanonicalName is set to DNS
+ * (ignores setting of HostnameLookups) }
+ local_host: PChar;
+
+ { ID of this connection; unique at any point in time }
+ id: clong;
+ { Config vector containing pointers to connections per-server
+ * config structures. }
+ conn_config: Pap_conf_vector_t;
+ { Notes on *this* connection: send note from one module to
+ * another. must remain valid for all requests on this conn }
+ notes: Papr_table_t;
+ { A list of input filters to be used for this connection }
+ input_filters: Pap_filter_t;
+ { A list of output filters to be used for this connection }
+ output_filters: Pap_filter_t;
+ { handle to scoreboard information for this connection }
+ sbh: Pointer;
+ { The bucket allocator to use for all bucket/brigade creations }
+ bucket_alloc: Papr_bucket_alloc_t;
+ { The current state of this connection }
+ cs: Pconn_state_t;
+ { Is there data pending in the input filters? }
+ data_in_input_filters: cint;
+ end;
+
+{
+ * Enumeration of connection states
+ }
+ conn_state_e = (
+ CONN_STATE_CHECK_REQUEST_LINE_READABLE,
+ CONN_STATE_READ_REQUEST_LINE,
+ CONN_STATE_LINGER
+ );
+
+{
+ * @brief A structure to contain connection state information
+ }
+ APR_RING_ENTRY_conn_state_t = record
+ next: Pconn_state_t;
+ prev: Pconn_state_t;
+ end;
+
+ conn_state_t = record
+ { APR_RING of expiration timeouts }
+ timeout_list: APR_RING_ENTRY_conn_state_t;
+ { the expiration time of the next keepalive timeout }
+ expiration_time: apr_time_t;
+ { Current state of the connection }
+ state: conn_state_e;
+ { connection record this struct refers to }
+ c: Pconn_rec;
+ { memory pool to allocate from }
+ p: Papr_pool_t;
+ { bucket allocator }
+ bucket_alloc: Papr_bucket_alloc_t;
+ { poll file decriptor information }
+ pfd: apr_pollfd_t;
+ end;
+
+
+{ Per-vhost config... }
+
+{ A structure to be used for Per-vhost config }
+ server_addr_rec = record
+ { The next server in the list }
+ next: Pserver_addr_rec;
+ { The bound address, for this server }
+ host_addr: Papr_sockaddr_t;
+ { The bound port, for this server }
+ host_port: apr_port_t;
+ { The name given in <VirtualHost> }
+ virthost: PChar;
+ end;
+
+ { A structure to store information for each virtual server }
+ server_rec = record
+ { The process this server is running in }
+ process: Pprocess_rec;
+ { The next server in the list }
+ next: Pserver_rec;
+
+ { The name of the server }
+ defn_name: PChar;
+ { The line of the config file that the server was defined on }
+ defn_line_number: Integer;
+
+ { Contact information }
+
+ { The admin's contact information }
+ server_admin: PChar;
+ { The server hostname }
+ server_hostname: PChar;
+ { for redirects, etc. }
+ port: apr_port_t;
+
+ { Log files --- note that transfer log is now in the modules... }
+
+ { The name of the error log }
+ error_fname: PChar;
+ { A file descriptor that references the error log }
+ error_log: Papr_file_t;
+ { The log level for this server }
+ loglevel: Integer;
+
+ { Module-specific configuration for server, and defaults... }
+
+ { true if this is the virtual server }
+ is_virtual: Integer;
+ { Config vector containing pointers to modules' per-server config
+ * structures. }
+ module_config: Pap_conf_vector_t;
+ { MIME type info, etc., before we start checking per-directory info }
+ lookup_defaults: Pap_conf_vector_t;
+
+ { Transaction handling }
+
+ { I haven't got a clue }
+ addrs: Pserver_addr_rec;
+ { Timeout, as an apr interval, before we give up }
+ timeout: apr_interval_time_t;
+ { The apr interval we will wait for another request }
+ keep_alive_timeout: apr_interval_time_t;
+ { Maximum requests per connection }
+ keep_alive_max: Integer;
+ { Use persistent connections? }
+ keep_alive: Integer;
+
+ { Pathname for ServerPath }
+ path: PChar;
+ { Length of path }
+ pathlen: Integer;
+
+ { Normal names for ServerAlias servers }
+ names: Papr_array_header_t;
+ { Wildcarded names for ServerAlias servers }
+ wild_names: Papr_array_header_t;
+
+ { limit on size of the HTTP request line }
+ limit_req_line: Integer;
+ { limit on size of any request header field }
+ limit_req_fieldsize: Integer;
+ { limit on number of request header fields }
+ limit_req_fields: Integer;
+
+ { The server request scheme for redirect responses }
+ server_scheme: PChar;
+ end;
+
+type
+ core_output_filter_ctx = record
+ b: Papr_bucket_brigade;
+ deferred_write_pool: Papr_pool_t; { subpool of c->pool used for resources
+ * which may outlive the request }
+ end;
+
+ core_filter_ctx = record
+ b: Papr_bucket_brigade;
+ tmpbb: Papr_bucket_brigade;
+ end; // core_ctx_t
+
+ core_ctx_t = core_filter_ctx;
+
+ Pcore_ctx_t = ^core_ctx_t;
+
+type
+ core_net_rec = record
+ { Connection to the client }
+ client_socket: Papr_socket_t;
+
+ { connection record }
+ c: Pconn_rec;
+
+ out_ctx: Pcore_output_filter_ctx_t;
+ in_ctx: Pcore_ctx_t;
+ end; // core_net_rec;
+
+ Pcore_net_rec = ^core_net_rec;
+
+{
+ The constants are on the bottom because the structures need to be on the same type block
+}
+const
+ PROXYREQ_NONE = 0; {< No proxy }
+ PROXYREQ_PROXY = 1; {< Standard proxy }
+ PROXYREQ_REVERSE = 2; {< Reverse proxy }
+ PROXYREQ_RESPONSE = 3; {< Origin response }
+
+{
+ * 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.
+}
+const DEFAULT_VHOST_ADDR = $ffffffff;//ul
+
+{
+ * 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
+}
+function ap_field_noparam(p: Papr_pool_t; const intype: PChar): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_field_noparam' + LibSuff8;
+
+{
+ * 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
+}
+function ap_ht_time(p: Papr_pool_t; t: apr_time_t; const fmt: PChar; gmt: Integer): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_ht_time' + LibSuff20;
+
+{ 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
+}
+function ap_getword(p: Papr_pool_t; const line: PPChar; stop: Char): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_getword' + LibSuff12;
+
+{
+ * 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 **.
+}
+function ap_getword_nc(p: Papr_pool_t; const line: PPChar; stop: Char): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_getword_nc' + LibSuff12;
+
+{
+ * 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
+}
+function ap_getword_white(p: Papr_pool_t; const line: PPChar): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_getword_white' + LibSuff8;
+
+{
+ * 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 **.
+}
+function ap_getword_white_nc(p: Papr_pool_t; const line: PPChar): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_getword_white_nc' + LibSuff8;
+
+{
+ * 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
+}
+function ap_getword_nulls(p: Papr_pool_t; const line: PPChar; stop: Char): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_getword_nulls' + LibSuff12;
+
+{
+ * 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 **.
+}
+function ap_getword_nulls_nc(p: Papr_pool_t; const line: PPChar; stop: Char): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_getword_nulls_nc' + LibSuff12;
+
+{
+ * 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
+}
+function ap_getword_conf(p: Papr_pool_t; const line: PPChar): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_getword_conf' + LibSuff8;
+
+{
+ * 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 **.
+}
+function ap_getword_conf_nc(p: Papr_pool_t; const line: PPChar): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_getword_conf_nc' + LibSuff8;
+
+{
+ * 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
+}
+function ap_resolve_env(p: Papr_pool_t; const word_: PChar; accept_white: Integer): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_resolve_env' + LibSuff8;
+
+{
+ * 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.
+}
+function ap_size_list_item(const field: PPChar; len: Integer): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_size_list_item' + LibSuff8;
+
+{
+ * 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.
+}
+function ap_get_list_item(p: Papr_pool_t; const field: PPChar): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_get_list_item' + LibSuff8;
+
+{
+ * 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.
+}
+function ap_find_list_item(p: Papr_pool_t; const line, tok: PChar): Integer;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_find_list_item' + LibSuff12;
+
+{
+ * 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
+}
+function ap_get_token(p: Papr_pool_t; const accept_line: PPChar; accept_white: Integer): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_get_token' + LibSuff12;
+
+{
+ * 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
+}
+function ap_find_token(p: Papr_pool_t; const line, tok: PChar): Integer;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_find_token' + LibSuff12;
+
+{
+ * 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
+}
+function ap_find_last_token(p: Papr_pool_t; const line, tok: PChar): Integer;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_find_last_token' + LibSuff12;
+
+{
+ * Check for an Absolute URI syntax
+ * @param u The string to check
+ * @return 1 if URI, 0 otherwise
+}
+function ap_is_url(const u: PChar): Integer;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_is_url' + LibSuff4;
+
+{
+ * Unescape a URL
+ * @param url The url to unescape
+ * @return 0 on success, non-zero otherwise
+}
+function ap_unescape_url(url: PChar): Integer;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_unescape_url' + LibSuff4;
+
+{
+ * Unescape a URL, but leaving %2f (slashes) escaped
+ * @param url The url to unescape
+ * @return 0 on success, non-zero otherwise
+}
+function ap_unescape_url_keep2f(url: PChar): Integer;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_unescape_url_keep2f' + LibSuff4;
+
+{
+ * Convert all double slashes to single slashes
+ * @param name The string to convert
+}
+procedure ap_no2slash(name: PChar);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_no2slash' + LibSuff4;
+
+{
+ * Remove all ./ and xx/../ substrings from a file name. Also remove
+ * any leading ../ or /../ substrings.
+ * @param name the file name to parse
+}
+procedure ap_getparents(name: PChar);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_getparents' + LibSuff4;
+
+{
+ * 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
+}
+function ap_escape_path_segment(p: Papr_pool_t; const s: PChar): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_escape_path_segment' + LibSuff8;
+
+{
+ * 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
+}
+function ap_os_escape_path(p: Papr_pool_t; const path: PChar; partial: Integer): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_os_escape_path' + LibSuff12;
+
+{ @see ap_os_escape_path }
+function ap_escape_uri(p: Papr_pool_t; const path: PChar): PChar;
+
+{
+ * Escape an html string
+ * @param p The pool to allocate from
+ * @param s The html to escape
+ * @return The escaped string
+ }
+function ap_escape_html(p: Papr_pool_t; const s: PChar): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_escape_html' + LibSuff8;
+
+{
+ * Escape a string for logging
+ * @param p The pool to allocate from
+ * @param str The string to escape
+ * @return The escaped string
+ }
+function ap_escape_logitem(p: Papr_pool_t; const str: PChar): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_escape_logitem' + LibSuff8;
+
+{
+ * 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)
+ }
+function ap_escape_errorlog_item(dest, source: PChar;
+ buflen: apr_size_t): apr_size_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_escape_errorlog_item' + LibSuff12;
+
+{
+ * 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
+ }
+function ap_construct_server(p: Papr_pool_t; const hostname: PChar;
+ port: Papr_port_t; const r: Prequest_rec): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_construct_server' + LibSuff16;
+
+{
+ * Escape a shell command
+ * @param p The pool to allocate from
+ * @param s The command to escape
+ * @return The escaped shell command
+ }
+function ap_escape_shell_cmd(p: Papr_pool_t; const s: PChar): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_escape_shell_cmd' + LibSuff8;
+
+{
+ * Count the number of directories in a path
+ * @param path The path to count
+ * @return The number of directories
+ }
+function ap_count_dirs(const path: PChar): Integer;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_count_dirs' + LibSuff4;
+
+{
+ * 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. }
+function ap_make_dirstr_prefix(const d, s: PChar; n: Integer): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_make_dirstr_prefix' + LibSuff12;
+
+{
+ * 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
+ }
+function ap_make_dirstr_parent(p: Papr_pool_t; const s: PChar): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_make_dirstr_parent' + LibSuff8;
+
+{
+ * 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.
+ }
+function ap_make_full_path(a: Papr_pool_t; const dir, f: PChar): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_make_full_path' + LibSuff12;
+
+{
+ * 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.
+ }
+function ap_os_is_path_absolute(p: Papr_pool_t; const dir: PChar): Integer;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_os_is_path_absolute' + LibSuff8;
+
+{
+ * 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
+ }
+function ap_is_matchexp(const str: PChar): Integer;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_is_matchexp' + LibSuff4;
+
+{
+ * 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
+ }
+function ap_strcmp_match(const str, expected: PChar): Integer;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_strcmp_match' + LibSuff8;
+
+{
+ * 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
+ }
+function ap_strcasecmp_match(const str, expected: PChar): Integer;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_strcasecmp_match' + LibSuff8;
+
+{
+ * 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
+ }
+function ap_strcasestr(const s1, s2: PChar): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_strcasestr' + LibSuff8;
+
+{
+ * 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
+ }
+function ap_stripprefix(const bigstring, prefix: PChar): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_stripprefix' + LibSuff8;
+
+{
+ * 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
+ }
+function ap_pbase64decode(p: Papr_pool_t; const bufcoded: PChar): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_pbase64decode' + LibSuff8;
+
+{
+ * 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
+ }
+function ap_pbase64encode(p: Papr_pool_t; string_: PChar): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_pbase64encode' + LibSuff8;
+
+{
+ * 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
+ }
+function ap_pregcomp(p: Papr_pool_t; const pattern: PChar; cflags: Integer): Pap_regex_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_pregcomp' + LibSuff12;
+
+{
+ * 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
+ }
+procedure ap_pregfree(p: Papr_pool_t; reg: Pap_regex_t);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_pregfree' + LibSuff8;
+
+{
+ * 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
+}
+function ap_pregsub(p: Papr_pool_t; const input, source: PChar;
+ nmatch: size_t; pmatch: array of ap_regmatch_t): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_pregsub' + LibSuff20;
+
+{
+ * 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
+}
+procedure ap_content_type_tolower(s: PChar);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_content_type_tolower' + LibSuff4;
+
+{
+ * convert a string to all lowercase
+ * @param s The string to convert to lowercase
+}
+procedure ap_str_tolower(s: PChar);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_str_tolower' + LibSuff4;
+
+{
+ * 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
+}
+function ap_ind(str: PChar; c: Char): Integer;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_ind' + LibSuff8;
+
+{
+ * 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
+}
+function ap_rind(str: PChar; c: Char): Integer;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_rind' + LibSuff8;
+
+{
+ * 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
+}
+function ap_escape_quotes(p: Papr_pool_t; const instring: PChar): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_escape_quotes' + LibSuff8;
+
+{
+ * Given a string, append the PID deliminated by delim.
+ * Usually used to create a pid-appended filepath name
+ * (eg: /a/b/foo -> /a/b/foo.6726). A function, and not
+ * a macro, to avoid unistd.h dependency
+ * @param p The pool to allocate memory from
+ * @param string The string to append the PID to
+ * @param delim The string to use to deliminate the string from the PID
+ * @return A copy of the string with the PID appended
+ }
+function ap_append_pid(p: Papr_pool_t; const string_, delim: PChar): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_append_pid' + LibSuff12;
+
+{ 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
+}
+function ap_is_rdirectory(p: Papr_pool_t; const name: PChar): Integer;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_is_rdirectory' + LibSuff8;
+
+{
+ * 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
+}
+function ap_is_directory(p: Papr_pool_t; const name: PChar): Integer;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_is_directory' + LibSuff8;
+
+{#ifdef _OSD_POSIX
+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
+}
+procedure ap_log_assert(szExp, szFile: PChar; nLine: Integer);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_log_assert' + LibSuff12;
+
+{ @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 }
+// SIGSTOP_DETACH = 1;
+{ stop making a child process }
+// SIGSTOP_MAKE_CHILD = 2;
+{ stop spawning a child process }
+// SIGSTOP_SPAWN_CHILD = 4;
+{ stop spawning a child process with a piped log }
+// SIGSTOP_PIPED_LOG_SPAWN = 8;
+{ stop spawning a CGI child process }
+// SIGSTOP_CGI_CHILD = 16;
+
+{ Macro to get GDB started }
+{#ifdef DEBUG_SIGSTOP
+extern int raise_sigstop_flags;
+#define RAISE_SIGSTOP(x) do begin
+ if (raise_sigstop_flags & SIGSTOP_##x) raise(SIGSTOP);\
+ end 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.
+ }
+function ap_psignature(prefix: PChar; r: Prequest_rec): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_psignature' + LibSuff8;
+
+{const
+ AP_NORESTART = APR_OS_START_USEERR + 1;}
+
diff --git a/packages/httpd22/src/httpd.pas b/packages/httpd22/src/httpd.pas
new file mode 100644
index 0000000000..fb269ea1e6
--- /dev/null
+++ b/packages/httpd22/src/httpd.pas
@@ -0,0 +1,170 @@
+{
+ httpd.pas
+
+ Copyright (C) 2006 Felipe Monteiro de Carvalho
+
+ This unit is a pascal binding for the Apache 2.0.58 headers.
+ The headers were released under the following copyright:
+}
+{ 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.
+ }
+unit httpd;
+
+{$ifdef fpc}
+ {$mode delphi}{$H+}
+{$endif}
+
+{$IFNDEF FPC}
+ {$DEFINE WINDOWS}
+{$ENDIF}
+
+{$IFDEF WIN32}
+ {$DEFINE WINDOWS}
+{$ENDIF}
+
+{$ifdef Unix}
+ {$PACKRECORDS C}
+{$endif}
+
+{$define Apache2_2}
+
+interface
+
+uses
+{$ifdef WINDOWS}
+ Windows,
+{$ELSE}
+ UnixType,
+{$ENDIF}
+ apr, aprutil, ctypes;
+
+const
+{$ifndef fpc}
+ LineEnding = #13#10;
+{$endif}
+
+{$IFDEF WINDOWS}
+ LibHTTPD = 'libhttpd.dll';
+{$ELSE}
+ LibHTTPD = '';
+{$ENDIF}
+
+{ Declarations moved here to be on top of all declarations }
+
+{ configuration vector structure }
+type
+ ap_conf_vector_t = record end;
+ Pap_conf_vector_t = ^ap_conf_vector_t;
+ PPap_conf_vector_t = ^Pap_conf_vector_t;
+
+{
+ Main httpd header files
+
+ Note: There are more include files other then these, because some include files
+ include more files.
+}
+
+{$include ap_provider.inc}
+{$include util_cfgtree.inc}
+
+{$include httpd.inc}
+{$include http_config.inc}
+{$include http_core.inc}
+{$include http_log.inc}
+{$include http_main.inc}
+{$include http_protocol.inc}
+{$include http_request.inc}
+{$include http_connection.inc}
+{$include http_vhost.inc}
+
+{$include util_script.inc}
+{$include util_time.inc}
+{$include util_md5.inc}
+{$include ap_mpm.inc}
+
+implementation
+
+{
+ Macros transformed into functions in the translation
+}
+
+{ from httpd.inc }
+
+{ Internal representation for a HTTP protocol number, e.g., HTTP/1.1 }
+function HTTP_VERSION(major, minor: Integer): Integer;
+begin
+ Result := (1000*(major)+(minor));
+end;
+
+{ Major part of HTTP protocol }
+function HTTP_VERSION_MAJOR(number: Integer): Integer;
+begin
+ Result := number div 1000;
+end;
+
+{ Minor part of HTTP protocol }
+function HTTP_VERSION_MINOR(number: Integer): Integer;
+begin
+ Result := number mod 1000;
+end;
+
+function ap_escape_uri(p: Papr_pool_t; const path: PChar): PChar;
+begin
+ Result := ap_os_escape_path(p, path, 1);
+end;
+
+{ from http_config.inc }
+
+{ Use this in all standard modules }
+procedure STANDARD20_MODULE_STUFF(var mod_: module);
+begin
+ mod_.version := MODULE_MAGIC_NUMBER_MAJOR;
+ mod_.minor_version := MODULE_MAGIC_NUMBER_MINOR;
+ mod_.module_index := -1;
+// mod_.name: PChar;
+ mod_.dynamic_load_handle := nil;
+ mod_.next := nil;
+ mod_.magic := MODULE_MAGIC_COOKIE;
+ mod_.rewrite_args := nil;
+end;
+
+{ Use this only in MPMs }
+procedure MPM20_MODULE_STUFF(var mod_: module);
+begin
+ mod_.version := MODULE_MAGIC_NUMBER_MAJOR;
+ mod_.minor_version := MODULE_MAGIC_NUMBER_MINOR;
+ mod_.module_index := -1;
+// mod_.name: PChar;
+ mod_.dynamic_load_handle := nil;
+ mod_.next := nil;
+ mod_.magic := MODULE_MAGIC_COOKIE;
+end;
+
+function ap_get_module_config(v: Pap_conf_vector_t; m: Pmodule): Pap_conf_vector_t;
+begin
+ Result := Pointer(Integer(v) + m^.module_index);
+end;
+
+procedure ap_set_module_config(v: Pap_conf_vector_t; m: Pmodule; val: Pap_conf_vector_t);
+var
+ P: PPointer;
+begin
+ P := PPointer(Integer(v) + m^.module_index);
+ P^ := val;
+end;
+
+end.
+
diff --git a/packages/httpd22/src/util_cfgtree.inc b/packages/httpd22/src/util_cfgtree.inc
new file mode 100644
index 0000000000..f989ce7a5e
--- /dev/null
+++ b/packages/httpd22/src/util_cfgtree.inc
@@ -0,0 +1,77 @@
+{ 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.
+ }
+
+{
+ * @package Config Tree Package
+ }
+
+//#include "ap_config.h"
+
+type
+ Pap_directive_t = ^ap_directive_t;
+ PPap_directive_t = ^Pap_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.
+ }
+ ap_directive_t = record
+ { The current directive }
+ directive: PChar;
+ { The arguments for the current directive, stored as a space
+ * separated list }
+ args: PChar;
+ { The next directive node in the tree
+ * @defvar ap_directive_t *next }
+ next: Pap_directive_t;
+ { The first child node of this directive
+ * @defvar ap_directive_t *first_child }
+ first_child: Pap_directive_t;
+ { The parent node of this directive
+ * @defvar ap_directive_t *parent }
+ parent: Pap_directive_t;
+
+ { directive's module can store add'l data here }
+ data: Pointer;
+
+ { ### these may go away in the future, but are needed for now }
+ { The name of the file this directive was found in }
+ filename: PChar;
+ { The line number the directive was on }
+ line_num: Integer;
+ end;
+
+{
+ * 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);
+
diff --git a/packages/httpd22/src/util_filter.inc b/packages/httpd22/src/util_filter.inc
new file mode 100644
index 0000000000..69d11691a7
--- /dev/null
+++ b/packages/httpd22/src/util_filter.inc
@@ -0,0 +1,603 @@
+{ 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.
+ }
+
+{
+ * @file util_filter.h
+ * @brief Apache filter library
+ }
+
+{#include "apr.h"
+#include "apr_buckets.h"
+
+#include "httpd.h"
+
+#if APR_HAVE_STDARG_H
+#include <stdarg.h>
+#endif}
+
+const
+{ Returned by the bottom-most filter if no data was written.
+ * @see ap_pass_brigade(). }
+ AP_NOBODY_WROTE = -1;
+{ Returned by the bottom-most filter if no data was read.
+ * @see ap_get_brigade(). }
+ AP_NOBODY_READ = -2;
+{ Returned when?? @bug find out when! }
+ AP_FILTER_ERROR = -3;
+
+{
+ * input filtering modes
+ }
+type
+ ap_input_mode_t = (
+ { 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
+ );
+
+{
+ * @defgroup APACHE_CORE_FILTER Filter Chain
+ * @ingroup APACHE_CORE
+ *
+ * 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 }
+ Pap_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
+ }
+
+ ap_out_filter_func = function (f: Pap_filter_t;
+ b: Papr_bucket_brigade): apr_status_t;
+
+ ap_in_filter_func = function (f: Pap_filter_t;
+ b: Papr_bucket_brigade; mode: ap_input_mode_t;
+ block: apr_read_type_e; readbytes: apr_off_t): apr_status_t;
+
+ ap_init_filter_func = function (f: Pap_filter_t): Integer;
+
+ ap_filter_func = record
+ Case Integer of
+ 0: (out_func: ap_out_filter_func);
+ 1: (in_func: ap_in_filter_func);
+ end;
+
+{
+ * 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().
+ }
+ ap_filter_type = (
+ { 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
+ );
+
+{
+ * 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.
+ }
+
+ Pap_filter_rec_t = ^ap_filter_rec_t;
+
+ ap_filter_provider_t = record end;
+
+ Pap_filter_provider_t = ^ap_filter_provider_t;
+
+{
+ * @brief 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.
+ *
+ * It is used for any filter that can be inserted in the filter chain.
+ * This may be either a httpd-2.0 filter or a mod_filter harness.
+ * In the latter case it contains dispatch, provider and protocol information.
+ * In the former case, the new fields (from dispatch) are ignored.
+ }
+ ap_filter_rec_t = record
+ { The registered name for this filter }
+ name: PChar;
+
+ { The function to call when this filter is invoked. }
+ filter_func: ap_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.
+ }
+ filter_init_func: ap_init_filter_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.
+ }
+ ftype: ap_filter_type;
+
+ { The next filter_rec in the list }
+ next: Pap_filter_rec_t;
+
+ { Providers for this filter }
+ providers: Pap_filter_provider_t;
+
+ { Trace level for this filter }
+ debug: cint;
+
+ { Protocol flags for this filter }
+ proto_flags: cuint;
+ end;
+
+{
+ * 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.
+ }
+ ap_filter_t = record
+ { The internal representation of this filter. This includes
+ * the filter's name, type, and the actual function pointer.
+ }
+ frec: Pap_filter_rec_t;
+
+ { A place to store any data associated with the current filter }
+ ctx: Pointer;
+
+ { The next filter in the chain }
+ next: Pap_filter_t;
+
+ { 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.
+ }
+ r: Prequest_rec;
+
+ { The conn_rec associated with the current filter. This is analogous
+ * to the request_rec, except that it is used for input filtering.
+ }
+ c: Pconn_rec;
+ end;
+
+{
+ * 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.
+ }
+function ap_get_brigade(filter: Pap_filter_t;
+ bucket: Papr_bucket_brigade; mode: ap_input_mode_t;
+ block: apr_read_type_e; readbytes: apr_off_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_get_brigade' + LibSuff24;
+
+{
+ * 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
+ }
+function ap_pass_brigade(filter: Pap_filter_t;
+ bucket: Papr_bucket_brigade): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_pass_brigade' + LibSuff8;
+
+{
+ * 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()
+ }
+function ap_register_input_filter(const name: PChar;
+ filter_func: ap_in_filter_func; filter_init: ap_init_filter_func;
+ ftype: ap_filter_type): Pap_filter_rec_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_register_input_filter' + LibSuff16;
+
+{
+ * 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. It may also be used as a provider under mod_filter.
+ * This is (equivalent to) ap_register_output_filter_protocol with
+ * proto_flags=0, and is retained for back-compatibility with 2.0 modules.
+ *
+ * @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()
+ }
+function ap_register_output_filter(const name: PChar;
+ filter_func: ap_out_filter_func; filter_init: ap_init_filter_func;
+ ftype: ap_filter_type): Pap_filter_rec_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_register_output_filter' + LibSuff16;
+
+{ For httpd-2.2 I suggest replacing the above with
+#define ap_register_output_filter(name,ffunc,init,ftype) \
+ ap_register_output_filter_protocol(name,ffunc,init,ftype,0)
+}
+
+{
+ * 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. It may also be used as a provider under mod_filter.
+ *
+ * @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
+ * @param proto_flags Protocol flags: logical OR of AP_FILTER_PROTO_* bits
+ * @see ap_add_output_filter()
+ }
+function ap_register_output_filter_protocol(const name: PChar;
+ filter_func: ap_out_filter_func; filter_init: ap_init_filter_func;
+ ftype: ap_filter_type; proto_flags: cuint): Pap_filter_rec_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_register_output_filter_protocol' + LibSuff20;
+
+{
+ * 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
+ }
+function ap_add_input_filter(const name: PChar; ctx: Pointer;
+ r: Prequest_rec; c: Pconn_rec): Pap_filter_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_add_input_filter' + LibSuff16;
+
+{
+ * 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
+ }
+function ap_add_input_filter_handle(f: Pap_filter_t;
+ ctx: Pointer; r: Prequest_rec; c: Pconn_rec): Pap_filter_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_add_input_filter_handle' + LibSuff16;
+
+{
+ * Returns the filter handle for use with ap_add_input_filter_handle.
+ *
+ * @param name The filter name to look up
+ }
+function ap_get_input_filter_handle(const name: PChar): Pap_filter_rec_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_get_input_filter_handle' + LibSuff4;
+
+{
+ * 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
+ }
+function ap_add_output_filter(const name: PChar; ctx: Pointer;
+ r: Prequest_rec; c: Pconn_rec): Pap_filter_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_add_output_filter' + LibSuff16;
+
+{
+ * 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
+ }
+function ap_add_output_filter_handle(f: Pap_filter_rec_t;
+ ctx: Pointer; r: Prequest_rec; c: Pconn_rec): Pap_filter_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_add_output_filter_handle' + LibSuff16;
+
+{
+ * Returns the filter handle for use with ap_add_output_filter_handle.
+ *
+ * @param name The filter name to look up
+ }
+function ap_get_output_filter_handle(const name: PChar): Pap_filter_rec_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_get_output_filter_handle' + LibSuff4;
+
+{
+ * Remove an input filter from either the request or connection stack
+ * it is associated with.
+ * @param f The filter to remove
+ }
+procedure ap_remove_input_filter(f: Pap_filter_t);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_remove_input_filter' + LibSuff4;
+
+{
+ * Remove an output filter from either the request or connection stack
+ * it is associated with.
+ * @param f The filter to remove
+ }
+procedure ap_remove_output_filter(f: Pap_filter_t);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_remove_output_filter' + LibSuff4;
+
+{ 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
+ }
+function ap_save_brigade(f: Pap_filter_t;
+ save_to, b: PPapr_bucket_brigade; p: Papr_pool_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_save_brigade' + LibSuff16;
+
+{
+ * 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
+ }
+function ap_fflush(f: Pap_filter_t; bb: Papr_bucket_brigade): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_fflush' + LibSuff8;
+
+{
+ * 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
+ }
+function ap_fputstrs(f: Pap_filter_t; bb: Papr_bucket_brigade;
+ others: array of const): apr_status_t;
+ cdecl; external LibHTTPD name 'ap_fputstrs';
+
+{
+ * 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
+ }
+function ap_fprintf(f: Pap_filter_t; bb: Papr_bucket_brigade;
+ const fmt: PChar; others: array of const): apr_status_t;
+ cdecl; external LibHTTPD name 'ap_fputstrs';
+
+{ __attribute__((format(printf,3,4)));}
+
+{
+ * set protocol requirements for an output content filter
+ * (only works with AP_FTYPE_RESOURCE and AP_FTYPE_CONTENT_SET)
+ * @param f the filter in question
+ * @param proto_flags Logical OR of AP_FILTER_PROTO_* bits
+ }
+procedure ap_filter_protocol(f: Pap_filter_t; proto_flags: cuint);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_filter_protocol' + LibSuff8;
+
+const
+{ Filter changes contents (so invalidating checksums/etc) }
+ AP_FILTER_PROTO_CHANGE = $1;
+
+{ Filter changes length of contents (so invalidating content-length/etc) }
+ AP_FILTER_PROTO_CHANGE_LENGTH = $2;
+
+{ Filter requires complete input and can't work on byteranges }
+ AP_FILTER_PROTO_NO_BYTERANGE = $4;
+
+{ Filter should not run in a proxy }
+ AP_FILTER_PROTO_NO_PROXY = $8;
+
+{ Filter makes output non-cacheable }
+ AP_FILTER_PROTO_NO_CACHE = $10;
+
+{ Filter is incompatible with "Cache-Control: no-transform" }
+ AP_FILTER_PROTO_TRANSFORM = $20;
+
diff --git a/packages/httpd22/src/util_md5.inc b/packages/httpd22/src/util_md5.inc
new file mode 100644
index 0000000000..c0c51923e7
--- /dev/null
+++ b/packages/httpd22/src/util_md5.inc
@@ -0,0 +1,66 @@
+{ 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.
+ }
+
+{
+ * @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)
+ }
+function ap_md5(p: Papr_pool_t; const string_: PChar): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_md5' + LibSuff8;
+
+{
+ * 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)
+ }
+function ap_md5_binary(a: Papr_pool_t; const buf: PChar; len: Integer): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_md5_binary' + LibSuff12;
+
+{
+ * 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)
+ }
+function ap_md5contextTo64(a: Papr_pool_t; context: Papr_md5_ctx_t): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_md5contextTo64' + LibSuff8;
+
+{
+ * 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)
+ }
+function ap_md5digest(p: Papr_pool_t; infile: Papr_file_t): PChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_md5digest' + LibSuff8;
+
diff --git a/packages/httpd22/src/util_script.inc b/packages/httpd22/src/util_script.inc
new file mode 100644
index 0000000000..9d73e4781a
--- /dev/null
+++ b/packages/httpd22/src/util_script.inc
@@ -0,0 +1,140 @@
+{ 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.
+ }
+
+//#include "apr_buckets.h"
+
+{
+ * @package Apache script tools
+ }
+
+const
+ APACHE_ARG_MAX = 512;
+
+{
+ * 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)
+ }
+function ap_create_environment(p: Papr_pool_t; t: Papr_table_t): PPChar;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_create_environment' + LibSuff8;
+
+{
+ * 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)
+ }
+function ap_find_path_info(const uri, path_info: PChar): Integer;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_find_path_info' + LibSuff8;
+
+{
+ * 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)
+ }
+procedure ap_add_cgi_vars(r: Prequest_rec);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_add_cgi_vars' + LibSuff4;
+
+{
+ * Add common CGI environment variables to the requests environment table
+ * @param r The current request
+ * @deffunc void ap_add_common_vars(request_rec *r)
+ }
+procedure ap_add_common_vars(r: Prequest_rec);
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_add_common_vars' + LibSuff4;
+
+{
+ * 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)
+ }
+function ap_scan_script_header_err(r: Prequest_rec;
+ f: Papr_file_t; buffer: PChar): Integer;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_scan_script_header_err' + LibSuff12;
+
+{
+ * 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)
+ }
+function ap_scan_script_header_err_brigade(r: Prequest_rec;
+ bb: Papr_bucket_brigade; buffer: PChar): Integer;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_scan_script_header_err_brigade' + LibSuff12;
+
+{
+ * 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)
+ }
+function ap_scan_script_header_err_strs(buffer: PChar;
+ termch: PPChar; termarg: PInteger; others: array of const): Integer;
+ cdecl; external LibHTTPD name 'ap_scan_script_header_err_strs';
+
+{
+ * 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)
+ }
+type
+ getsfunc_t = function(p1: PChar; p2: Integer; p3: Pointer): Integer;
+
+function ap_scan_script_header_err_core(r: Prequest_rec;
+ buffer: PChar; getsfunc: getsfunc_t; getsfunc_data: Pointer): Integer;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_scan_script_header_err_core' + LibSuff16;
+
diff --git a/packages/httpd22/src/util_time.inc b/packages/httpd22/src/util_time.inc
new file mode 100644
index 0000000000..cfcaf5b3ea
--- /dev/null
+++ b/packages/httpd22/src/util_time.inc
@@ -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.
+ }
+
+{
+ * @package Apache date-time handling functions
+ }
+
+{#include "apr.h"
+#include "apr_time.h"
+#include "httpd.h"}
+
+{ 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!)
+ }
+const 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
+ }
+function ap_explode_recent_localtime(tm: Papr_time_exp_t; t: apr_time_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_explode_recent_localtime' + LibSuff12;
+
+{
+ * 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
+ }
+function ap_explode_recent_gmt(tm: Papr_time_exp_t; t: apr_time_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_explode_recent_gmt' + LibSuff12;
+
+{
+ * format a recent timestamp in the ctime() format.
+ * @param date_str String to write to.
+ * @param t the time to convert
+ }
+function ap_recent_ctime(date_str: PChar; t: apr_time_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_recent_ctime' + LibSuff12;
+
+{
+ * 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
+ }
+function ap_recent_rfc822_date(date_str: PChar; t: apr_time_t): apr_status_t;
+ {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+ external LibHTTPD name LibNamePrefix + 'ap_recent_rfc822_date' + LibSuff12;
+