Commit 0d1a9bed authored by Stefan Eissing's avatar Stefan Eissing
Browse files

On the 2.4.x branch:

Merged /httpd/httpd/trunk:r1790850,1790855,1791377,1791388,1791669,1791773



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

Changes with Apache 2.4.26

  *) mod_http2: MaxKeepAliveRequests now limits the number of times a 
     slave connection gets reused. [Stefan Eissing]

  *) mod_http2: client streams that lack the EOF flag get now forcefully
     closed with a RST_STREAM (NO_ERROR) when the request has been answered.
     [Stefan Eissing]     

  *) mod_http2: only when 'HttpProtocolOptions Unsafe' is configured, will
     control characters in response headers or trailers be forwarded to the
     client. Otherwise, in the default configuration, a request will eiher 
     fail with status 500 or the stream will be reset by a RST_STREAM frame. 
     [Stefan Eissing]
     
  *) mod_brotli: Add a new module for dynamic Brotli (RFC 7932) compression.
     [Evgeny Kotkov]

+2 −0
Original line number Diff line number Diff line
@@ -154,5 +154,7 @@ typedef int h2_stream_pri_cmp(int stream_id1, int stream_id2, void *ctx);

#define H2_TASK_ID_NOTE         "http2-task-id"
#define H2_FILTER_DEBUG_NOTE    "http2-debug"
#define H2_HDR_CONFORMANCE      "http2-hdr-conformance"
#define H2_HDR_CONFORMANCE_UNSAFE      "unsafe"

#endif /* defined(__mod_h2__h2__) */
+16 −0
Original line number Diff line number Diff line
@@ -32,6 +32,12 @@
#include "h2_headers.h"


static int is_unsafe(server_rec *s) 
{
    core_server_config *conf = ap_get_core_module_config(s->module_config);
    return (conf->http_conformance == AP_HTTP_CONFORMANCE_UNSAFE);
}

typedef struct {
    apr_bucket_refcount refcount;
    h2_headers *headers;
@@ -132,9 +138,19 @@ h2_headers *h2_headers_rcreate(request_rec *r, int status,
            headers->status = H2_ERR_HTTP_1_1_REQUIRED;
        }
    }
    if (is_unsafe(r->server)) {
        apr_table_setn(headers->notes, H2_HDR_CONFORMANCE, 
                       H2_HDR_CONFORMANCE_UNSAFE);
    }
    return headers;
}

h2_headers *h2_headers_copy(apr_pool_t *pool, h2_headers *h)
{
    return h2_headers_create(h->status, apr_table_copy(pool, h->headers), 
                             apr_table_copy(pool, h->notes), pool);
}

h2_headers *h2_headers_die(apr_status_t type,
                             const h2_request *req, apr_pool_t *pool)
{
+6 −0
Original line number Diff line number Diff line
@@ -55,6 +55,12 @@ h2_headers *h2_headers_create(int status, apr_table_t *header,
h2_headers *h2_headers_rcreate(request_rec *r, int status, 
                                 apr_table_t *header, apr_pool_t *pool);

/**
 * Clone the headers into another pool. This will not copy any
 * header strings.
 */
h2_headers *h2_headers_copy(apr_pool_t *pool, h2_headers *h);

/**
 * Create the headers for the given error.
 * @param stream_id id of the stream to create the headers for
+27 −7
Original line number Diff line number Diff line
@@ -158,12 +158,17 @@ h2_mplx *h2_mplx_create(conn_rec *c, apr_pool_t *parent,
    apr_allocator_t *allocator;
    apr_thread_mutex_t *mutex;
    h2_mplx *m;
    h2_ctx *ctx = h2_ctx_get(c, 0);
    ap_assert(conf);
    
    m = apr_pcalloc(parent, sizeof(h2_mplx));
    if (m) {
        m->id = c->id;
        m->c = c;
        m->s = (ctx? h2_ctx_server_get(ctx) : NULL);
        if (!m->s) {
            m->s = c->base_server;
        }
        
        /* We create a pool with its own allocator to be used for
         * processing slave connections. This is the only way to have the
@@ -258,7 +263,17 @@ static int input_consumed_signal(h2_mplx *m, h2_stream *stream)

static int report_consumption_iter(void *ctx, void *val)
{
    input_consumed_signal(ctx, val);
    h2_stream *stream = val;
    h2_mplx *m = ctx;
    
    input_consumed_signal(m, stream);
    if (stream->state == H2_SS_CLOSED_L
        && (!stream->task || stream->task->worker_done)) {
        ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, m->c, 
                      H2_STRM_LOG(APLOGNO(10026), stream, "remote close missing")); 
        nghttp2_submit_rst_stream(stream->session->ngh2, NGHTTP2_FLAG_NONE, 
                                  stream->id, NGHTTP2_NO_ERROR);
    }
    return 1;
}

@@ -276,8 +291,11 @@ static void task_destroy(h2_mplx *m, h2_task *task)
    int reuse_slave = 0;
    
    slave = task->c;

    if (m->s->keep_alive_max == 0 || slave->keepalives < m->s->keep_alive_max) {
        reuse_slave = ((m->spare_slaves->nelts < (m->limit_active * 3 / 2))
                       && !task->rst_error);
    }
    
    if (slave) {
        if (reuse_slave && slave->keepalive == AP_CONN_KEEPALIVE) {
@@ -560,6 +578,9 @@ static apr_status_t out_close(h2_mplx *m, h2_task *task)
    if (!task) {
        return APR_ECONNABORTED;
    }
    if (task->c) {
        ++task->c->keepalives;
    }
    
    stream = h2_ihash_get(m->streams, task->stream_id);
    if (!stream) {
@@ -704,7 +725,6 @@ static h2_task *next_stream_task(h2_mplx *m)
            
            if (!stream->task) {

                m->c->keepalives++;
                if (sid > m->max_stream_started) {
                    m->max_stream_started = sid;
                }
Loading