[core] server.feature-flags to enable h2

server.feature-flags = ("server.h2proto" => "enable") to enable h2
This commit is contained in:
Glenn Strauss 2020-07-21 14:15:58 -04:00
parent 96324fbba0
commit 1041a56dd9
4 changed files with 10 additions and 2 deletions

View File

@ -90,6 +90,7 @@ typedef struct {
unsigned char http_host_normalize;
unsigned char http_method_get_body;
unsigned char high_precision_timestamps;
unsigned char h2proto;
unsigned short http_url_normalize;
unsigned short max_worker;

View File

@ -784,6 +784,10 @@ static int config_insert_srvconf(server *srv) {
break;
case 33:/* server.feature-flags */
srv->srvconf.feature_flags = cpv->v.a;
srv->srvconf.h2proto =
config_plugin_value_tobool(
array_get_element_klen(cpv->v.a,
CONST_STR_LEN("server.h2proto")), 0);
break;
default:/* should not happen */
break;
@ -1033,6 +1037,7 @@ static int config_insert(server *srv) {
| (srv->srvconf.http_method_get_body ? HTTP_PARSEOPT_METHOD_GET_BODY :0);
p->defaults.http_parseopts |= srv->srvconf.http_url_normalize;
p->defaults.mimetypes = &srv->srvconf.empty_array; /*(must not be NULL)*/
p->defaults.h2proto = srv->srvconf.h2proto;
/* initialize p->defaults from global config context */
if (p->nconfig > 0 && p->cvlist->v.u2[1]) {

View File

@ -41,6 +41,8 @@ typedef struct {
unsigned char range_requests;
unsigned char error_intercept;
unsigned char h2proto; /*(global setting copied for convenient access)*/
/* debug */
unsigned char log_file_not_found;
unsigned char log_request_header;

View File

@ -305,8 +305,8 @@ static handler_t http_response_config (request_st * const r) {
config_cond_cache_reset(r);
config_patch_config(r);
/* do we have to downgrade to 1.0 ? */
if (!r->conf.allow_http11)
/* do we have to downgrade from 1.1 to 1.0 ? (ignore for HTTP/2) */
if (!r->conf.allow_http11 && r->http_version == HTTP_VERSION_1_1)
r->http_version = HTTP_VERSION_1_0;
/* r->conf.max_request_size is in kBytes */