src: Make sure that empty param is error when parsing Link header field

This commit is contained in:
Tatsuhiro Tsujikawa 2015-05-24 15:40:16 +09:00
parent 791660ef8d
commit 90eac0709d
1 changed files with 8 additions and 2 deletions

View File

@ -380,6 +380,12 @@ void test_http2_parse_link_header(void) {
auto res = http2::parse_link_header(s, sizeof(s) - 1); auto res = http2::parse_link_header(s, sizeof(s) - 1);
CU_ASSERT(0 == res.size()); CU_ASSERT(0 == res.size());
} }
{
// Error if link header ends with ';'
const char s[] = "<url>;rel=preload;, <url>";
auto res = http2::parse_link_header(s, sizeof(s) - 1);
CU_ASSERT(0 == res.size());
}
{ {
// OK if input ends with ',' // OK if input ends with ','
const char s[] = "<url>;rel=preload,"; const char s[] = "<url>;rel=preload,";
@ -396,13 +402,13 @@ void test_http2_parse_link_header(void) {
} }
{ {
// Error if url is not enclosed by <> // Error if url is not enclosed by <>
const char s[] = "url>;rel=preload;"; const char s[] = "url>;rel=preload";
auto res = http2::parse_link_header(s, sizeof(s) - 1); auto res = http2::parse_link_header(s, sizeof(s) - 1);
CU_ASSERT(0 == res.size()); CU_ASSERT(0 == res.size());
} }
{ {
// Error if url is not enclosed by <> // Error if url is not enclosed by <>
const char s[] = "<url;rel=preload;"; const char s[] = "<url;rel=preload";
auto res = http2::parse_link_header(s, sizeof(s) - 1); auto res = http2::parse_link_header(s, sizeof(s) - 1);
CU_ASSERT(0 == res.size()); CU_ASSERT(0 == res.size());
} }