Loading include/ap_mmn.h +3 −1 Original line number Diff line number Diff line Loading @@ -390,12 +390,14 @@ * ap_core_ctx_get_bb(), move core_net rec definition * to http_core.h * 20120201.0 (2.5.0-dev) Bump MODULE_MAGIC_COOKIE to "AP25"! * 20120204.0 (2.5.0-dev) Remove ap_create_core_ctx(), ap_core_ctx_get_bb(); * add insert_network_bucket hook, AP_DECLINED */ #define MODULE_MAGIC_COOKIE 0x41503235UL /* "AP25" */ #ifndef MODULE_MAGIC_NUMBER_MAJOR #define MODULE_MAGIC_NUMBER_MAJOR 20120201 #define MODULE_MAGIC_NUMBER_MAJOR 20120204 #endif #define MODULE_MAGIC_NUMBER_MINOR 0 /* 0...n */ Loading include/http_core.h +11 −18 Original line number Diff line number Diff line Loading @@ -704,24 +704,17 @@ typedef struct core_net_rec { } core_net_rec; /** * Allocate and fill the core_ctx_t for the core input filter, but don't * create a bucket with the input socket. * Normally this is done automatically when the core input filter is called * for the first time, but MPMs or protocol modules that need to do special * socket setup can call this function to do the initialization earlier. * They must add the input socket bucket to the core input filter's bucket * brigade, see ap_core_ctx_get_bb(). * @param c The conn_rec of the connection * @return The core_ctx_t to be stored in core_net_rec->in_ctx */ AP_DECLARE(core_ctx_t *) ap_create_core_ctx(conn_rec *c); /** * Accessor for the core input filter's bucket brigade * @param c The core_ctx_t to get the brigade from * @return The bucket brigade */ AP_DECLARE(apr_bucket_brigade *) ap_core_ctx_get_bb(core_ctx_t *ctx); * Insert the network bucket into the core input filter's input brigade. * This hook is intended for MPMs or protocol modules that need to do special * socket setup. * @param c The connection * @param bb The brigade to insert the bucket into * @param socket The socket to put into a bucket * @return AP_DECLINED if the current function does not handle this connection, * APR_SUCCESS or an error otherwise. */ AP_DECLARE_HOOK(apr_status_t, insert_network_bucket, (conn_rec *c, apr_bucket_brigade *bb, apr_socket_t *socket)) /* ---------------------------------------------------------------------- * Loading include/httpd.h +12 −0 Original line number Diff line number Diff line Loading @@ -385,6 +385,18 @@ extern "C" { # define AP_CORE_DECLARE_NONSTD AP_DECLARE_NONSTD #endif /** * @defgroup APACHE_APR_STATUS_T HTTPD specific values of apr_status_t * @{ */ #define AP_START_USERERR (APR_OS_START_USERERR + 2000) #define AP_USERERR_LEN 1000 /** The function declines to handle the request */ #define AP_DECLINED (AP_START_USERERR + 0) /** @} */ /** * @brief The numeric version information is broken out into fields within this * structure. Loading server/core.c +17 −0 Original line number Diff line number Diff line Loading @@ -82,12 +82,18 @@ APR_HOOK_STRUCT( APR_HOOK_LINK(get_mgmt_items) APR_HOOK_LINK(insert_network_bucket) ) AP_IMPLEMENT_HOOK_RUN_ALL(int, get_mgmt_items, (apr_pool_t *p, const char *val, apr_hash_t *ht), (p, val, ht), OK, DECLINED) AP_IMPLEMENT_HOOK_RUN_FIRST(apr_status_t, insert_network_bucket, (conn_rec *c, apr_bucket_brigade *bb, apr_socket_t *socket), (c, bb, socket), AP_DECLINED) /* Server core module... This module provides support for really basic * server operations, including options and commands which control the * operation of other modules. Consider this the bureaucracy module. Loading Loading @@ -4729,6 +4735,15 @@ AP_DECLARE(apr_uint32_t) ap_random_pick(apr_uint32_t min, apr_uint32_t max) return number; } static apr_status_t core_insert_network_bucket(conn_rec *c, apr_bucket_brigade *bb, apr_socket_t *socket) { apr_bucket *e = apr_bucket_socket_create(socket, c->bucket_alloc); APR_BRIGADE_INSERT_TAIL(bb, e); return APR_SUCCESS; } static void core_dump_config(apr_pool_t *p, server_rec *s) { core_server_config *sconf = ap_get_core_module_config(s->module_config); Loading Loading @@ -4803,6 +4818,8 @@ static void register_hooks(apr_pool_t *p) APR_HOOK_MIDDLE); ap_hook_pre_mpm(ap_create_scoreboard, NULL, NULL, APR_HOOK_MIDDLE); ap_hook_child_status(ap_core_child_status, NULL, NULL, APR_HOOK_MIDDLE); ap_hook_insert_network_bucket(core_insert_network_bucket, NULL, NULL, APR_HOOK_REALLY_LAST); /* register the core's insert_filter hook and register core-provided * filters Loading server/core_filters.c +6 −17 Original line number Diff line number Diff line Loading @@ -91,24 +91,10 @@ struct core_filter_ctx { }; AP_DECLARE(core_ctx_t *) ap_create_core_ctx(conn_rec *c) { core_ctx_t *ctx = apr_palloc(c->pool, sizeof(*ctx)); ctx->b = apr_brigade_create(c->pool, c->bucket_alloc); ctx->tmpbb = apr_brigade_create(c->pool, c->bucket_alloc); return ctx; } AP_DECLARE(apr_bucket_brigade *) ap_core_ctx_get_bb(core_ctx_t *ctx) { return ctx->b; } apr_status_t 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_bucket *e; apr_status_t rv; core_net_rec *net = f->ctx; core_ctx_t *ctx = net->in_ctx; Loading @@ -131,10 +117,13 @@ apr_status_t ap_core_input_filter(ap_filter_t *f, apr_bucket_brigade *b, if (!ctx) { net->in_ctx = ctx = ap_create_core_ctx(f->c); net->in_ctx = ctx = apr_palloc(f->c->pool, sizeof(*ctx)); ctx->b = apr_brigade_create(f->c->pool, f->c->bucket_alloc); ctx->tmpbb = apr_brigade_create(f->c->pool, f->c->bucket_alloc); /* seed the brigade with the client socket. */ e = apr_bucket_socket_create(net->client_socket, f->c->bucket_alloc); APR_BRIGADE_INSERT_TAIL(ctx->b, e); rv = ap_run_insert_network_bucket(f->c, ctx->b, net->client_socket); if (rv != APR_SUCCESS) return rv; } else if (APR_BRIGADE_EMPTY(ctx->b)) { return APR_EOF; Loading Loading
include/ap_mmn.h +3 −1 Original line number Diff line number Diff line Loading @@ -390,12 +390,14 @@ * ap_core_ctx_get_bb(), move core_net rec definition * to http_core.h * 20120201.0 (2.5.0-dev) Bump MODULE_MAGIC_COOKIE to "AP25"! * 20120204.0 (2.5.0-dev) Remove ap_create_core_ctx(), ap_core_ctx_get_bb(); * add insert_network_bucket hook, AP_DECLINED */ #define MODULE_MAGIC_COOKIE 0x41503235UL /* "AP25" */ #ifndef MODULE_MAGIC_NUMBER_MAJOR #define MODULE_MAGIC_NUMBER_MAJOR 20120201 #define MODULE_MAGIC_NUMBER_MAJOR 20120204 #endif #define MODULE_MAGIC_NUMBER_MINOR 0 /* 0...n */ Loading
include/http_core.h +11 −18 Original line number Diff line number Diff line Loading @@ -704,24 +704,17 @@ typedef struct core_net_rec { } core_net_rec; /** * Allocate and fill the core_ctx_t for the core input filter, but don't * create a bucket with the input socket. * Normally this is done automatically when the core input filter is called * for the first time, but MPMs or protocol modules that need to do special * socket setup can call this function to do the initialization earlier. * They must add the input socket bucket to the core input filter's bucket * brigade, see ap_core_ctx_get_bb(). * @param c The conn_rec of the connection * @return The core_ctx_t to be stored in core_net_rec->in_ctx */ AP_DECLARE(core_ctx_t *) ap_create_core_ctx(conn_rec *c); /** * Accessor for the core input filter's bucket brigade * @param c The core_ctx_t to get the brigade from * @return The bucket brigade */ AP_DECLARE(apr_bucket_brigade *) ap_core_ctx_get_bb(core_ctx_t *ctx); * Insert the network bucket into the core input filter's input brigade. * This hook is intended for MPMs or protocol modules that need to do special * socket setup. * @param c The connection * @param bb The brigade to insert the bucket into * @param socket The socket to put into a bucket * @return AP_DECLINED if the current function does not handle this connection, * APR_SUCCESS or an error otherwise. */ AP_DECLARE_HOOK(apr_status_t, insert_network_bucket, (conn_rec *c, apr_bucket_brigade *bb, apr_socket_t *socket)) /* ---------------------------------------------------------------------- * Loading
include/httpd.h +12 −0 Original line number Diff line number Diff line Loading @@ -385,6 +385,18 @@ extern "C" { # define AP_CORE_DECLARE_NONSTD AP_DECLARE_NONSTD #endif /** * @defgroup APACHE_APR_STATUS_T HTTPD specific values of apr_status_t * @{ */ #define AP_START_USERERR (APR_OS_START_USERERR + 2000) #define AP_USERERR_LEN 1000 /** The function declines to handle the request */ #define AP_DECLINED (AP_START_USERERR + 0) /** @} */ /** * @brief The numeric version information is broken out into fields within this * structure. Loading
server/core.c +17 −0 Original line number Diff line number Diff line Loading @@ -82,12 +82,18 @@ APR_HOOK_STRUCT( APR_HOOK_LINK(get_mgmt_items) APR_HOOK_LINK(insert_network_bucket) ) AP_IMPLEMENT_HOOK_RUN_ALL(int, get_mgmt_items, (apr_pool_t *p, const char *val, apr_hash_t *ht), (p, val, ht), OK, DECLINED) AP_IMPLEMENT_HOOK_RUN_FIRST(apr_status_t, insert_network_bucket, (conn_rec *c, apr_bucket_brigade *bb, apr_socket_t *socket), (c, bb, socket), AP_DECLINED) /* Server core module... This module provides support for really basic * server operations, including options and commands which control the * operation of other modules. Consider this the bureaucracy module. Loading Loading @@ -4729,6 +4735,15 @@ AP_DECLARE(apr_uint32_t) ap_random_pick(apr_uint32_t min, apr_uint32_t max) return number; } static apr_status_t core_insert_network_bucket(conn_rec *c, apr_bucket_brigade *bb, apr_socket_t *socket) { apr_bucket *e = apr_bucket_socket_create(socket, c->bucket_alloc); APR_BRIGADE_INSERT_TAIL(bb, e); return APR_SUCCESS; } static void core_dump_config(apr_pool_t *p, server_rec *s) { core_server_config *sconf = ap_get_core_module_config(s->module_config); Loading Loading @@ -4803,6 +4818,8 @@ static void register_hooks(apr_pool_t *p) APR_HOOK_MIDDLE); ap_hook_pre_mpm(ap_create_scoreboard, NULL, NULL, APR_HOOK_MIDDLE); ap_hook_child_status(ap_core_child_status, NULL, NULL, APR_HOOK_MIDDLE); ap_hook_insert_network_bucket(core_insert_network_bucket, NULL, NULL, APR_HOOK_REALLY_LAST); /* register the core's insert_filter hook and register core-provided * filters Loading
server/core_filters.c +6 −17 Original line number Diff line number Diff line Loading @@ -91,24 +91,10 @@ struct core_filter_ctx { }; AP_DECLARE(core_ctx_t *) ap_create_core_ctx(conn_rec *c) { core_ctx_t *ctx = apr_palloc(c->pool, sizeof(*ctx)); ctx->b = apr_brigade_create(c->pool, c->bucket_alloc); ctx->tmpbb = apr_brigade_create(c->pool, c->bucket_alloc); return ctx; } AP_DECLARE(apr_bucket_brigade *) ap_core_ctx_get_bb(core_ctx_t *ctx) { return ctx->b; } apr_status_t 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_bucket *e; apr_status_t rv; core_net_rec *net = f->ctx; core_ctx_t *ctx = net->in_ctx; Loading @@ -131,10 +117,13 @@ apr_status_t ap_core_input_filter(ap_filter_t *f, apr_bucket_brigade *b, if (!ctx) { net->in_ctx = ctx = ap_create_core_ctx(f->c); net->in_ctx = ctx = apr_palloc(f->c->pool, sizeof(*ctx)); ctx->b = apr_brigade_create(f->c->pool, f->c->bucket_alloc); ctx->tmpbb = apr_brigade_create(f->c->pool, f->c->bucket_alloc); /* seed the brigade with the client socket. */ e = apr_bucket_socket_create(net->client_socket, f->c->bucket_alloc); APR_BRIGADE_INSERT_TAIL(ctx->b, e); rv = ap_run_insert_network_bucket(f->c, ctx->b, net->client_socket); if (rv != APR_SUCCESS) return rv; } else if (APR_BRIGADE_EMPTY(ctx->b)) { return APR_EOF; Loading