#include <FApp_AppInfo.h>
#include <FIoDirectory.h>
#include "FNetHttp_HttpCommon.h"
+#include "FNetHttp_HttpTransactionEvent.h"
using namespace std;
using namespace Tizen::Base;
"_HTTP_TRANSACTION_EVENT_TYPE_DOWNLOAD_PROGRESS"
};
+static const char* NetHttpCertificateVerificationFlagToString[] =
+{
+ "HTTP_CV_FLAG_AUTOMATIC",
+ "HTTP_CV_FLAG_MANUAL",
+ "HTTP_CV_FLAG_IGNORED"
+};
+
+const char*
+_HttpUtility::ConvertHttpTransactionEventTypeToString(_HttpTransactionEventType type)
+{
+ return NetHttpTransactionEventTypesToString[type];
+}
+
const char*
-_HttpUtility::ConvertHttpTransactionEventTypeToString(_HttpTransactionEventType index)
+_HttpUtility::ConvertNetHttpCertificateVerificationFlagToString(NetHttpCertificateVerificationFlag flag)
{
- return NetHttpTransactionEventTypesToString[index];
+ return NetHttpCertificateVerificationFlagToString[flag];
}
void
}
result
-_HttpUtility::AddSslCertInfo(_HttpSslInfo & sslInfo)
+_HttpUtility::SetSslCertInfo(_HttpSslInfo & sslInfo)
{
result r = E_SUCCESS;
return r;
}
-IList*
-_HttpUtility::GetSslCertInfoN(int socketFd)
+_HttpSslInfo*
+_HttpUtility::GetSslCertInfo(int socketFd)
{
ClearLastResult();
- unique_ptr<IList> pResultList(new (std::nothrow)LinkedList());
- SysTryReturn(NID_NET_HTTP, pResultList != null, null, E_OUT_OF_MEMORY,
- "[E_OUT_OF_MEMORY] Memory allocation failed.");
-
IList* pServerCertList = GetSslCertList();
Mutex* pHttpMutex = GetHttpMutex();
_HttpSslInfo* pSSLInfo = null;
if (pSSLInfo->GetSocketFd() == socketFd)
{
SysLog(NID_NET_HTTP, "Found the same server cert.");
- pResultList->Add(*pSSLInfo);
+ return pSSLInfo;
}
}
- return pResultList.release();
+ return null;
}
result
-_HttpUtility::RemoveSslCertInfo(int socketFd)
+_HttpUtility::RemoveSslCertInfo(_HttpSslInfo & sslInfo)
{
ClearLastResult();
result r = E_SUCCESS;
Mutex* pHttpMutex = GetHttpMutex();
- _HttpSslInfo* pSSLInfo = null;
IList *pServerCertList = GetSslCertList();
- unique_ptr<IList> pResultList(GetSslCertInfoN(socketFd));
- SysTryReturnResult(NID_NET_HTTP, pResultList != null, E_OUT_OF_MEMORY,
- "Memory allocation failed.");
-
MutexGuard locked(*pHttpMutex);
SysTryReturnResult(NID_NET_HTTP, locked.IsLocked(), E_SYSTEM,
"Failed to lock mutex.");
- unique_ptr<IEnumerator> pEnum(pResultList->GetEnumeratorN());
- while (pEnum->MoveNext() == E_SUCCESS)
- {
- pSSLInfo = dynamic_cast< _HttpSslInfo* >(pEnum->GetCurrent());
- SysTryReturnResult(NID_NET_HTTP, pSSLInfo != null, E_OUT_OF_MEMORY,
- "Memory allocation failed.");
-
- SysLog(NID_NET_HTTP, "Found the server cert. socketFd(%d), depth(%d)", pSSLInfo->GetSocketFd(), pSSLInfo->GetDepth());
- pServerCertList->Remove(*pSSLInfo, false);
- }
-
- pResultList->RemoveAll(true);
+ pServerCertList->Remove(sslInfo, true);
return r;
}
__depth = depth;
__serverCert = serverCert;
__errorMessage = errorMessage;
+ __pHttpTransactionEvent = null;
+ __flag = HTTP_CV_FLAG_AUTOMATIC;
+}
+
+_HttpSslInfo::_HttpSslInfo(int socketFd, _HttpTransactionEvent* pHttpTransactionEvent)
+{
+ __socketFd = socketFd;
+ __depth = -1;
+ __pHttpTransactionEvent = pHttpTransactionEvent;
+ __flag = HTTP_CV_FLAG_MANUAL;
}
_HttpSslInfo::~_HttpSslInfo()
return __socketFd;
}
+_HttpTransactionEvent*
+_HttpSslInfo::GetHttpTransactionEvent(void) const
+{
+ return __pHttpTransactionEvent;
+}
+
+NetHttpCertificateVerificationFlag
+_HttpSslInfo::GetCertificateVerificationFlag(void) const
+{
+ return __flag;
+}
+
} } } // Tizen::Net::Http