[nginx-quic] fix qpack index issue when lookingup dynamic table

sun edward sunzhiyong3210 at gmail.com
Mon May 24 03:34:04 UTC 2021


description:
     when qpack header insert with name reference, if it is dynamic table,
the index should be the relative index, as described in drafts:
https://quicwg.org/base-drafts/draft-ietf-quic-qpack.html#name-insert-with-name-reference


# HG changeset patch
# User Zhiyong Sun <sunzhiyong3210 at gmail.com>
# Date 1621825861 14400
#      Sun May 23 23:11:01 2021 -0400
# Branch quic
# Node ID be8115b87d5abbd8d5e6afdccbcf2c0c2016113c
# Parent  557dc6a06ba6ea7e78444067c4b8fbb022f7b191
convert qpack absolute index to relative index when lookup dynamic table

diff -r 557dc6a06ba6 -r be8115b87d5a src/http/v3/ngx_http_v3_tables.c
--- a/src/http/v3/ngx_http_v3_tables.c  Tue May 18 18:17:25 2021 +0300
+++ b/src/http/v3/ngx_http_v3_tables.c  Sun May 23 23:11:01 2021 -0400
@@ -159,9 +159,19 @@
 ngx_http_v3_ref_insert(ngx_connection_t *c, ngx_uint_t dynamic,
     ngx_uint_t index, ngx_str_t *value)
 {
+    ngx_http_v3_connection_t     *h3c;
+    ngx_http_v3_dynamic_table_t  *dt;
     ngx_str_t  name;

     if (dynamic) {
+       h3c = c->quic->parent->data;
+        dt = &h3c->table;
+
+        if (dt->base + dt->nelts <= index) {
+            return NGX_HTTP_V3_ERR_ENCODER_STREAM_ERROR;
+        }
+
+        index = dt->base + dt->nelts - 1 - index;
         ngx_log_debug2(NGX_LOG_DEBUG_HTTP, c->log, 0,
                        "http3 ref insert dynamic[%ui] \"%V\"", index,
value);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx-devel/attachments/20210524/65d4e91c/attachment.htm>


More information about the nginx-devel mailing list