* ap_proxy_table_unmerge(), proxy_lb_workers.
* 20120109.0 (2.4.1-dev) Changes sizeof(overrides_t) in core config.
* 20120109.1 (2.4.1-dev) remove sb_type in global_score.
+ * 20120109.2 (2.4.1-dev) Make core_output_filter_ctx_t and core_ctx_t
+ * private;
+ * move core_net rec definition to http_core.h;
+ * add insert_network_bucket hook, AP_DECLINED
*/
#define MODULE_MAGIC_COOKIE 0x41503234UL /* "AP24" */
#ifndef MODULE_MAGIC_NUMBER_MAJOR
#define MODULE_MAGIC_NUMBER_MAJOR 20120109
#endif
-#define MODULE_MAGIC_NUMBER_MINOR 1 /* 0...n */
+#define MODULE_MAGIC_NUMBER_MINOR 2 /* 0...n */
/**
* Determine if the server's current MODULE_MAGIC_NUMBER is at least a
AP_DECLARE(const char*) ap_get_server_protocol(server_rec* s);
AP_DECLARE(void) ap_set_server_protocol(server_rec* s, const char* proto);
+typedef struct core_output_filter_ctx core_output_filter_ctx_t;
+typedef struct core_filter_ctx core_ctx_t;
+
+typedef struct core_net_rec {
+ /** Connection to the client */
+ apr_socket_t *client_socket;
+
+ /** connection record */
+ conn_rec *c;
+
+ core_output_filter_ctx_t *out_ctx;
+ core_ctx_t *in_ctx;
+} core_net_rec;
+
+/**
+ * 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))
+
/* ----------------------------------------------------------------------
*
* Runtime status/management
# 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.
void *context;
};
-typedef struct core_output_filter_ctx {
- apr_bucket_brigade *buffered_bb;
- apr_bucket_brigade *tmp_flush_bb;
- apr_pool_t *deferred_write_pool;
- apr_size_t bytes_in;
- apr_size_t bytes_written;
-} core_output_filter_ctx_t;
-
-typedef struct core_filter_ctx {
- apr_bucket_brigade *b;
- apr_bucket_brigade *tmpbb;
-} core_ctx_t;
-
-typedef struct core_net_rec {
- /** Connection to the client */
- apr_socket_t *client_socket;
-
- /** connection record */
- conn_rec *c;
-
- core_output_filter_ctx_t *out_ctx;
- core_ctx_t *in_ctx;
-} core_net_rec;
-
/**
* Get the context_document_root for a request. This is a generalization of
* the document root, which is too limited in the presence of mappers like
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.
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);
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
#undef APLOG_MODULE_INDEX
#define APLOG_MODULE_INDEX AP_CORE_MODULE_INDEX
+struct core_output_filter_ctx {
+ apr_bucket_brigade *buffered_bb;
+ apr_bucket_brigade *tmp_flush_bb;
+ apr_pool_t *deferred_write_pool;
+ apr_size_t bytes_written;
+};
+
+struct core_filter_ctx {
+ apr_bucket_brigade *b;
+ apr_bucket_brigade *tmpbb;
+};
+
+
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;
if (!ctx)
{
- /*
- * Note that this code is never executed on Windows because the winnt
- * MPM does the setup of net->in_ctx.
- * XXX: This should be fixed.
- */
- ctx = apr_pcalloc(f->c->pool, sizeof(*ctx));
+ 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(ctx->b->p, ctx->b->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);
- net->in_ctx = ctx;
+ 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;
return context;
}
+apr_status_t winnt_insert_network_bucket(conn_rec *c,
+ apr_bucket_brigade *bb,
+ apr_socket_t *socket)
+{
+ apr_bucket *e;
+ winnt_conn_ctx_t *context = ap_get_module_config(c->conn_config,
+ &mpm_winnt_module);
+ if (context == NULL || (e = context->overlapped.Pointer) == NULL)
+ return AP_DECLINED;
+
+ /* seed the brigade with AcceptEx read heap bucket */
+ APR_BRIGADE_INSERT_HEAD(bb, e);
+ /* also seed the brigade with the client socket. */
+ e = apr_bucket_socket_create(socket, c->bucket_alloc);
+ APR_BRIGADE_INSERT_TAIL(bb, e);
+ return APR_SUCCESS;
+}
/*
* worker_main()
{
apr_bucket_free(e);
}
- else if (e)
+ else
{
- core_ctx_t *ctx;
- core_net_rec *net;
- ap_filter_t *filt;
-
- filt = c->input_filters;
- while ((strcmp(filt->frec->name, "core_in") != 0) && filt->next)
- filt = filt->next;
- net = filt->ctx;
- ctx = net->in_ctx;
-
- if (net->in_ctx)
- ctx = net->in_ctx;
- else
- {
- ctx = apr_pcalloc(c->pool, sizeof(*ctx));
- ctx->b = apr_brigade_create(c->pool, c->bucket_alloc);
- ctx->tmpbb = apr_brigade_create(c->pool, c->bucket_alloc);
-
- /* seed the brigade with AcceptEx read heap bucket */
- e = context->overlapped.Pointer;
- APR_BRIGADE_INSERT_HEAD(ctx->b, e);
-
- /* also seed the brigade with the client socket. */
- e = apr_bucket_socket_create(net->client_socket,
- c->bucket_alloc);
- APR_BRIGADE_INSERT_TAIL(ctx->b, e);
- net->in_ctx = ctx;
- }
+ ap_set_module_config(c->conn_config, &mpm_winnt_module, context);
}
if (!c->aborted)
ap_hook_mpm(winnt_run, NULL, NULL, APR_HOOK_MIDDLE);
ap_hook_mpm_query(winnt_query, NULL, NULL, APR_HOOK_MIDDLE);
ap_hook_mpm_get_name(winnt_get_name, NULL, NULL, APR_HOOK_MIDDLE);
+ ap_hook_insert_network_bucket(winnt_insert_network_bucket, NULL, NULL,
+ APR_HOOK_MIDDLE);
}
AP_DECLARE_MODULE(mpm_winnt) = {
/* From mpm_winnt.c: */
+extern module AP_MODULE_DECLARE_DATA mpm_winnt_module;
extern int ap_threads_per_child;
extern DWORD my_pid;
/* From child.c: */
void child_main(apr_pool_t *pconf);
+apr_status_t winnt_insert_network_bucket(conn_rec *c,
+ apr_bucket_brigade *bb,
+ apr_socket_t *socket);
#endif /* APACHE_MPM_WINNT_H */
/** @} */