@@ -53,9 +53,15 @@ const static struct {
5353 uint32_t raw_string_len;
5454 uint8_t *encoded_field;
5555 int encoded_field_len;
56- } string_test_case[] = {{(char *)" custom-key" , 10 , (uint8_t *) " \xA "
56+ } string_test_case[] = {{(char *)" " , 0 , (uint8_t *) " \x0 "
57+ " " ,
58+ 1 },
59+ {(char *)" custom-key" , 10 , (uint8_t *) " \xA "
5760 " custom-key" ,
5861 11 },
62+ {(char *)" " , 0 , (uint8_t *) " \x80 "
63+ " " ,
64+ 1 },
5965 {(char *)" custom-key" , 10 , (uint8_t *) " \x88 "
6066 " \x25\xa8\x49\xe9\x5b\xa9\x7d\x7f " ,
6167 9 }};
@@ -232,13 +238,13 @@ REGRESSION_TEST(HPACK_EncodeString)(RegressionTest *t, int, int *pstatus)
232238 int len;
233239
234240 // FIXME Current encoder support only huffman conding.
235- for (unsigned int i = 1 ; i < 2 ; i++) {
241+ for (unsigned int i = 2 ; i < sizeof (string_test_case) / sizeof (string_test_case[ 0 ]) ; i++) {
236242 memset (buf, 0 , BUFSIZE_FOR_REGRESSION_TEST);
237243
238244 len = encode_string (buf, buf + BUFSIZE_FOR_REGRESSION_TEST, string_test_case[i].raw_string , string_test_case[i].raw_string_len );
239245
240246 box.check (len == string_test_case[i].encoded_field_len , " encoded length was %d, expecting %d" , len,
241- integer_test_case [i].encoded_field_len );
247+ string_test_case [i].encoded_field_len );
242248 box.check (len > 0 && memcmp (buf, string_test_case[i].encoded_field , len) == 0 , " encoded string was invalid" );
243249 }
244250}
0 commit comments