Commit 75bca236 authored by Stefan Eissing's avatar Stefan Eissing
Browse files

*) mod_http2: new configuration directive: ```H2Padding numbits``` to control

     padding of HTTP/2 payload frames. 'numbits' is a number from 0-8,
     controlling the range of padding bytes added to a frame. The actual number
     added is chosen randomly per frame. This applies to HEADERS, DATA and PUSH_PROMISE
     frames equally. The default continues to be 0, e.g. no padding. [Stefan Eissing] 
  
  *) mod_http2: ripping out all the h2_req_engine internal features now that mod_proxy_http2
     has no more need for it. Optional functions are still declared but no longer implemented.
     While previous mod_proxy_http2 will work with this, it is recommeneded to run the matching
     versions of both modules. [Stefan Eissing]
  
  *) mod_proxy_http2: changed mod_proxy_http2 implementation and fixed several bugs which
     resolve PR63170. The proxy module does now a single h2 request on the (reused)
     connection and returns. [Stefan Eissing]



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

  *) mod_http2: new configuration directive: ```H2Padding numbits``` to control 
     padding of HTTP/2 payload frames. 'numbits' is a number from 0-8,
     controlling the range of padding bytes added to a frame. The actual number
     added is chosen randomly per frame. This applies to HEADERS, DATA and PUSH_PROMISE
     frames equally. The default continues to be 0, e.g. no padding. [Stefan Eissing] 
  
  *) mod_http2: ripping out all the h2_req_engine internal features now that mod_proxy_http2
     has no more need for it. Optional functions are still declared but no longer implemented.
     While previous mod_proxy_http2 will work with this, it is recommeneded to run the matching
     versions of both modules. [Stefan Eissing]
  
  *) mod_proxy_http2: changed mod_proxy_http2 implementation and fixed several bugs which
     resolve PR63170. The proxy module does now a single h2 request on the (reused)
     connection and returns. [Stefan Eissing]
  
  *) mod_http2/mod_proxy_http2: proxy_http2 checks correct master connection aborted status 
     to trigger immediate shutdown of backend connections. This is now always signalled
     by mod_http2 when the the session is being released. 
+0 −1
Original line number Diff line number Diff line
@@ -31,7 +31,6 @@ h2_from_h1.lo dnl
h2_h2.lo dnl
h2_headers.lo dnl
h2_mplx.lo dnl
h2_ngn_shed.lo dnl
h2_push.lo dnl
h2_request.lo dnl
h2_session.lo dnl
+3 −3
Original line number Diff line number Diff line
@@ -48,12 +48,12 @@ extern const char *H2_MAGIC_TOKEN;
#define H2_HEADER_PATH_LEN   5
#define H2_CRLF             "\r\n"

/* Max data size to write so it fits inside a TLS record */
#define H2_DATA_CHUNK_SIZE          ((16*1024) - 100 - 9) 

/* Size of the frame header itself in HTTP/2 */
#define H2_FRAME_HDR_LEN            9
 
/* Max data size to write so it fits inside a TLS record */
#define H2_DATA_CHUNK_SIZE          ((16*1024) - 100 - H2_FRAME_HDR_LEN) 

/* Maximum number of padding bytes in a frame, rfc7540 */
#define H2_MAX_PADLEN               256
/* Initial default window size, RFC 7540 ch. 6.5.2 */
+36 −0
Original line number Diff line number Diff line
@@ -76,6 +76,8 @@ 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 padding_bits;
    int padding_always;
} h2_config;

typedef struct h2_dir_config {
@@ -111,6 +113,8 @@ static h2_config defconf = {
    0,                      /* copy files across threads */
    NULL,                   /* push list */
    0,                      /* early hints, http status 103 */
    0,                      /* padding bits */
    1,                      /* padding always */
};

static h2_dir_config defdconf = {
@@ -153,6 +157,8 @@ void *h2_config_create_svr(apr_pool_t *pool, server_rec *s)
    conf->copy_files           = DEF_VAL;
    conf->push_list            = NULL;
    conf->early_hints          = DEF_VAL;
    conf->padding_bits         = DEF_VAL;
    conf->padding_always       = DEF_VAL;
    return conf;
}

@@ -194,6 +200,8 @@ 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->padding_bits         = H2_CONFIG_GET(add, base, padding_bits);
    n->padding_always       = H2_CONFIG_GET(add, base, padding_always);
    return n;
}

@@ -275,6 +283,10 @@ static apr_int64_t h2_srv_config_geti64(const h2_config *conf, h2_config_var_t v
            return H2_CONFIG_GET(conf, &defconf, copy_files);
        case H2_CONF_EARLY_HINTS:
            return H2_CONFIG_GET(conf, &defconf, early_hints);
        case H2_CONF_PADDING_BITS:
            return H2_CONFIG_GET(conf, &defconf, padding_bits);
        case H2_CONF_PADDING_ALWAYS:
            return H2_CONFIG_GET(conf, &defconf, padding_always);
        default:
            return DEF_VAL;
    }
@@ -334,6 +346,12 @@ static void h2_srv_config_seti(h2_config *conf, h2_config_var_t var, int val)
        case H2_CONF_EARLY_HINTS:
            H2_CONFIG_SET(conf, early_hints, val);
            break;
        case H2_CONF_PADDING_BITS:
            H2_CONFIG_SET(conf, padding_bits, val);
            break;
        case H2_CONF_PADDING_ALWAYS:
            H2_CONFIG_SET(conf, padding_always, val);
            break;
        default:
            break;
    }
@@ -873,6 +891,22 @@ static const char *h2_conf_set_early_hints(cmd_parms *cmd,
    return NULL;
}

static const char *h2_conf_set_padding(cmd_parms *cmd, void *dirconf, const char *value)
{
    int val;
    
    val = (int)apr_atoi64(value);
    if (val < 0) {
        return "number of bits must be >= 0";
    }
    if (val > 8) {
        return "number of bits must be <= 8";
    }
    CONFIG_CMD_SET(cmd, dirconf, H2_CONF_PADDING_BITS, val);
    return NULL;
}


void h2_get_num_workers(server_rec *s, int *minw, int *maxw)
{
    int threads_per_child = 0;
@@ -941,6 +975,8 @@ const command_rec h2_cmds[] = {
                   OR_FILEINFO|OR_AUTHCFG, "add a resource to be pushed in this location/on this server."),
    AP_INIT_TAKE1("H2EarlyHints", h2_conf_set_early_hints, NULL,
                  RSRC_CONF, "on to enable interim status 103 responses"),
    AP_INIT_TAKE1("H2Padding", h2_conf_set_padding, NULL,
                  RSRC_CONF, "set payload padding"),
    AP_END_CMD
};

+2 −0
Original line number Diff line number Diff line
@@ -42,6 +42,8 @@ typedef enum {
    H2_CONF_PUSH_DIARY_SIZE,
    H2_CONF_COPY_FILES,
    H2_CONF_EARLY_HINTS,
    H2_CONF_PADDING_BITS,
    H2_CONF_PADDING_ALWAYS,
} h2_config_var_t;

struct apr_hash_t;
Loading