RELEASE SHOWSTOPPERS:
+ * Not all MPMs are updated to set conn_rec::current_thread correctly.
+ (Prefork, Worker, Event, Simple are updated).
+
* Handling of non-trailing / config by non-default handler is broken
http://marc.theaimsgroup.com/?l=apache-httpd-dev&m=105451701628081&w=2
jerenkrantz asks: Why should this block a release?
* and make ap_escape_html a macro for it.
* 20090130.0 (2.3.2-dev) Add ap_ prefix to unixd_setup_child().
* 20090131.0 (2.3.2-dev) Remove ap_default_type(), disable DefaultType
+ * 20090208.0 (2.3.2-dev) Add conn_rec::current_thread.
*/
#define MODULE_MAGIC_COOKIE 0x41503234UL /* "AP24" */
#ifndef MODULE_MAGIC_NUMBER_MAJOR
-#define MODULE_MAGIC_NUMBER_MAJOR 20090131
+#define MODULE_MAGIC_NUMBER_MAJOR 20090208
#endif
#define MODULE_MAGIC_NUMBER_MINOR 0 /* 0...n */
#include "apr_network_io.h"
#include "apr_buckets.h"
#include "apr_poll.h"
+#include "apr_thread_proc.h"
#include "os.h"
apr_thread_mutex_t *invoke_mtx;
apr_table_t *body_table;
+
/* 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
* the event mpm.
*/
int clogging_input_filters;
+
+ /** This points to the current thread being used to process this request,
+ * over the lifetime of a request, the value may change. Users of the connection
+ * record should not rely upon it staying the same between calls that invole
+ * the MPM.
+ */
+#if APR_HAS_THREADS
+ apr_thread_t *current_thread;
+#endif
};
/**
* Child process main loop.
*/
-static int process_socket(apr_pool_t * p, apr_socket_t * sock,
+static int process_socket(apr_thread_t *thd, apr_pool_t * p, apr_socket_t * sock,
conn_state_t * cs, int my_child_num,
int my_thread_num)
{
cs->bucket_alloc = apr_bucket_alloc_create(p);
c = ap_run_create_connection(p, ap_server_conf, sock,
conn_id, sbh, cs->bucket_alloc);
+ c->current_thread = thd;
cs->c = c;
c->cs = cs;
cs->p = p;
c = cs->c;
c->sbh = sbh;
pt = cs->pfd.client_data;
+ c->current_thread = thd;
}
if (c->clogging_input_filters && !c->aborted) {
else {
is_idle = 0;
worker_sockets[thread_slot] = csd;
- rv = process_socket(ptrans, csd, cs, process_slot, thread_slot);
+ rv = process_socket(thd, ptrans, csd, cs, process_slot, thread_slot);
if (!rv) {
requests_this_child--;
}
static void child_main(int child_num_arg)
{
+#if APR_HAS_THREADS
+ apr_thread_t *thd;
+ apr_os_thread_t osthd;
+#endif
apr_pool_t *ptrans;
apr_allocator_t *allocator;
apr_status_t status;
apr_allocator_owner_set(allocator, pchild);
apr_pool_tag(pchild, "pchild");
+#if APR_HAS_THREADS
+ osthd = apr_os_thread_current();
+ apr_os_thread_put(&thd, &osthd, pchild);
+#endif
+
apr_pool_create(&ptrans, pchild);
apr_pool_tag(ptrans, "transaction");
current_conn = ap_run_create_connection(ptrans, ap_server_conf, csd, my_child_num, sbh, bucket_alloc);
if (current_conn) {
+#if APR_HAS_THREADS
+ current_conn->current_thread = thd;
+#endif
ap_process_connection(current_conn, csd);
ap_lingering_close(current_conn);
}
simple_conn_t *scon = (simple_conn_t *) sb->baton;
apr_status_t rv;
+ scon->c->current_thread = thread;
+
rv = simple_io_process(scon);
if (rv) {
cs = scon->c->cs;
sb = apr_pcalloc(scon->pool, sizeof(simple_sb_t));
+ scon->c->current_thread = thread;
+
cs->pfd.p = scon->pool;
cs->pfd.desc_type = APR_POLL_SOCKET;
cs->pfd.desc.s = scon->sock;
* Child process main loop.
*/
-static void process_socket(apr_pool_t *p, apr_socket_t *sock, int my_child_num,
+static void process_socket(apr_thread_t *thd, apr_pool_t *p, apr_socket_t *sock,
+ int my_child_num,
int my_thread_num, apr_bucket_alloc_t *bucket_alloc)
{
conn_rec *current_conn;
current_conn = ap_run_create_connection(p, ap_server_conf, sock,
conn_id, sbh, bucket_alloc);
if (current_conn) {
+ current_conn->current_thread = thd;
ap_process_connection(current_conn, sock);
ap_lingering_close(current_conn);
}
is_idle = 0;
worker_sockets[thread_slot] = csd;
bucket_alloc = apr_bucket_alloc_create(ptrans);
- process_socket(ptrans, csd, process_slot, thread_slot, bucket_alloc);
+ process_socket(thd, ptrans, csd, process_slot, thread_slot, bucket_alloc);
worker_sockets[thread_slot] = NULL;
requests_this_child--;
apr_pool_clear(ptrans);