Commit 37ea1c57 authored by Stefan Eissing's avatar Stefan Eissing
Browse files

mod_http2: backport of 1.4.3

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1735457 13f79535-47bb-0310-9956-ffa450edef68
parent d4ba8b52
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -2,6 +2,9 @@

Changes with Apache 2.4.19

  *) mod_http2: slave connections are reused for several requests, improved
     performance and better memory use. [Stefan Eissing]
     
  *) mod_rewrite: Don't implicitly URL-escape the original query string
     when no substitution has changed it (like PR50447 but server context)
     [Evgeny Kotkov <evgeny.kotkov visualsvn.com>]
+7 −2
Original line number Diff line number Diff line
@@ -239,7 +239,6 @@ apr_status_t h2_conn_pre_close(struct h2_ctx *ctx, conn_rec *c)
    return status;
}


conn_rec *h2_slave_create(conn_rec *master, apr_pool_t *parent,
                          apr_allocator_t *allocator)
{
@@ -324,3 +323,9 @@ void h2_slave_destroy(conn_rec *slave, apr_allocator_t **pallocator)
    }
    apr_pool_destroy(slave->pool);
}

apr_status_t h2_slave_run_pre_connection(conn_rec *slave, apr_socket_t *csd)
{
    return ap_run_pre_connection(slave, csd);
}
+3 −0
Original line number Diff line number Diff line
@@ -70,4 +70,7 @@ conn_rec *h2_slave_create(conn_rec *master, apr_pool_t *parent,
                          apr_allocator_t *allocator);
void h2_slave_destroy(conn_rec *slave, apr_allocator_t **pallocator);

apr_status_t h2_slave_run_pre_connection(conn_rec *slave, apr_socket_t *csd);
void h2_slave_run_connection(conn_rec *slave);

#endif /* defined(__mod_h2__h2_conn__) */
+31 −27
Original line number Diff line number Diff line
@@ -218,6 +218,8 @@ h2_mplx *h2_mplx_create(conn_rec *c, apr_pool_t *parent,
        m->tx_handles_reserved = 0;
        m->tx_chunk_size = 4;
        
        m->spare_slaves = apr_array_make(m->pool, 10, sizeof(conn_rec*));
        
        m->ngn_shed = h2_ngn_shed_create(m->pool, m->c, m->max_streams, 
                                         m->stream_max_mem);
        h2_ngn_shed_set_ctx(m->ngn_shed , m);
@@ -278,8 +280,6 @@ static int io_out_consumed_signal(h2_mplx *m, h2_io *io)

static void io_destroy(h2_mplx *m, h2_io *io, int events)
{
    apr_pool_t *pool;
    
    /* cleanup any buffered input */
    h2_io_in_shutdown(io);
    if (events) {
@@ -299,23 +299,20 @@ static void io_destroy(h2_mplx *m, h2_io *io, int events)
    }

    if (io->task) {
        if (m->spare_allocator) {
            apr_allocator_destroy(m->spare_allocator);
            m->spare_allocator = NULL;
        }
        
        h2_slave_destroy(io->task->c, &m->spare_allocator);
        conn_rec *slave = io->task->c;
        h2_task_destroy(io->task);
        io->task = NULL;
    }
        
    pool = io->pool;
    io->pool = NULL;    
    if (0 && pool) {
        apr_pool_clear(pool);
        if (m->spare_pool) {
            apr_pool_destroy(m->spare_pool);
        if (m->spare_slaves->nelts < m->spare_slaves->nalloc) {
            APR_ARRAY_PUSH(m->spare_slaves, conn_rec*) = slave;
        }
        else {
            h2_slave_destroy(slave, NULL);
        }
        m->spare_pool = pool;
    }

    if (io->pool) {
        apr_pool_destroy(io->pool);
    }

    check_tx_free(m);
@@ -1006,17 +1003,11 @@ apr_status_t h2_mplx_reprioritize(h2_mplx *m, h2_stream_pri_cmp *cmp, void *ctx)

static h2_io *open_io(h2_mplx *m, int stream_id, const h2_request *request)
{
    apr_pool_t *io_pool = m->spare_pool;
    apr_pool_t *io_pool;
    h2_io *io;
    
    if (!io_pool) {
    apr_pool_create(&io_pool, m->pool);
    apr_pool_tag(io_pool, "h2_io");
    }
    else {
        m->spare_pool = NULL;
    }
    
    io = h2_io_create(stream_id, io_pool, m->bucket_alloc, request);
    h2_io_set_add(m->stream_ios, io);
    
@@ -1074,10 +1065,23 @@ static h2_task *pop_task(h2_mplx *m)
            }
        }
        else if (io) {
            conn_rec *slave = h2_slave_create(m->c, m->pool, m->spare_allocator);
            m->spare_allocator = NULL;
            conn_rec *slave, **pslave;
            int new_conn = 0;
            
            pslave = (conn_rec **)apr_array_pop(m->spare_slaves);
            if (pslave) {
                slave = *pslave;
            }
            else {
                slave = h2_slave_create(m->c, m->pool, NULL);
                new_conn = 1;
            }
            
            io->task = task = h2_task_create(m->id, io->request, slave, m);
            apr_table_setn(slave->notes, H2_TASK_ID_NOTE, task->id);
            if (new_conn) {
                h2_slave_run_pre_connection(slave, ap_get_conn_socket(slave));
            }
            io->worker_started = 1;
            io->started_at = apr_time_now();
            if (sid > m->max_stream_started) {
+1 −2
Original line number Diff line number Diff line
@@ -96,8 +96,7 @@ struct h2_mplx {
    apr_size_t stream_max_mem;
    apr_interval_time_t stream_timeout;
    
    apr_pool_t *spare_pool;           /* spare pool, ready for next io */
    apr_allocator_t *spare_allocator;
    apr_array_header_t *spare_slaves; /* spare slave connections */
    
    struct h2_workers *workers;
    apr_size_t tx_handles_reserved;
Loading