HTTP Extensions provides a way to extend the functionality of HTTP while maintaining the semantics of GET.
Apache provides a set of standard bucket types allowing data collection from a variety of sources:
static void meta_package_register_hooks (apr_pool_t *p) { static const char * const listOfOne[]={ "mod_http_ext.c", NULL }; ap_hook_post_config(meta_package_post_config, listOfOne, NULL, APR_HOOK_MIDDLE); } static void meta_package_post_config (apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp, server_rec *s) { httpExt_register_extension(p, META_PACKAGE_URI, &meta_package_notify, HTTP_EXT_EXCLUSIVE); } static httpExt_error_code meta_package_notify (request_rec *r, const char * const uri, apr_table_t * headersIn, apr_table_t * declExts) { apr_array_header_t *hdrs_arr; apr_table_entry_t *hdrs; void * httpExt_context; int i; ... return HTTP_EXT_OK; }
and
static void meta_package_register_hooks (apr_pool_t *p) { static const char * const listOfOne[]={ "mod_http_ext.c", NULL }; ap_hook_post_config(meta_package_post_config, listOfOne, NULL, APR_HOOK_MIDDLE); ap_register_output_filter("meta_package_AP_FTYPE_CONTENT", meta_package_AP_FTYPE_CONTENT, AP_FTYPE_CONTENT); } static void meta_package_post_config (apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp, server_rec *s) { httpExt_register_extension(p, META_PACKAGE_URI, NULL, HTTP_EXT_EXCLUSIVE); } static int meta_package_post_read_request (request_rec *r) { apr_table_t * headersIn; apr_array_header_t *hdrs_arr; apr_table_entry_t *hdrs; void * httpExt_context; int i; if ((r->main || r->prev) && 0) /* it's an internal request */ return DECLINED; headersIn = httpExt_get_headers_in(r, META_PACKAGE_URI); if (headersIn == NULL) return DECLINED; ... return DECLINED; /* other modules may be called after this one */ }
behave the same.
Eric Prud'hommeaux, 18th August 2001