修訂 | ff74092d2d143df30593caa607e5a1e62500cde7 (tree) |
---|---|
時間 | 2015-03-16 23:49:04 |
作者 | ornse01 <ornse01@user...> |
Commiter | ornse01 |
fix empty value cookie condition.
git-svn-id: http://svn.sourceforge.jp/svnroot/bchan/bchan/trunk@663 20a0b8eb-f62a-4a12-8fe1-b598822500fb
@@ -1,7 +1,7 @@ | ||
1 | 1 | /* |
2 | 2 | * cookiedb.c |
3 | 3 | * |
4 | - * Copyright (c) 2011 project bchan | |
4 | + * Copyright (c) 2011-2015 project bchan | |
5 | 5 | * |
6 | 6 | * This software is provided 'as-is', without any express or implied |
7 | 7 | * warranty. In no event will the authors be held liable for any damages |
@@ -182,9 +182,6 @@ LOCAL Bool httpcookie_isvalueset(httpcookie_t *cookie) | ||
182 | 182 | if (cookie->attr.len == 0) { |
183 | 183 | return False; |
184 | 184 | } |
185 | - if (cookie->name.len == 0) { | |
186 | - return False; | |
187 | - } | |
188 | 185 | return True; |
189 | 186 | } |
190 | 187 |
@@ -1248,9 +1245,6 @@ LOCAL Bool cookiedb_readfilecontext_cookiecheck(httpcookie_t *cookie) | ||
1248 | 1245 | if (cookie->attr.len == 0) { |
1249 | 1246 | return False; |
1250 | 1247 | } |
1251 | - if (cookie->name.len == 0) { | |
1252 | - return False; | |
1253 | - } | |
1254 | 1248 | if (cookie->persistent == False) { |
1255 | 1249 | return False; |
1256 | 1250 | } |
@@ -1,7 +1,7 @@ | ||
1 | 1 | /* |
2 | 2 | * test_cookiedb.c |
3 | 3 | * |
4 | - * Copyright (c) 2011-2012 project bchan | |
4 | + * Copyright (c) 2011-2015 project bchan | |
5 | 5 | * |
6 | 6 | * This software is provided 'as-is', without any express or implied |
7 | 7 | * warranty. In no event will the authors be held liable for any damages |
@@ -2871,6 +2871,77 @@ LOCAL UNITTEST_RESULT test_cookiedb_52() | ||
2871 | 2871 | return test_cookiedb_testingseparateinput_file_clear(data, 2, 0x1eec16c0, NULL, 0, "2ch.net", "/", False, 0x1eec16c0, expected, 0); |
2872 | 2872 | } |
2873 | 2873 | |
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 | + | |
2874 | 2945 | EXPORT VOID test_cookiedb_main(unittest_driver_t *driver) |
2875 | 2946 | { |
2876 | 2947 | UNITTEST_DRIVER_REGIST(driver, test_cookiedb_1); |
@@ -2925,4 +2996,6 @@ EXPORT VOID test_cookiedb_main(unittest_driver_t *driver) | ||
2925 | 2996 | UNITTEST_DRIVER_REGIST(driver, test_cookiedb_50); |
2926 | 2997 | UNITTEST_DRIVER_REGIST(driver, test_cookiedb_51); |
2927 | 2998 | UNITTEST_DRIVER_REGIST(driver, test_cookiedb_52); |
2999 | + UNITTEST_DRIVER_REGIST(driver, test_cookiedb_53); | |
3000 | + UNITTEST_DRIVER_REGIST(driver, test_cookiedb_54); | |
2928 | 3001 | } |