Commit 6e18cad6 authored by Stefan Eissing's avatar Stefan Eissing
Browse files

Merge of 1735608,1735609 from trunk:

mod_http2: stream cleanup on GOAWAY handling, PUSHes prohibited after client GOAWAY.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1735610 13f79535-47bb-0310-9956-ffa450edef68
parent 743d047c
Loading
Loading
Loading
Loading
+2 −5
Original line number Diff line number Diff line
                                                         -*- coding: utf-8 -*-

Changes with Apache 2.4.19

  *) mod_http2: slave connections are reused for several requests, improved
     performance and better memory use. [Stefan Eissing]
  *) mod_http2: disabling PUSH when client sends GOAWAY.
  
  *) mod_rewrite: Don't implicitly URL-escape the original query string
     when no substitution has changed it (like PR50447 but server context)
+10 −0
Original line number Diff line number Diff line
@@ -99,6 +99,16 @@ typedef enum {
    H2_SESSION_ST_REMOTE_SHUTDOWN,  /* client announced GOAWAY */
} h2_session_state;

typedef struct h2_session_props {
    apr_uint32_t accepted_max;      /* the highest remote stream id was/will be handled */
    apr_uint32_t completed_max;     /* the highest remote stream completed */
    apr_uint32_t emitted_count;     /* the number of local streams sent */
    apr_uint32_t emitted_max;       /* the highest local stream id sent */
    apr_uint32_t error;             /* the last session error encountered */
    unsigned int accepting : 1;     /* if the session is accepting new streams */
} h2_session_props;


/* h2_request is the transformer of HTTP2 streams into HTTP/1.1 internal
 * format that will be fed to various httpd input filters to finally
 * become a request_rec to be handled by soemone.
+1 −1
Original line number Diff line number Diff line
@@ -265,7 +265,7 @@ static apr_status_t h2_conn_io_flush_int(h2_conn_io *io, int flush, int eoc)
    pass_out_ctx ctx;
    apr_bucket *b;
    
    if (io->buflen == 0 && APR_BRIGADE_EMPTY(io->output)) {
    if (!flush && io->buflen == 0 && APR_BRIGADE_EMPTY(io->output)) {
        return APR_SUCCESS;
    }
        
+1 −1
Original line number Diff line number Diff line
@@ -218,7 +218,7 @@ static apr_status_t h2_sos_h2_status_buffer(h2_sos *sos, apr_bucket_brigade *bb)
    bbout("  \"this_stream\": %d,\n", stream->id);
    bbout("  \"streams_open\": %d,\n", (int)h2_ihash_count(session->streams));
    bbout("  \"max_stream_started\": %d,\n", mplx->max_stream_started);
    bbout("  \"requests_received\": %d,\n", session->requests_received);
    bbout("  \"requests_received\": %d,\n", session->remote.emitted_count);
    bbout("  \"responses_submitted\": %d,\n", session->responses_submitted);
    bbout("  \"streams_reset\": %d, \n", session->streams_reset);
    bbout("  \"pushes_promised\": %d,\n", session->pushes_promised);
+14 −13
Original line number Diff line number Diff line
@@ -227,23 +227,22 @@ h2_mplx *h2_mplx_create(conn_rec *c, apr_pool_t *parent,
    return m;
}

int h2_mplx_get_max_stream_started(h2_mplx *m)
apr_uint32_t h2_mplx_shutdown(h2_mplx *m)
{
    int stream_id = 0;
    int acquired;
    int acquired, max_stream_started = 0;
    
    enter_mutex(m, &acquired);
    stream_id = m->max_stream_started;
    if (enter_mutex(m, &acquired) == APR_SUCCESS) {
        max_stream_started = m->max_stream_started;
        /* Clear schedule queue, disabling existing streams from starting */ 
        h2_iq_clear(m->q);
        leave_mutex(m, acquired);
    
    return stream_id;
    }
    return max_stream_started;
}

static void workers_register(h2_mplx *m)
{
    /* Initially, there was ref count increase for this as well, but
     * this is not needed, even harmful.
     * h2_workers is only a hub for all the h2_worker instances.
    /* h2_workers is only a hub for all the h2_worker instances.
     * At the end-of-life of this h2_mplx, we always unregister at
     * the workers. The thing to manage are all the h2_worker instances
     * out there. Those may hold a reference to this h2_mplx and we cannot
@@ -311,6 +310,10 @@ static void io_destroy(h2_mplx *m, h2_io *io, int events)
        }
    }

    if (io->eor) {
        apr_bucket_delete(io->eor);
        io->eor = NULL;
    }
    if (io->pool) {
        apr_pool_destroy(io->pool);
    }
@@ -473,7 +476,6 @@ apr_status_t h2_mplx_stream_done(h2_mplx *m, int stream_id, int rst_error)
                          m->id, stream_id);
            io_stream_done(m, io, rst_error);
        }

        leave_mutex(m, acquired);
    }
    return status;
@@ -992,7 +994,6 @@ apr_status_t h2_mplx_reprioritize(h2_mplx *m, h2_stream_pri_cmp *cmp, void *ctx)
        }
        else {
            h2_iq_sort(m->q, cmp, ctx);
            
            ap_log_cerror(APLOG_MARK, APLOG_TRACE1, 0, m->c,
                          "h2_mplx(%ld): reprioritize tasks", m->id);
        }
Loading