• R/O
  • HTTP
  • SSH
  • HTTPS

bchan: 提交

スレッドビューア


Commit MetaInfo

修訂ff74092d2d143df30593caa607e5a1e62500cde7 (tree)
時間2015-03-16 23:49:04
作者ornse01 <ornse01@user...>
Commiterornse01

Log Message

fix empty value cookie condition.

git-svn-id: http://svn.sourceforge.jp/svnroot/bchan/bchan/trunk@663 20a0b8eb-f62a-4a12-8fe1-b598822500fb

Change Summary

差異

--- a/src/cookiedb.c
+++ b/src/cookiedb.c
@@ -1,7 +1,7 @@
11 /*
22 * cookiedb.c
33 *
4- * Copyright (c) 2011 project bchan
4+ * Copyright (c) 2011-2015 project bchan
55 *
66 * This software is provided 'as-is', without any express or implied
77 * warranty. In no event will the authors be held liable for any damages
@@ -182,9 +182,6 @@ LOCAL Bool httpcookie_isvalueset(httpcookie_t *cookie)
182182 if (cookie->attr.len == 0) {
183183 return False;
184184 }
185- if (cookie->name.len == 0) {
186- return False;
187- }
188185 return True;
189186 }
190187
@@ -1248,9 +1245,6 @@ LOCAL Bool cookiedb_readfilecontext_cookiecheck(httpcookie_t *cookie)
12481245 if (cookie->attr.len == 0) {
12491246 return False;
12501247 }
1251- if (cookie->name.len == 0) {
1252- return False;
1253- }
12541248 if (cookie->persistent == False) {
12551249 return False;
12561250 }
--- a/src/test_cookiedb.c
+++ b/src/test_cookiedb.c
@@ -1,7 +1,7 @@
11 /*
22 * test_cookiedb.c
33 *
4- * Copyright (c) 2011-2012 project bchan
4+ * Copyright (c) 2011-2015 project bchan
55 *
66 * This software is provided 'as-is', without any express or implied
77 * warranty. In no event will the authors be held liable for any damages
@@ -2871,6 +2871,77 @@ LOCAL UNITTEST_RESULT test_cookiedb_52()
28712871 return test_cookiedb_testingseparateinput_file_clear(data, 2, 0x1eec16c0, NULL, 0, "2ch.net", "/", False, 0x1eec16c0, expected, 0);
28722872 }
28732873
2874+/* empty value test */
2875+
2876+LOCAL UNITTEST_RESULT test_cookiedb_53()
2877+{
2878+ testcookie_input_t data[] = {
2879+ {
2880+ "0ch.net", /* origin_host */
2881+ "/", /* origin_path */
2882+ "PON", /* name */
2883+ "", /* value */
2884+ NULL, /* domain */
2885+ NULL, /* path */
2886+ False, /* secure */
2887+ 0 /* expires */
2888+ },
2889+ {
2890+ "0ch.net", /* origin_host */
2891+ "/", /* origin_path */
2892+ "HAP", /* name */
2893+ NULL, /* value */
2894+ NULL, /* domain */
2895+ NULL, /* path */
2896+ False, /* secure */
2897+ 0 /* expires */
2898+ },
2899+ };
2900+ testcookie_expected_t expected[] = {
2901+ {
2902+ "PON", /* name */
2903+ "", /* value */
2904+ },
2905+ {
2906+ "HAP", /* name */
2907+ "", /* value */
2908+ }
2909+ };
2910+
2911+ return test_cookiedb_testingseparateinput(data, 2, 0x1eec16c0, "0ch.net", "/", False, 0x1eec16c0, expected, 2);
2912+}
2913+
2914+/* empty value test with cookiedb_readfile() */
2915+
2916+LOCAL UNITTEST_RESULT test_cookiedb_54()
2917+{
2918+ testcookie_input_t data[] = {
2919+ {
2920+ "0ch.net", /* origin_host */
2921+ "/", /* origin_path */
2922+ "AAA", /* name */
2923+ "BBB", /* value */
2924+ NULL, /* domain */
2925+ NULL, /* path */
2926+ False, /* secure */
2927+ 0 /* expires */
2928+ },
2929+ };
2930+ UB filedata[] = {"0ch.net<>/<>III<><>comment<><>1300000000<><><><>\n"};
2931+ testcookie_expected_t expected[] = {
2932+ {
2933+ "AAA", /* name */
2934+ "BBB", /* value */
2935+ },
2936+ {
2937+ "III", /* name */
2938+ "", /* value */
2939+ }
2940+ };
2941+
2942+ return test_cookiedb_testingseparateinput_file(data, 1, 0x0eec16c0, filedata, strlen(filedata), "0ch.net", "/", False, 0x0eec16c0, expected, 2);
2943+}
2944+
28742945 EXPORT VOID test_cookiedb_main(unittest_driver_t *driver)
28752946 {
28762947 UNITTEST_DRIVER_REGIST(driver, test_cookiedb_1);
@@ -2925,4 +2996,6 @@ EXPORT VOID test_cookiedb_main(unittest_driver_t *driver)
29252996 UNITTEST_DRIVER_REGIST(driver, test_cookiedb_50);
29262997 UNITTEST_DRIVER_REGIST(driver, test_cookiedb_51);
29272998 UNITTEST_DRIVER_REGIST(driver, test_cookiedb_52);
2999+ UNITTEST_DRIVER_REGIST(driver, test_cookiedb_53);
3000+ UNITTEST_DRIVER_REGIST(driver, test_cookiedb_54);
29283001 }
Show on old repository browser