API Changes in Apache HTTP Server 2.4 since 2.2 - Apache HTTP Server Version 2.5
Modules | Directives | FAQ | Glossary | Sitemap | Report a bug Apache HTTP Server Version 2.5 Apache > HTTP Server > Documentation > Version 2.5 API Changes in Apache HTTP Server 2.4 since 2.2 Available Languages: en This document describes changes to the Apache HTTPD API from version 2.2 to 2.4, that may be of interest to module/application developers and core hacks. As of the first GA release of the 2.4 branch API compatibility is preserved for the life of the 2.4 branch. (The VERSIONING description for the 2.4 release provides more information about API compatibility.) API changes fall into two categories: APIs that are altogether new, and existing APIs that are expanded or changed.
The latter are further divided into those where all changes are backwards-compatible (so existing modules can ignore them), and those that might require attention by maintainers. As with the transition from HTTPD 2.0 to 2.2, existing modules and applications will require recompiling and may call for some attention, but most should not require any substantial updating (although some may be able to take advantage of API changes to offer significant improvements).
For the purpose of this document, the API is split according to the public header files. These headers are themselves the reference documentation, and can be used to generate a browsable HTML reference with make docs . Changed APIs Specific information on upgrading modules from 2.2 Changed APIs ¶ ap_expr (NEW!) Introduces a new API to parse and evaluate boolean and algebraic expressions, including provision for a standard syntax and customized variants. ap_listen (changed; backwards-compatible) Introduces a new API to enable httpd child processes to serve different purposes. ap_mpm (changed) ap_mpm_run is replaced by a new mpm hook.
Also ap_graceful_stop_signalled is lost, and ap_mpm_register_timed_callback is new. ap_regex (changed) In addition to the existing regexp wrapper, a new higher-level API ap_rxplus is now provided. This provides the capability to compile Perl-style expressions like s/regexp/replacement/flags and to execute them against arbitrary strings. Support for regexp backreferences is also added. ap_slotmem (NEW!) Introduces an API for modules to allocate and manage memory slots, most commonly for shared memory. ap_socache (NEW!) API to manage a shared object cache. heartbeat (NEW!) common structures for heartbeat modules ap_parse_htaccess (changed) The function signature for ap_parse_htaccess has been changed.
A apr_table_t of individual directives allowed for override must now be passed (override remains). http_config (changed) Introduces per-module, per-directory loglevels, including macro wrappers. New AP_DECLARE_MODULE macro to declare all modules. New APLOG_USE_MODULE macro necessary for per-module loglevels in multi-file modules. New API to retain data across module unload/load New check_config hook New ap_process_fnmatch_configs() function to process wildcards Change ap_configfile_t , ap_cfg_getline() , ap_cfg_getc() to return error codes, and add ap_pcfg_strerror() for retrieving an error description.
Any config directive permitted in ACCESS_CONF context must now correctly handle being called from an .htaccess file via the new AllowOverrideList directive. ap_check_cmd_context() accepts a new flag NOT_IN_HTACCESS to detect this case. http_core (changed) REMOVED ap_default_type , ap_requires , all 2.2 authnz API Introduces Optional Functions for logio and authnz New function ap_get_server_name_for_url to support IPv6 literals.
New function ap_register_errorlog_handler to register error log format string handlers. Arguments of error_log hook have changed. Declaration has moved to http_core.h . New function ap_state_query to determine if the server is in the initial configuration preflight phase or not. This is both easier to use and more correct than the old method of creating a pool userdata entry in the process pool. New function ap_get_conn_socket to get the socket descriptor for a connection.
This should be used instead of accessing the core connection config directly. httpd (changed) Introduce per-directory, per-module loglevel New loglevels APLOG_TRACEn Introduce errorlog ids for requests and connections Support for mod_request kept_body Support buffering filter data for async requests New CONN_STATE values Function changes: ap_escape_html updated; ap_unescape_all , ap_escape_path_segment_buffer Modules that load other modules later than the EXEC_ON_READ config reading stage need to call ap_reserve_module_slots() or ap_reserve_module_slots_directive() in their pre_config hook .
The useragent IP address per request can now be tracked independently of the client IP address of the connection, for support of deployments with load balancers. http_log (changed) Introduce per-directory, per-module loglevel New loglevels APLOG_TRACEn ap_log_*error become macro wrappers (backwards-compatible if APLOG_MARK macro is used, except that is no longer possible to use #ifdef inside the argument list) piped logging revamped module_index added to error_log hook new function: ap_log_command_line http_request (changed) New auth_internal API and auth_provider API New EOR bucket type New function ap_process_async_request New flags AP_AUTH_INTERNAL_PER_CONF and AP_AUTH_INTERNAL_PER_URI New access_checker_ex hook to apply additional access control and/or bypass authentication.
New functions ap_hook_check_access_ex , ap_hook_check_access , ap_hook_check_authn , ap_hook_check_authz which accept AP_AUTH_INTERNAL_PER_* flags DEPRECATED direct use of ap_hook_access_checker , access_checker_ex , ap_hook_check_user_id , ap_hook_auth_checker When possible, registering all access control hooks (including authentication and authorization hooks) using AP_AUTH_INTERNAL_PER_CONF is recommended. If all modules' access control hooks are registered with this flag, then whenever the server handles an internal sub-request that matches the same set of access control configuration directives as the initial request (which is the common case), it can avoid invoking the access control hooks another time.
If your module requires the old behavior and must perform access control checks on every sub-request with a different URI from the initial request, even if that URI matches the same set of access control configuration directives, then use AP_AUTH_INTERNAL_PER_URI . mod_auth (NEW!) Introduces the new provider framework for authn and authz mod_cache (changed) Introduces a commit_entity() function to the cache provider interface, allowing atomic writes to cache.
Add a cache_status() hook to report the cache decision. All private structures and functions were removed. mod_core (NEW!) This introduces low-level APIs to send arbitrary headers, and exposes functions to handle HTTP OPTIONS and TRACE. mod_cache_disk (changed) Changes the disk format of the disk cache to support atomic cache updates without locking. The device/inode pair of the body file is embedded in the header file, allowing confirmation that the header and body belong to one another. mod_disk_cache (renamed) The mod_disk_cache module has been renamed to mod_cache_disk in order to be consistent with the naming of other modules within the server. mod_request (NEW!) The API for mod_request , to make input data available to multiple application/handler modules where required, and to parse HTML form data. mpm_common (changed) REMOVES: accept , lockfile , lock_mech , set_scoreboard (locking uses the new ap_mutex API) NEW API to drop privileges (delegates this platform-dependent function to modules) NEW Hooks: mpm_query , timed_callback , and get_name CHANGED interfaces: monitor hook, ap_reclaim_child_processes , ap_relieve_child_processes scoreboard (changed) ap_get_scoreboard_worker is made non-backwards-compatible as an alternative version is introduced.
Additional proxy_balancer support. Child status stuff revamped. util_cookies (NEW!) Introduces a new API for managing H
The rest of this page is on the live site.