HTTP/3: bytes holding directives changed to ngx_conf_set_size_slot.

This allows to specify directive values with measurement units.
This commit is contained in:
Sergey Kandaurov 2020-04-22 15:48:39 +03:00
parent db90ddcb9e
commit 89bba9bf7d
2 changed files with 20 additions and 20 deletions

View File

@ -36,11 +36,11 @@ typedef struct {
ngx_msec_t max_idle_timeout; ngx_msec_t max_idle_timeout;
ngx_msec_t max_ack_delay; ngx_msec_t max_ack_delay;
ngx_uint_t max_packet_size; size_t max_packet_size;
ngx_uint_t initial_max_data; size_t initial_max_data;
ngx_uint_t initial_max_stream_data_bidi_local; size_t initial_max_stream_data_bidi_local;
ngx_uint_t initial_max_stream_data_bidi_remote; size_t initial_max_stream_data_bidi_remote;
ngx_uint_t initial_max_stream_data_uni; size_t initial_max_stream_data_uni;
ngx_uint_t initial_max_streams_bidi; ngx_uint_t initial_max_streams_bidi;
ngx_uint_t initial_max_streams_uni; ngx_uint_t initial_max_streams_uni;
ngx_uint_t ack_delay_exponent; ngx_uint_t ack_delay_exponent;

View File

@ -28,35 +28,35 @@ static ngx_command_t ngx_http_v3_commands[] = {
{ ngx_string("quic_max_packet_size"), { ngx_string("quic_max_packet_size"),
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_CONF_TAKE1, NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_CONF_TAKE1,
ngx_conf_set_num_slot, ngx_conf_set_size_slot,
NGX_HTTP_SRV_CONF_OFFSET, NGX_HTTP_SRV_CONF_OFFSET,
offsetof(ngx_http_v3_srv_conf_t, quic.max_packet_size), offsetof(ngx_http_v3_srv_conf_t, quic.max_packet_size),
NULL }, NULL },
{ ngx_string("quic_initial_max_data"), { ngx_string("quic_initial_max_data"),
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_CONF_TAKE1, NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_CONF_TAKE1,
ngx_conf_set_num_slot, ngx_conf_set_size_slot,
NGX_HTTP_SRV_CONF_OFFSET, NGX_HTTP_SRV_CONF_OFFSET,
offsetof(ngx_http_v3_srv_conf_t, quic.initial_max_data), offsetof(ngx_http_v3_srv_conf_t, quic.initial_max_data),
NULL }, NULL },
{ ngx_string("quic_initial_max_stream_data_bidi_local"), { ngx_string("quic_initial_max_stream_data_bidi_local"),
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_CONF_TAKE1, NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_CONF_TAKE1,
ngx_conf_set_num_slot, ngx_conf_set_size_slot,
NGX_HTTP_SRV_CONF_OFFSET, NGX_HTTP_SRV_CONF_OFFSET,
offsetof(ngx_http_v3_srv_conf_t, quic.initial_max_stream_data_bidi_local), offsetof(ngx_http_v3_srv_conf_t, quic.initial_max_stream_data_bidi_local),
NULL }, NULL },
{ ngx_string("quic_initial_max_stream_data_bidi_remote"), { ngx_string("quic_initial_max_stream_data_bidi_remote"),
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_CONF_TAKE1, NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_CONF_TAKE1,
ngx_conf_set_num_slot, ngx_conf_set_size_slot,
NGX_HTTP_SRV_CONF_OFFSET, NGX_HTTP_SRV_CONF_OFFSET,
offsetof(ngx_http_v3_srv_conf_t, quic.initial_max_stream_data_bidi_remote), offsetof(ngx_http_v3_srv_conf_t, quic.initial_max_stream_data_bidi_remote),
NULL }, NULL },
{ ngx_string("quic_initial_max_stream_data_uni"), { ngx_string("quic_initial_max_stream_data_uni"),
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_CONF_TAKE1, NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_CONF_TAKE1,
ngx_conf_set_num_slot, ngx_conf_set_size_slot,
NGX_HTTP_SRV_CONF_OFFSET, NGX_HTTP_SRV_CONF_OFFSET,
offsetof(ngx_http_v3_srv_conf_t, quic.initial_max_stream_data_uni), offsetof(ngx_http_v3_srv_conf_t, quic.initial_max_stream_data_uni),
NULL }, NULL },
@ -231,11 +231,11 @@ ngx_http_v3_create_srv_conf(ngx_conf_t *cf)
v3cf->quic.max_idle_timeout = NGX_CONF_UNSET_MSEC; v3cf->quic.max_idle_timeout = NGX_CONF_UNSET_MSEC;
v3cf->quic.max_ack_delay = NGX_CONF_UNSET_MSEC; v3cf->quic.max_ack_delay = NGX_CONF_UNSET_MSEC;
v3cf->quic.max_packet_size = NGX_CONF_UNSET_UINT; v3cf->quic.max_packet_size = NGX_CONF_UNSET_SIZE;
v3cf->quic.initial_max_data = NGX_CONF_UNSET_UINT; v3cf->quic.initial_max_data = NGX_CONF_UNSET_SIZE;
v3cf->quic.initial_max_stream_data_bidi_local = NGX_CONF_UNSET_UINT; v3cf->quic.initial_max_stream_data_bidi_local = NGX_CONF_UNSET_SIZE;
v3cf->quic.initial_max_stream_data_bidi_remote = NGX_CONF_UNSET_UINT; v3cf->quic.initial_max_stream_data_bidi_remote = NGX_CONF_UNSET_SIZE;
v3cf->quic.initial_max_stream_data_uni = NGX_CONF_UNSET_UINT; v3cf->quic.initial_max_stream_data_uni = NGX_CONF_UNSET_SIZE;
v3cf->quic.initial_max_streams_bidi = NGX_CONF_UNSET_UINT; v3cf->quic.initial_max_streams_bidi = NGX_CONF_UNSET_UINT;
v3cf->quic.initial_max_streams_uni = NGX_CONF_UNSET_UINT; v3cf->quic.initial_max_streams_uni = NGX_CONF_UNSET_UINT;
v3cf->quic.ack_delay_exponent = NGX_CONF_UNSET_UINT; v3cf->quic.ack_delay_exponent = NGX_CONF_UNSET_UINT;
@ -266,7 +266,7 @@ ngx_http_v3_merge_srv_conf(ngx_conf_t *cf, void *parent, void *child)
return NGX_CONF_ERROR; return NGX_CONF_ERROR;
} }
ngx_conf_merge_uint_value(conf->quic.max_packet_size, ngx_conf_merge_size_value(conf->quic.max_packet_size,
prev->quic.max_packet_size, prev->quic.max_packet_size,
NGX_QUIC_DEFAULT_MAX_PACKET_SIZE); NGX_QUIC_DEFAULT_MAX_PACKET_SIZE);
@ -279,19 +279,19 @@ ngx_http_v3_merge_srv_conf(ngx_conf_t *cf, void *parent, void *child)
return NGX_CONF_ERROR; return NGX_CONF_ERROR;
} }
ngx_conf_merge_uint_value(conf->quic.initial_max_data, ngx_conf_merge_size_value(conf->quic.initial_max_data,
prev->quic.initial_max_data, prev->quic.initial_max_data,
16 * NGX_QUIC_STREAM_BUFSIZE); 16 * NGX_QUIC_STREAM_BUFSIZE);
ngx_conf_merge_uint_value(conf->quic.initial_max_stream_data_bidi_local, ngx_conf_merge_size_value(conf->quic.initial_max_stream_data_bidi_local,
prev->quic.initial_max_stream_data_bidi_local, prev->quic.initial_max_stream_data_bidi_local,
NGX_QUIC_STREAM_BUFSIZE); NGX_QUIC_STREAM_BUFSIZE);
ngx_conf_merge_uint_value(conf->quic.initial_max_stream_data_bidi_remote, ngx_conf_merge_size_value(conf->quic.initial_max_stream_data_bidi_remote,
prev->quic.initial_max_stream_data_bidi_remote, prev->quic.initial_max_stream_data_bidi_remote,
NGX_QUIC_STREAM_BUFSIZE); NGX_QUIC_STREAM_BUFSIZE);
ngx_conf_merge_uint_value(conf->quic.initial_max_stream_data_uni, ngx_conf_merge_size_value(conf->quic.initial_max_stream_data_uni,
prev->quic.initial_max_stream_data_uni, prev->quic.initial_max_stream_data_uni,
NGX_QUIC_STREAM_BUFSIZE); NGX_QUIC_STREAM_BUFSIZE);