]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: qpack: do not consider empty enc/dec stream as error
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Tue, 31 May 2022 13:21:27 +0000 (15:21 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Tue, 31 May 2022 13:35:06 +0000 (15:35 +0200)
When parsing QPACK encoder/decoder streams, h3_decode_qcs() displays an
error trace if they are empty. Change the return code used in QPACK code
to avoid this trace.

To uniformize with MUX/H3 code, 0 is now used to indicate success.

Beyond this spurious error trace, this bug has no impact.

src/h3.c
src/qpack-dec.c

index 831dc19de64735cb9b2b93f7d95994aca0ac7646..1b8e3783103ae02c5d109028617e86d24b24b1e2 100644 (file)
--- a/src/h3.c
+++ b/src/h3.c
@@ -238,11 +238,11 @@ static int h3_parse_uni_stream_no_h3(struct qcs *qcs, struct ncbuf *rxbuf)
 
        switch (h3s->type) {
        case H3S_T_QPACK_DEC:
-               if (!qpack_decode_dec(qcs, NULL))
+               if (qpack_decode_dec(qcs, NULL))
                        return 1;
                break;
        case H3S_T_QPACK_ENC:
-               if (!qpack_decode_enc(qcs, NULL))
+               if (qpack_decode_enc(qcs, NULL))
                        return 1;
                break;
        case H3S_T_UNKNOWN:
index c5e42a0f5da4591f4a076fd2a35cd77489607022..3ca2eda650ea057d25b5528d23d0c8696be500b0 100644 (file)
@@ -93,7 +93,10 @@ static uint64_t qpack_get_varint(const unsigned char **buf, uint64_t *len_in, in
        return 0;
 }
 
-/* Decode an encoder stream */
+/* Decode an encoder stream.
+ *
+ * Returns 0 on success else non-zero.
+ */
 int qpack_decode_enc(struct qcs *qcs, void *ctx)
 {
        size_t len;
@@ -123,10 +126,13 @@ int qpack_decode_enc(struct qcs *qcs, void *ctx)
                /* Set dynamic table capacity */
        }
 
-       return 1;
+       return 0;
 }
 
-/* Decode an decoder stream */
+/* Decode an decoder stream.
+ *
+ * Returns 0 on success else non-zero.
+ */
 int qpack_decode_dec(struct qcs *qcs, void *ctx)
 {
        size_t len;
@@ -153,7 +159,7 @@ int qpack_decode_dec(struct qcs *qcs, void *ctx)
                /* Stream cancellation */
        }
 
-       return 1;
+       return 0;
 }
 
 /* Decode a field section prefix made of <enc_ric> and <db> two varints.