summaryrefslogtreecommitdiff
path: root/icespider/unittests
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2022-03-12 03:29:09 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2022-03-12 03:29:09 +0000
commit3d2d86a9441415306f204f1456516f848463e552 (patch)
tree2bca64dbe3624a22f89e7713422001f220fea37a /icespider/unittests
parentRemove dependency of AdHocUtil internals (diff)
downloadicespider-3d2d86a9441415306f204f1456516f848463e552.tar.bz2
icespider-3d2d86a9441415306f204f1456516f848463e552.tar.xz
icespider-3d2d86a9441415306f204f1456516f848463e552.zip
Fix handling of accept parametersicespider-0.7.1
Accept can have parameters other than q, although we just ignore them
Diffstat (limited to 'icespider/unittests')
-rw-r--r--icespider/unittests/testAccept.cpp30
1 files changed, 29 insertions, 1 deletions
diff --git a/icespider/unittests/testAccept.cpp b/icespider/unittests/testAccept.cpp
index cacb01e..67b1411 100644
--- a/icespider/unittests/testAccept.cpp
+++ b/icespider/unittests/testAccept.cpp
@@ -37,7 +37,6 @@ BOOST_DATA_TEST_CASE(bad_requests,
" text / plain ; q = ",
" text / plain ; q = 0.0 ",
" text / plain ; q = 1.1 ",
- " text / plain ; f = 0.1 ",
}),
a)
{
@@ -120,3 +119,32 @@ BOOST_DATA_TEST_CASE(q1,
}
}
}
+
+BOOST_DATA_TEST_CASE(extra_params_q_half,
+ make({
+ "a/a;q=0.5",
+ "a/a;v=1;q=0.5",
+ "a/a;q=0.5;v=1",
+ "a/a;p=1;q=0.5;v=1",
+ "a/a;v=string;q=0.5",
+ }),
+ a)
+{
+ auto all = parse(a);
+ for (const auto & accept : all) {
+ BOOST_TEST_CONTEXT(accept) {
+ BOOST_CHECK_CLOSE(accept.q, 0.5, 0.1);
+ }
+ }
+}
+
+BOOST_DATA_TEST_CASE(samples,
+ make({
+ // From Chromium, causes HTTP 400 in v0.7, unexpected param `v`
+ "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/"
+ "*;q=0.8,application/signed-exchange;v=b3;q=0.9",
+ }),
+ a)
+{
+ BOOST_CHECK_NO_THROW(parse(a));
+}