Add the exception handling when using manual cert mode
authorMyeongSeong Seo <ms49.seo@samsung.com>
Tue, 21 May 2013 10:06:25 +0000 (19:06 +0900)
committerMyeongSeong Seo <ms49.seo@samsung.com>
Tue, 21 May 2013 10:06:25 +0000 (19:06 +0900)
Change-Id: I16ed9984d19db86afe384a9e18aaafd52e3ab810
Signed-off-by: MyeongSeong Seo <ms49.seo@samsung.com>
src/http/FNetHttp_HttpMultipleConnectionInfo.cpp
src/http/FNetHttp_HttpTransactionImpl.cpp

index 9ed6b42..e8d4c0e 100755 (executable)
@@ -250,6 +250,7 @@ void
 _HttpMultipleConnectionInfo::CheckCurlMultiStatus(void)
 {
        result r = E_SUCCESS;
+       result res = E_SUCCESS;
        CURLMsg* pMessage = null;
        int messageCount = 0;
        CURL* pCurl = null;
@@ -450,6 +451,20 @@ _HttpMultipleConnectionInfo::CheckCurlMultiStatus(void)
                                                        }
                                                        else
                                                        {
+                                                               _HttpSslInfo* pSSLInfo = _HttpUtility::GetSslCertInfo(pHttpTransactionUserData->GetSocketFd());
+                                                               if (pSSLInfo != null)
+                                                               {
+                                                                       if (pSSLInfo->GetCertificateVerificationFlag() == HTTP_CV_FLAG_MANUAL)
+                                                                       {
+                                                                               res = _HttpUtility::RemoveSslCertInfo(*pSSLInfo);
+                                                                               if (IsFailed(res))
+                                                                               {
+                                                                                       SysLogException(NID_NET_HTTP, E_SYSTEM, "[E_SYSTEM] Failed to remove the server cert.");
+                                                                               }
+                                                                               SysLog(NID_NET_HTTP, "The server certificate is removed.");
+                                                                       }
+                                                               }
+
                                                                //Fire the event(_HTTP_TRANSACTION_EVENT_TYPE_ABORTED)
                                                                pHttpTransactionEvent->FireTransactionAbortedEvent(r);
                                                        }
index 3e1957b..d8958c7 100755 (executable)
@@ -310,6 +310,20 @@ _HttpTransactionImpl::Close(void)
        if (__pHttpTransactionUserData->GetSocketFd() >= 0)
        {
                sockFd = __pHttpTransactionUserData->GetSocketFd();
+
+               _HttpSslInfo* pSSLInfo = _HttpUtility::GetSslCertInfo(sockFd);
+               if (pSSLInfo != null)
+               {
+                       if (pSSLInfo->GetCertificateVerificationFlag() == HTTP_CV_FLAG_MANUAL)
+                       {
+                               r = _HttpUtility::RemoveSslCertInfo(*pSSLInfo);
+                               if (IsFailed(r))
+                               {
+                                       SysLogException(NID_NET_HTTP, E_SYSTEM, "[E_SYSTEM] Failed to remove the server cert.");
+                               }
+                               SysLog(NID_NET_HTTP, "The server certificate is removed.");
+                       }
+               }
                SysLog(NID_NET_HTTP, "The socket(%d) was closed.", sockFd);
        }