comparison src/http/v3/ngx_http_v3_tables.c @ 8785:e6c26cb4d38b quic

HTTP/3: fixed Insert With Name Reference index processing. Based on a patch by Zhiyong Sun.
author Sergey Kandaurov <pluknet@nginx.com>
date Thu, 27 May 2021 13:29:00 +0300
parents 6e2c23481abb
children 0ac25efb2da3
comparison
equal deleted inserted replaced
8784:7d32c3c93678 8785:e6c26cb4d38b
157 157
158 ngx_int_t 158 ngx_int_t
159 ngx_http_v3_ref_insert(ngx_connection_t *c, ngx_uint_t dynamic, 159 ngx_http_v3_ref_insert(ngx_connection_t *c, ngx_uint_t dynamic,
160 ngx_uint_t index, ngx_str_t *value) 160 ngx_uint_t index, ngx_str_t *value)
161 { 161 {
162 ngx_str_t name; 162 ngx_str_t name;
163 ngx_http_v3_session_t *h3c;
164 ngx_http_v3_dynamic_table_t *dt;
163 165
164 if (dynamic) { 166 if (dynamic) {
165 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, c->log, 0, 167 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, c->log, 0,
166 "http3 ref insert dynamic[%ui] \"%V\"", index, value); 168 "http3 ref insert dynamic[%ui] \"%V\"", index, value);
169
170 h3c = ngx_http_v3_get_session(c);
171 dt = &h3c->table;
172
173 if (dt->base + dt->nelts <= index) {
174 return NGX_HTTP_V3_ERR_ENCODER_STREAM_ERROR;
175 }
176
177 index = dt->base + dt->nelts - 1 - index;
167 178
168 if (ngx_http_v3_lookup(c, index, &name, NULL) != NGX_OK) { 179 if (ngx_http_v3_lookup(c, index, &name, NULL) != NGX_OK) {
169 return NGX_HTTP_V3_ERR_ENCODER_STREAM_ERROR; 180 return NGX_HTTP_V3_ERR_ENCODER_STREAM_ERROR;
170 } 181 }
171 182