• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

Revisióna50bb214e077c63f88d56f74814702df32b04df5 (tree)
Tiempo2012-03-26 00:43:07
Autorqwerty2501 <qwerty2501@user...>
Commiterqwerty2501

Log Message

Safariクッキー取得処理実装

Cambiar Resumen

Diferencia incremental

Binary files a/nlite.suo and b/nlite.suo differ
--- a/nlite_common/function.h
+++ b/nlite_common/function.h
@@ -50,11 +50,11 @@ inline const T * memmem(const T *base, ULong count, const void *pattern,UInt
5050 }
5151
5252 // 最初に一致する位置を探す
53- const Byte *start = static_cast<const Byte *>( base );
53+ const Byte *start = reinterpret_cast<const Byte *>( base );
5454 for( const Byte *p = start;p + length <= start + count;++p ){
5555 if ( 0 == memcmp( p, pattern, length ) )
5656 {
57- return const_cast<Byte *>( p );
57+ return reinterpret_cast<const T *>( p );
5858 }
5959 }
6060
--- a/nlite_common/windowsAPI.cpp
+++ b/nlite_common/windowsAPI.cpp
@@ -364,13 +364,15 @@ CHResult CRegistryKey::QueryValue(const NString &valueName,Int &val,LPDWORD lpTy
364364
365365 Bool CFindFirstFile::NextFile(WIN32_FIND_DATA &findData){
366366
367- return FindNextFile(m_handle,&findData);
367+ return FindNextFile(m_handle,&findData) != FALSE;
368368 }
369369
370370 HANDLE CFindFirstFile::Find(const NString &fileName,WIN32_FIND_DATA &findData){
371371
372+ if(m_handle == nullptr){
372373
373- m_handle = FindFirstFile(fileName.c_str(),&findData);
374+ m_handle = FindFirstFile(fileName.c_str(),&findData);
375+ }
374376
375377 return m_handle;
376378 }
--- a/nlite_cookie/chromecookiegetter.cpp
+++ b/nlite_cookie/chromecookiegetter.cpp
@@ -54,15 +54,18 @@ Bool CChromeCookieGetter::Fancta(const Byte * data,ULong dataSize,const NString
5454
5555 MString searchString;
5656 ToUTF8(searchString,domein+name);
57- const Char *startPointer = reinterpret_cast<const Char*>(memmem(data,dataSize,searchString.c_str(),searchString.size()) +searchString.size()) ;
57+ const Char *startPointer = reinterpret_cast<const Char*>(memmem(data,dataSize,searchString.c_str(),searchString.size()) ) ;
5858
59- U16String cookieValue;
60- UTF8ToUTF16(cookieValue,startPointer,strstr(startPointer,"/") - startPointer);
61- if(!cookieValue.empty() ){
59+ if(startPointer != nullptr){
60+ startPointer += searchString.size();
61+ U16String cookieValue;
62+ UTF8ToUTF16(cookieValue,startPointer,strstr(startPointer,"/") - startPointer);
63+ if(!cookieValue.empty() ){
6264
63- cookie.SetCookieValue(cookieValue);
64- return true;
65+ cookie.SetCookieValue(cookieValue);
66+ return true;
6567
68+ }
6669 }
6770 return false;
6871 }
--- a/nlite_cookie/firefoxcookiegetter.cpp
+++ b/nlite_cookie/firefoxcookiegetter.cpp
@@ -75,9 +75,10 @@ Bool CFireFoxCookieGetter::Fancta(const Byte * data,ULong dataSize,const NString
7575 ToUTF8(mdomein,_T(".") + domein);
7676 ToUTF8(startdomeinname,domein+name);
7777
78- const Char * startPointer = reinterpret_cast<const Char*>(memmem(data,dataSize,startdomeinname.c_str(),startdomeinname.size())+ startdomeinname.size());
78+ const Char * startPointer = reinterpret_cast<const Char*>(memmem(data,dataSize,startdomeinname.c_str(),startdomeinname.size()));
7979
8080 if(startPointer != nullptr){
81+ startPointer += startdomeinname.size();
8182 U16String cookieValue;
8283 UTF8ToUTF16(cookieValue,startPointer,strstr(startPointer,mdomein.c_str()) - startPointer);
8384 cookie.SetCookieValue(cookieValue);
--- a/nlite_cookie/ieapicookiegetter.h
+++ b/nlite_cookie/ieapicookiegetter.h
@@ -50,7 +50,10 @@ protected:
5050
5151 if(hresult.IsSucceded()){
5252
53- cookie.SetCookieValue(buf.data());
53+ NString val = buf.data();
54+ nregex reg(name + _T("="));
55+ val = std::regex_replace(val,reg,NString(_T("")));
56+ cookie.SetCookieValue(val);
5457 result.SetFindFlag(true);
5558 } else {
5659
@@ -70,7 +73,31 @@ protected:
7073 static Bool Fancta(const Byte * data,ULong dataSize,const NString & domein,const NString &name,CCookie &cookie){
7174
7275
73- return false;
76+ MString mname;
77+ MString mdomein;
78+ ToUTF8(mname,name);
79+ ToUTF8(mdomein,domein);
80+
81+ const Char *keyStartPointer = strstr(reinterpret_cast<const Char*>(data),mname.c_str());
82+
83+ if(keyStartPointer == nullptr)return false;
84+ const Char *cookieStartPointer = strstr(keyStartPointer,"\n");
85+
86+ if(cookieStartPointer == nullptr)return false;
87+
88+ cookieStartPointer++;
89+
90+ const Char *cookieEndPointer = strstr(cookieStartPointer,"\n");
91+
92+ const Char *astorStartPointer = strstr(cookieEndPointer+1,"*");
93+ const Char *domeinStartPointer = strstr(cookieEndPointer+1,mdomein.c_str());
94+ if(astorStartPointer == nullptr || domeinStartPointer == nullptr || astorStartPointer <= domeinStartPointer)return false;
95+ Int cookieBufSize = cookieEndPointer - cookieStartPointer;
96+ U16String val;
97+ UTF8ToUTF16(val,cookieStartPointer,cookieBufSize);
98+ cookie.SetCookieValue(val);
99+
100+ return true;
74101 }
75102
76103 template<typename F>
@@ -82,10 +109,10 @@ protected:
82109 NString targetFileName;
83110 WIN32_FIND_DATA findData;
84111
85-
112+ if(findfirst.Find(searchFiles,findData) == INVALID_HANDLE_VALUE)return result;
86113
87114 do{
88- if(findfirst.Find(searchFiles,findData) != INVALID_HANDLE_VALUE)break;
115+
89116
90117 if((findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == false){
91118
@@ -94,6 +121,7 @@ protected:
94121 if(ForceSearch(targetFileName,domein,name,cookie,func)){
95122
96123 result.SetFindFlag(true);
124+ break;
97125 }
98126 }
99127
--- /dev/null
+++ b/nlite_cookie/iecomponentcookiegetter.cpp
@@ -0,0 +1,30 @@
1+#include "stdafx.h"
2+#include "iecomponentcookiegetter.h"
3+
4+#include "namespace_start.h"
5+
6+browsertype::BrowserType CIEComponentGetter::BT = browsertype::IECOMPONENT;
7+
8+Bool CIEComponentGetter::GetCookieInternal(const NString &domein,const NString &name,CCookie &cookie){
9+
10+ CCookieGetResult result = this->GetCookieIEAPI(domein,name,cookie,false);
11+
12+ if(result.GetResultCode() != resultcode::OK){
13+
14+ resultList.push_back(result);
15+ CCookieGetResult forceresult = CIEComponentGetter::ForceSearchFiles(this->normalDirectry,domein,name,cookie,CIEComponentGetter::Fancta);
16+
17+ if(forceresult.GetResultCode() != resultcode::OK){
18+
19+ resultList.push_back(forceresult);
20+ }
21+
22+ }
23+
24+
25+
26+ return result.IsFound();
27+}
28+
29+
30+#include "namespace_end.h"
\ No newline at end of file
--- /dev/null
+++ b/nlite_cookie/iecomponentcookiegetter.h
@@ -0,0 +1,15 @@
1+#pragma once
2+
3+#include "ieapicookiegetter.h"
4+
5+#include "namespace_start.h"
6+
7+class CIEComponentGetter:public CIEAPICookieGetterT<CIEComponentGetter>{
8+ friend Void UnitTest();
9+public:
10+ Bool GetCookieInternal(const NString &domein,const NString &name,CCookie &cookie);
11+
12+
13+};
14+
15+#include "namespace_end.h"
\ No newline at end of file
--- a/nlite_cookie/iecookiegetter.cpp
+++ b/nlite_cookie/iecookiegetter.cpp
@@ -13,22 +13,23 @@ CIECookieGetter::CIECookieGetter(){
1313
1414 Bool CIECookieGetter::GetCookieInternal(const NString &domein,const NString &name,CCookie &cookie){
1515
16- NString url = _T("http://") + domein;
1716 Bool secFlag = IEIsSecurityMode();
18- CCookieGetResult result = this->GetCookieIEAPI(url,name,cookie,secFlag);
17+ CCookieGetResult result = this->GetCookieIEAPI(domein,name,cookie,secFlag);
1918
2019 if(result.GetResultCode() != resultcode::OK){
2120
2221 resultList.push_back(result);
22+ CCookieGetResult forceresult = CIECookieGetter::ForceSearchFiles(secFlag ? this->securityCookiedir : this->normalDirectry,domein,name,cookie,CIECookieGetter::Fancta);
2323
24- }
25-
24+ if(forceresult.GetResultCode() != resultcode::OK){
2625
27- if(!result.IsFound()){
26+ resultList.push_back(forceresult);
27+ }
2828
29- CIECookieGetter::ForceSearchFiles(secFlag ? this->securityCookiedir : this->normalDirectry,domein,name,cookie,CIECookieGetter::Fancta);
3029 }
3130
31+
32+
3233 return result.IsFound();
3334 }
3435
--- a/nlite_cookie/iecookiegetter.h
+++ b/nlite_cookie/iecookiegetter.h
@@ -5,7 +5,7 @@
55 #include "namespace_start.h"
66 class CIECookieGetter:public CIEAPICookieGetterT<CIECookieGetter>{
77 friend Void UnitTest();
8-
8+ typedef CIEAPICookieGetterT<CIECookieGetter> Base;
99 private:
1010 NString securityCookiedir;
1111
--- a/nlite_cookie/nlite_cookie.vcxproj
+++ b/nlite_cookie/nlite_cookie.vcxproj
@@ -103,6 +103,7 @@
103103 </ItemGroup>
104104 <ItemGroup>
105105 <ClInclude Include="chromecookiegetter.h" />
106+ <ClInclude Include="iecomponentcookiegetter.h" />
106107 <ClInclude Include="cookie.h" />
107108 <ClInclude Include="cookieGetResult.h" />
108109 <ClInclude Include="cookieGetter.h" />
@@ -114,6 +115,8 @@
114115 <ClInclude Include="iecookiegetter.h" />
115116 <ClInclude Include="namespace_end.h" />
116117 <ClInclude Include="namespace_start.h" />
118+ <ClInclude Include="operacookiegetter.h" />
119+ <ClInclude Include="safaricookiegetter.h" />
117120 <ClInclude Include="sqlitecookiegetter.h" />
118121 <ClInclude Include="stdafx.h" />
119122 <ClInclude Include="targetver.h" />
@@ -124,7 +127,10 @@
124127 <ClCompile Include="cookie.cpp" />
125128 <ClCompile Include="cookieGetResult.cpp" />
126129 <ClCompile Include="firefoxcookiegetter.cpp" />
130+ <ClCompile Include="iecomponentcookiegetter.cpp" />
127131 <ClCompile Include="iecookiegetter.cpp" />
132+ <ClCompile Include="operacookiegetter.cpp" />
133+ <ClCompile Include="safaricookiegetter.cpp" />
128134 <ClCompile Include="stdafx.cpp">
129135 <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
130136 <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='UnitTest|Win32'">Create</PrecompiledHeader>
--- a/nlite_cookie/nlite_cookie.vcxproj.filters
+++ b/nlite_cookie/nlite_cookie.vcxproj.filters
@@ -66,6 +66,15 @@
6666 <ClInclude Include="iecookiegetter.h">
6767 <Filter>ヘッダー ファイル</Filter>
6868 </ClInclude>
69+ <ClInclude Include="iecomponentcookiegetter.h">
70+ <Filter>ヘッダー ファイル</Filter>
71+ </ClInclude>
72+ <ClInclude Include="operacookiegetter.h">
73+ <Filter>ヘッダー ファイル</Filter>
74+ </ClInclude>
75+ <ClInclude Include="safaricookiegetter.h">
76+ <Filter>ヘッダー ファイル</Filter>
77+ </ClInclude>
6978 </ItemGroup>
7079 <ItemGroup>
7180 <ClCompile Include="stdafx.cpp">
@@ -89,5 +98,14 @@
8998 <ClCompile Include="iecookiegetter.cpp">
9099 <Filter>ソース ファイル</Filter>
91100 </ClCompile>
101+ <ClCompile Include="iecomponentcookiegetter.cpp">
102+ <Filter>ソース ファイル</Filter>
103+ </ClCompile>
104+ <ClCompile Include="operacookiegetter.cpp">
105+ <Filter>ソース ファイル</Filter>
106+ </ClCompile>
107+ <ClCompile Include="safaricookiegetter.cpp">
108+ <Filter>ソース ファイル</Filter>
109+ </ClCompile>
92110 </ItemGroup>
93111 </Project>
\ No newline at end of file
--- /dev/null
+++ b/nlite_cookie/operacookiegetter.cpp
@@ -0,0 +1,76 @@
1+#include "stdafx.h"
2+#include "operacookiegetter.h"
3+
4+
5+#include "namespace_start.h"
6+
7+browsertype::BrowserType COperaCookieGetter::BT = browsertype::OPERA;
8+
9+COperaCookieGetter::COperaCookieGetter():
10+Base(CreateCookiePath())
11+{}
12+
13+Bool COperaCookieGetter::GetCookieInternal(const NString &domein,const NString &name,CCookie &cookie){
14+
15+ return ForceSearch(cookieFilePath,domein,name,cookie,COperaCookieGetter::Fancta);
16+
17+
18+}
19+
20+Bool COperaCookieGetter::Fancta(const Byte * data,ULong dataSize,const NString & domein,const NString &name,CCookie &cookie){
21+
22+ MString mdomein;
23+ ToUTF8(mdomein,domein);
24+ std::regex reg(".jp");
25+ mdomein = std::regex_replace(mdomein,reg,MString(""));
26+ MString mname;
27+ ToUTF8(mname,name);
28+ MString mval;
29+ ULong dataSizetmp;
30+ const Byte * startPointer = memmem(data,dataSize,mdomein.c_str(),mdomein.size());
31+ const Byte * nameStartPointer;
32+ const Byte * cookieStartPointer;
33+ if(startPointer != nullptr){
34+
35+ do{
36+ startPointer += mdomein.size();
37+ dataSizetmp = dataSize - (startPointer - data);
38+ nameStartPointer = memmem(startPointer,dataSizetmp,mname.c_str(),mname.size());
39+
40+ if(nameStartPointer != nullptr){
41+ cookieStartPointer = nameStartPointer + mname.size() + 2;
42+ if(cookieStartPointer != nullptr){
43+
44+ mval = reinterpret_cast<const Char*>(cookieStartPointer);
45+
46+ std::regex reg2("([^a-z0-9_-])+");
47+ mval = std::regex_replace(mval,reg2,MString(""));
48+ U16String val;
49+ UTF8ToUTF16(val,mval);
50+ cookie.SetCookieValue(val);
51+ return !val.empty();
52+
53+ }
54+
55+ }
56+
57+ startPointer = memmem(startPointer,dataSizetmp,mdomein.c_str(),mdomein.size());
58+ }while(startPointer != nullptr);
59+
60+ }
61+
62+ return false;
63+}
64+
65+NString COperaCookieGetter::CreateCookiePath(){
66+
67+ NString cookieFilePath;
68+ GetAppDataDirectry(cookieFilePath);
69+ cookieFilePath += _T("\\Opera\\Opera\\cookies4.dat");
70+
71+ return cookieFilePath;
72+
73+}
74+
75+
76+#include "namespace_end.h"
\ No newline at end of file
--- /dev/null
+++ b/nlite_cookie/operacookiegetter.h
@@ -0,0 +1,27 @@
1+#include "filecookiegetter.h"
2+
3+
4+#include "namespace_start.h"
5+
6+
7+class COperaCookieGetter:public CFileCookieGetterT<COperaCookieGetter>{
8+
9+ friend Void UnitTest();
10+ typedef CFileCookieGetterT<COperaCookieGetter> Base;
11+public:
12+
13+ COperaCookieGetter();
14+
15+
16+ Bool GetCookieInternal(const NString &domein,const NString &name,CCookie &cookie);
17+
18+
19+ static Bool Fancta(const Byte * data,ULong dataSize,const NString & domein,const NString &name,CCookie &cookie);
20+
21+private:
22+ static NString CreateCookiePath();
23+
24+};
25+
26+
27+#include "namespace_end.h"
\ No newline at end of file
--- /dev/null
+++ b/nlite_cookie/safaricookiegetter.cpp
@@ -0,0 +1,75 @@
1+#include "stdafx.h"
2+#include "safaricookiegetter.h"
3+
4+
5+#include "namespace_start.h"
6+
7+browsertype::BrowserType CSafariCookieGetter::BT = browsertype::SAFARI;
8+
9+CSafariCookieGetter::CSafariCookieGetter():
10+Base(CreateCookiePath())
11+{}
12+
13+Bool CSafariCookieGetter::GetCookieInternal(const NString &domein,const NString &name,CCookie &cookie){
14+
15+ return ForceSearch(cookieFilePath,domein,name,cookie,CSafariCookieGetter::Fancta);
16+
17+
18+}
19+
20+Bool CSafariCookieGetter::Fancta(const Byte * data,ULong dataSize,const NString & domein,const NString &name,CCookie &cookie){
21+
22+ MString mdomein;
23+ ToUTF8(mdomein,domein);
24+ MString mname;
25+ ToUTF8(mname,name);
26+ MString mval;
27+ ULong dataSizetmp;
28+ const Byte * startPointer = memmem(data,dataSize,mname.c_str(),mname.size());
29+ const Byte * domeinStartPointer;
30+ const Byte * cookieStartPointer;
31+ if(startPointer != nullptr){
32+
33+ do{
34+ startPointer += mdomein.size();
35+ dataSizetmp = dataSize - (startPointer - data);
36+ cookieStartPointer = memmem(startPointer,dataSizetmp,mname.c_str(),mname.size());
37+ domeinStartPointer = memmem(startPointer,dataSizetmp,mdomein.c_str(),mdomein.size());
38+
39+ if(domeinStartPointer != nullptr && mdomein == reinterpret_cast<const Char*>(domeinStartPointer)){
40+
41+ if(cookieStartPointer != nullptr){
42+
43+ mval = reinterpret_cast<const Char*>(cookieStartPointer);
44+
45+ std::regex reg2("([^a-z0-9_-])+");
46+ mval = std::regex_replace(mval,reg2,MString(""));
47+ U16String val;
48+ UTF8ToUTF16(val,mval);
49+ cookie.SetCookieValue(val);
50+ return !val.empty();
51+
52+ }
53+
54+ }
55+
56+ startPointer = memmem(startPointer,dataSizetmp,mname.c_str(),mname.size());
57+ }while(startPointer != nullptr);
58+
59+ }
60+
61+ return false;
62+}
63+
64+NString CSafariCookieGetter::CreateCookiePath(){
65+
66+ NString cookieFilePath;
67+ GetAppDataDirectry(cookieFilePath);
68+ cookieFilePath += _T("\\Apple Computer\\Safari\\Cookies\\Cookies.binarycookies");
69+
70+ return cookieFilePath;
71+
72+}
73+
74+
75+#include "namespace_end.h"
\ No newline at end of file
--- /dev/null
+++ b/nlite_cookie/safaricookiegetter.h
@@ -0,0 +1,27 @@
1+#include "filecookiegetter.h"
2+
3+
4+#include "namespace_start.h"
5+
6+
7+class CSafariCookieGetter:public CFileCookieGetterT<CSafariCookieGetter>{
8+
9+ friend Void UnitTest();
10+ typedef CFileCookieGetterT<CSafariCookieGetter> Base;
11+public:
12+
13+ CSafariCookieGetter();
14+
15+
16+ Bool GetCookieInternal(const NString &domein,const NString &name,CCookie &cookie);
17+
18+
19+ static Bool Fancta(const Byte * data,ULong dataSize,const NString & domein,const NString &name,CCookie &cookie);
20+
21+private:
22+ static NString CreateCookiePath();
23+
24+};
25+
26+
27+#include "namespace_end.h"
\ No newline at end of file
--- a/nlite_cookie/unit_test.cpp
+++ b/nlite_cookie/unit_test.cpp
@@ -5,6 +5,9 @@
55 #include "cookie.h"
66 #include "chromecookiegetter.h"
77 #include "firefoxcookiegetter.h"
8+#include "iecomponentcookiegetter.h"
9+#include "safaricookiegetter.h"
10+#include "operacookiegetter.h"
811 #include "iecookiegetter.h"
912 #include "cookieGetter.h"
1013 #include "unit_test.h"
@@ -57,21 +60,10 @@ Void UnitTest(){
5760
5861
5962
60- /*
61- try{
6263
63-// testGetter.ForceSearch(nullptr,0,_T("testdomein"),_T("testname"),cookie);
64-
65- } catch(Exception &e2){
66- e2;
67- exceptionflag = true;
68-
69- }
70-
71- BOOST_CHECK_MESSAGE(exceptionflag == true,"CookieGetter関数実装エラーです");
72- */
7364
7465 {
66+ CCookie cookie1;
7567 BOOST_CHECK_MESSAGE(!CChromeCookieGetter::CreateCookiePath().empty(),"クロームのクッキーパス取得に失敗しました");
7668 CChromeCookieGetter chromeCookieGetter;
7769 Bool result;
@@ -80,7 +72,7 @@ Void UnitTest(){
8072 NString name = _T("user_session");
8173 try{
8274
83- result = chromeCookieGetter.GetCookie(domein,name,cookie);
75+ result = chromeCookieGetter.GetCookie(domein,name,cookie1);
8476
8577 } catch(Exception &e3){
8678 e3;
@@ -105,11 +97,54 @@ Void UnitTest(){
10597 BOOST_CHECK_MESSAGE(result2 == true,"クッキーが見つかりませんでした");
10698
10799 if(result && result2){
108- BOOST_CHECK_MESSAGE(cookie.GetCookieValue() == cookie2.GetCookieValue(),"正規の方法で取得したクッキーと強制検索で取得したクッキーが違います");
100+ BOOST_CHECK_MESSAGE(cookie1.GetCookieValue() == cookie2.GetCookieValue(),"正規の方法で取得したクッキーと強制検索で取得したクッキーが違います");
109101 }
110102 }
103+
104+ {
105+ CCookie cookie1;
106+
107+ COperaCookieGetter cookieGetter;
108+ Bool result;
109+ exceptionflag = false;
110+ NString domein = _T("nicovideo.jp");
111+ NString name = _T("user_session");
112+ try{
113+
114+ result = cookieGetter.GetCookie(domein,name,cookie1);
115+
116+ } catch(Exception &e3){
117+ e3;
118+ exceptionflag = true;
119+ }
120+
121+ BOOST_CHECK_MESSAGE(exceptionflag == false,"クッキー検索中に例外が発生しました");
122+ BOOST_CHECK_MESSAGE(result == true,"クッキーが見つかりませんでした");
123+ }
124+
125+ {
126+ CCookie cookie1;
127+
128+ CSafariCookieGetter cookieGetter;
129+ Bool result;
130+ exceptionflag = false;
131+ NString domein = _T("nicovideo.jp");
132+ NString name = _T("user_session");
133+ try{
134+
135+ result = cookieGetter.GetCookie(domein,name,cookie1);
136+
137+ } catch(Exception &e3){
138+ e3;
139+ exceptionflag = true;
140+ }
141+
142+ BOOST_CHECK_MESSAGE(exceptionflag == false,"クッキー検索中に例外が発生しました");
143+ BOOST_CHECK_MESSAGE(result == true,"クッキーが見つかりませんでした");
144+ }
111145
112146 {
147+ CCookie cookie1;
113148 BOOST_CHECK_MESSAGE(!CFireFoxCookieGetter::CreateCookiePath().empty(),"クッキーパス取得に失敗しました");
114149 CFireFoxCookieGetter firefoxcookiegetter;
115150 Bool result;
@@ -118,7 +153,7 @@ Void UnitTest(){
118153 NString name = _T("user_session");
119154 try{
120155
121- result = firefoxcookiegetter.GetCookie(domein,name,cookie);
156+ result = firefoxcookiegetter.GetCookie(domein,name,cookie1);
122157
123158 } catch(Exception &e3){
124159 e3;
@@ -143,12 +178,12 @@ Void UnitTest(){
143178 BOOST_CHECK_MESSAGE(result2 == true,"クッキーが見つかりませんでした");
144179
145180 if(result && result2){
146- BOOST_CHECK_MESSAGE(cookie.GetCookieValue() == cookie2.GetCookieValue(),"正規の方法で取得したクッキーと強制検索で取得したクッキーが違います");
181+ BOOST_CHECK_MESSAGE(cookie1.GetCookieValue() == cookie2.GetCookieValue(),"正規の方法で取得したクッキーと強制検索で取得したクッキーが違います");
147182 }
148183 }
149184
150185 {
151-
186+ CCookie cookie1;
152187 CIECookieGetter::IEIsSecurityMode();
153188
154189
@@ -159,7 +194,51 @@ Void UnitTest(){
159194 NString name = _T("user_session");
160195 try{
161196
162- result = cookieGetters.GetCookie(domein,name,cookie);
197+ result = cookieGetters.GetCookie(domein,name,cookie1);
198+
199+ } catch(Exception &e3){
200+ e3;
201+ exceptionflag = true;
202+ }
203+
204+ BOOST_CHECK_MESSAGE(exceptionflag == false,"クッキー検索中に例外が発生しました");
205+ BOOST_CHECK_MESSAGE(result == true,"クッキーが見つかりませんでした");
206+
207+ exceptionflag = true;
208+ Bool result2 = false;
209+ CCookie cookie2;
210+ try{
211+
212+ CCookieGetResult result = cookieGetters.ForceSearchFiles(cookieGetters.securityCookiedir,domein,name,cookie2,CIECookieGetter::Fancta);
213+
214+ result2 = result.IsFound();
215+
216+ } catch(Exception &e3){
217+ e3;
218+ exceptionflag = true;
219+ }
220+
221+ BOOST_CHECK_MESSAGE(result2 == true,"クッキーが見つかりませんでした");
222+
223+ if(result && result2){
224+ BOOST_CHECK_MESSAGE(cookie1.GetCookieValue() == cookie2.GetCookieValue(),"正規の方法で取得したクッキーと強制検索で取得したクッキーが違います");
225+ }
226+
227+ }
228+
229+
230+ {
231+ CCookie cookie1;
232+
233+
234+ CIEComponentGetter cookieGetters;
235+ Bool result;
236+ exceptionflag = false;
237+ NString domein = _T("nicovideo.jp");
238+ NString name = _T("user_session");
239+ try{
240+
241+ result = cookieGetters.GetCookie(domein,name,cookie1);
163242
164243 } catch(Exception &e3){
165244 e3;
@@ -173,8 +252,10 @@ Void UnitTest(){
173252 Bool result2 = false;
174253 CCookie cookie2;
175254 try{
176- // result2 = ForceSearch(firefoxcookiegetter.cookieFilePath,domein,name,cookie2,CFireFoxCookieGetter::Fancta);
255+
256+ CCookieGetResult result = cookieGetters.ForceSearchFiles(cookieGetters.normalDirectry,domein,name,cookie2,CIECookieGetter::Fancta);
177257
258+ result2 = result.IsFound();
178259
179260 } catch(Exception &e3){
180261 e3;
@@ -184,7 +265,7 @@ Void UnitTest(){
184265 BOOST_CHECK_MESSAGE(result2 == true,"クッキーが見つかりませんでした");
185266
186267 if(result && result2){
187- BOOST_CHECK_MESSAGE(cookie.GetCookieValue() == cookie2.GetCookieValue(),"正規の方法で取得したクッキーと強制検索で取得したクッキーが違います");
268+ BOOST_CHECK_MESSAGE(cookie1.GetCookieValue() == cookie2.GetCookieValue(),"正規の方法で取得したクッキーと強制検索で取得したクッキーが違います");
188269 }
189270
190271 }