Commit 4a9caca1 authored by Stefan Eissing's avatar Stefan Eissing
Browse files

On the trunk:

mod_http2: adding support for MergeTrailers directive. 
 
mod_http2: limiting DATA frame sizes by TLS record sizes in use on the     
     connection. Flushing outgoing frames earlier. 



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1776735 13f79535-47bb-0310-9956-ffa450edef68
parent 97c5be35
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
                                                         -*- coding: utf-8 -*-
Changes with Apache 2.5.0

  *) mod_http2: adding support for MergeTrailers directive. [Stefan Eissing]
  
  *) mod_http2: limiting DATA frame sizes by TLS record sizes in use on the 
     connection. Flushing outgoing frames earlier. [Stefan Eissing]

  *) mod_remoteip: Add support for PROXY protocol (code donated by Cloudzilla).
     Add ability for PROXY protocol processing to be optional to donated code.
     See also: http://www.haproxy.org/download/1.5/doc/proxy-protocol.txt
+16 −0
Original line number Diff line number Diff line
@@ -64,6 +64,7 @@ static h2_config defconf = {
    0,                      /* copy files across threads */
    NULL,                   /* push list */
    0,                      /* early hints, http status 103 */
    2,                      /* TLS records flush count */
};

void h2_config_init(apr_pool_t *pool)
@@ -99,6 +100,7 @@ static void *h2_config_create(apr_pool_t *pool,
    conf->copy_files           = DEF_VAL;
    conf->push_list            = NULL;
    conf->early_hints          = DEF_VAL;
    conf->tls_flush_count      = DEF_VAL;
    return conf;
}

@@ -151,6 +153,7 @@ static void *h2_config_merge(apr_pool_t *pool, void *basev, void *addv)
        n->push_list        = add->push_list? add->push_list : base->push_list;
    }
    n->early_hints          = H2_CONFIG_GET(add, base, early_hints);
    n->tls_flush_count      = H2_CONFIG_GET(add, base, tls_flush_count);
    return n;
}

@@ -208,6 +211,8 @@ apr_int64_t h2_config_geti64(const h2_config *conf, h2_config_var_t var)
            return H2_CONFIG_GET(conf, &defconf, copy_files);
        case H2_CONF_EARLY_HINTS:
            return H2_CONFIG_GET(conf, &defconf, early_hints);
        case H2_CONF_TLS_FLUSH_COUNT:
            return H2_CONFIG_GET(conf, &defconf, tls_flush_count);
        default:
            return DEF_VAL;
    }
@@ -505,6 +510,15 @@ static const char *h2_conf_set_tls_cooldown_secs(cmd_parms *parms,
    return NULL;
}

static const char *h2_conf_set_tls_flush_count(cmd_parms *parms,
                                               void *arg, const char *value)
{
    h2_config *cfg = (h2_config *)h2_config_sget(parms->server);
    cfg->tls_flush_count = (int)apr_atoi64(value);
    (void)arg;
    return NULL;
}

static const char *h2_conf_set_push_diary_size(cmd_parms *parms,
                                               void *arg, const char *value)
{
@@ -643,6 +657,8 @@ const command_rec h2_cmds[] = {
                  RSRC_CONF, "number of bytes on TLS connection before doing max writes"),
    AP_INIT_TAKE1("H2TLSCoolDownSecs", h2_conf_set_tls_cooldown_secs, NULL,
                  RSRC_CONF, "seconds of idle time on TLS before shrinking writes"),
    AP_INIT_TAKE1("H2TLSFlushCount", h2_conf_set_tls_flush_count, NULL,
                  RSRC_CONF, "number of max TLS records before output is flushed"),
    AP_INIT_TAKE1("H2Push", h2_conf_set_push, NULL,
                  RSRC_CONF, "off to disable HTTP/2 server push"),
    AP_INIT_TAKE23("H2PushPriority", h2_conf_add_push_priority, NULL,
+2 −0
Original line number Diff line number Diff line
@@ -42,6 +42,7 @@ typedef enum {
    H2_CONF_PUSH_DIARY_SIZE,
    H2_CONF_COPY_FILES,
    H2_CONF_EARLY_HINTS,
    H2_CONF_TLS_FLUSH_COUNT,
} h2_config_var_t;

struct apr_hash_t;
@@ -79,6 +80,7 @@ typedef struct h2_config {
    int copy_files;               /* if files shall be copied vs setaside on output */
    apr_array_header_t *push_list;/* list of h2_push_res configurations */
    int early_hints;              /* support status code 103 */
    int tls_flush_count;          /* max # of TLS records until output flushed */
} h2_config;


+6 −0
Original line number Diff line number Diff line
@@ -208,7 +208,9 @@ apr_status_t h2_conn_run(struct h2_ctx *ctx, conn_rec *c)
    do {
        if (c->cs) {
            c->cs->sense = CONN_SENSE_DEFAULT;
            c->cs->state = CONN_STATE_HANDLER;
        }
    
        status = h2_session_process(h2_ctx_session_get(ctx), async_mpm);
        
        if (APR_STATUS_IS_EOF(status)) {
@@ -227,6 +229,10 @@ apr_status_t h2_conn_run(struct h2_ctx *ctx, conn_rec *c)
             && c->keepalive == AP_CONN_KEEPALIVE 
             && mpm_state != AP_MPMQ_STOPPING);
    
    if (c->cs) {
        c->cs->state = CONN_STATE_WRITE_COMPLETION;
    }
    
    return DONE;
}

+13 −3
Original line number Diff line number Diff line
@@ -133,6 +133,7 @@ apr_status_t h2_conn_io_init(h2_conn_io *io, conn_rec *c,
    io->is_tls        = h2_h2_is_tls(c);
    io->buffer_output = io->is_tls;
    io->pass_threshold = (apr_size_t)h2_config_geti64(cfg, H2_CONF_STREAM_MAX_MEM) / 2;
    io->flush_factor  = h2_config_geti(cfg, H2_CONF_TLS_FLUSH_COUNT);
    
    if (io->is_tls) {
        /* This is what we start with, 
@@ -420,12 +421,21 @@ apr_status_t h2_conn_io_pass(h2_conn_io *io, apr_bucket_brigade *bb)
    
    if (status == APR_SUCCESS) {
        if (!APR_BRIGADE_EMPTY(io->output)) {
            apr_off_t len = h2_brigade_mem_size(io->output);
            apr_off_t len;
            if (io->buffer_output) {
                apr_brigade_length(io->output, 0, &len);
                if (len >= (io->flush_factor * io->write_size)) {
                    return pass_output(io, 1, NULL);
                }
            }
            else {
                len = h2_brigade_mem_size(io->output);
                if (len >= io->pass_threshold) {
                    return pass_output(io, 0, NULL);
                }
            }
        }
    }
    return status;
}
Loading