1
0
mirror of https://github.com/stefanocasazza/ULib.git synced 2025-09-28 19:05:55 +08:00
ULib/tests/ulib/http2/rfc7541_2_3_3
stefanocasazza 329b3fbd64 sync
2016-12-22 15:54:12 +01:00

67 lines
2.0 KiB
Bash
Executable File

#!/bin/sh
#
# Written by Dridi Boukelmoune <dridi.boukelmoune@gmail.com>
#
# This file is in the public domain.
#
# 2.3.3. Index Address Space
#
# The static table and the dynamic table are combined into a single
# index address space.
#
# Indices between 1 and the length of the static table (inclusive)
# refer to elements in the static table (see Section 2.3.1).
#
# Indices strictly greater than the length of the static table refer to
# elements in the dynamic table (see Section 2.3.2). The length of the
# static table is subtracted to find the index into the dynamic table.
#
# Indices strictly greater than the sum of the lengths of both tables
# MUST be treated as a decoding error.
#
# For a static table size of s and a dynamic table size of k, the
# following diagram shows the entire valid index address space.
#
# <---------- Index Address Space ---------->
# <-- Static Table --> <-- Dynamic Table -->
# +---+-----------+---+ +---+-----------+---+
# | 1 | ... | s | |s+1| ... |s+k|
# +---+-----------+---+ +---+-----------+---+
# ^ |
# | V
# Insertion Point Dropping Point
#
# Figure 1: Index Address Space
. "$(dirname "$0")"/common.sh
_ -------------------------------------
_ Indices strictly greater than the sum
_ -------------------------------------
mk_bin <<EOF
11000010 | Indexed field 66
EOF
mk_enc <<EOF
indexed 66
EOF
tst_decode --expect-error IDX
tst_encode --expect-error IDX
_ ----------------------------------------------------
_ Indices strictly greater than the sum - indexed name
_ ----------------------------------------------------
mk_bin <<EOF
01111110 | Dynamic field with indexed name 62
EOF
mk_enc <<EOF
dynamic idx 62 str unused-value
EOF
tst_decode --expect-error IDX
tst_encode --expect-error IDX