Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: src/plugin/PluginMimeFilterClient.cpp

Issue 11376138: HTTPS support (Closed)
Patch Set: Created Aug. 11, 2013, 4:54 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/plugin/PluginMimeFilterClient.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #include "PluginStdAfx.h" 1 #include "PluginStdAfx.h"
2 2
3 #include "PluginMimeFilterClient.h" 3 #include "PluginMimeFilterClient.h"
4 #include "PluginClient.h" 4 #include "PluginClient.h"
5 #include "PluginWbPassThrough.h" 5 #include "PluginWbPassThrough.h"
6 6
7 7
8 typedef PassthroughAPP::CMetaFactory<PassthroughAPP::CComClassFactoryProtocol,WB Passthru> MetaFactory; 8 typedef PassthroughAPP::CMetaFactory<PassthroughAPP::CComClassFactoryProtocol,WB Passthru> MetaFactory;
9 9
10 10
11 CPluginMimeFilterClient::CPluginMimeFilterClient() : m_classFactory(NULL), m_spC FHTTP(NULL) 11 CPluginMimeFilterClient::CPluginMimeFilterClient() : m_classFactory(NULL), m_spC FHTTP(NULL), m_spCFHTTPS(NULL)
12 { 12 {
13 // Should only be called once 13 // Should only be called once
14 // We register mime filters here 14 // We register mime filters here
15 // Register asynchronous protocol 15 // Register asynchronous protocol
16 CComPtr<IInternetSession> spSession; 16 CComPtr<IInternetSession> spSession;
17 m_spCFHTTP = NULL; 17 m_spCFHTTP = NULL;
18 m_spCFHTTPS = NULL;
Felix Dahlke 2013/08/11 17:00:36 No need to set this to NULL here if you do it in t
18 HRESULT hr = ::CoInternetGetSession(0, &spSession, 0); 19 HRESULT hr = ::CoInternetGetSession(0, &spSession, 0);
19 if (FAILED(hr) || !spSession) 20 if (FAILED(hr) || !spSession)
20 { 21 {
21 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_SESSION, PLUGIN_ERROR_SESSION_GET_INTERNET_ SESSION, "MimeClient::CoInternetGetSession failed"); 22 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_SESSION, PLUGIN_ERROR_SESSION_GET_INTERNET_ SESSION, "MimeClient::CoInternetGetSession failed");
22 return; 23 return;
23 } 24 }
24 25
25 hr = MetaFactory::CreateInstance(CLSID_HttpProtocol, &m_spCFHTTP); 26 hr = MetaFactory::CreateInstance(CLSID_HttpProtocol, &m_spCFHTTP);
26 if (FAILED(hr) || !m_spCFHTTP) 27 if (FAILED(hr) || !m_spCFHTTP)
27 { 28 {
28 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_SESSION, PLUGIN_ERROR_SESSION_CREATE_HTTP_I NSTANCE, "MimeClient::CreateInstance failed"); 29 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_SESSION, PLUGIN_ERROR_SESSION_CREATE_HTTP_I NSTANCE, "MimeClient::CreateInstance failed");
29 return; 30 return;
30 } 31 }
31 32
32 hr = spSession->RegisterNameSpace(m_spCFHTTP, CLSID_HttpProtocol, L"http", 0, 0, 0); 33 hr = spSession->RegisterNameSpace(m_spCFHTTP, CLSID_HttpProtocol, L"http", 0, 0, 0);
33 if (FAILED(hr)) 34 if (FAILED(hr))
34 { 35 {
35 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_SESSION, PLUGIN_ERROR_SESSION_REGISTER_HTTP _NAMESPACE, "MimeClient::RegisterNameSpace failed"); 36 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_SESSION, PLUGIN_ERROR_SESSION_REGISTER_HTTP _NAMESPACE, "MimeClient::RegisterNameSpace failed");
36 return; 37 return;
37 } 38 }
39
40 hr = MetaFactory::CreateInstance(CLSID_HttpSProtocol, &m_spCFHTTPS);
41 if (FAILED(hr) || !m_spCFHTTPS)
42 {
43 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_SESSION, PLUGIN_ERROR_SESSION_CREATE_HTTPS_ INSTANCE, "MimeClient::CreateInstance failed");
44 return;
45 }
46
47 hr = spSession->RegisterNameSpace(m_spCFHTTPS, CLSID_HttpSProtocol, L"https", 0, 0, 0);
48 if (FAILED(hr))
49 {
50 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_SESSION, PLUGIN_ERROR_SESSION_REGISTER_HTTP S_NAMESPACE, "MimeClient::RegisterNameSpace failed");
51 return;
52 }
53
38 } 54 }
39 55
40 56
41 CPluginMimeFilterClient::~CPluginMimeFilterClient() 57 CPluginMimeFilterClient::~CPluginMimeFilterClient()
42 { 58 {
43 CComPtr<IInternetSession> spSession; 59 CComPtr<IInternetSession> spSession;
44 60
45 ::CoInternetGetSession(0, &spSession, 0); 61 ::CoInternetGetSession(0, &spSession, 0);
46 if (spSession) 62 if (spSession)
47 { 63 {
48 spSession->UnregisterNameSpace(m_spCFHTTP, L"http"); 64 spSession->UnregisterNameSpace(m_spCFHTTP, L"http");
49 if (m_spCFHTTP != NULL) 65 if (m_spCFHTTP != NULL)
50 { 66 {
51 m_spCFHTTP.Release(); 67 m_spCFHTTP.Release();
52 m_spCFHTTP = NULL; 68 m_spCFHTTP = NULL;
53 } 69 }
70 spSession->UnregisterNameSpace(m_spCFHTTPS, L"https");
71 if (m_spCFHTTPS != NULL)
72 {
73 m_spCFHTTPS.Release();
74 m_spCFHTTPS = NULL;
75 }
76
54 } 77 }
55 } 78 }
56 79
57 void CPluginMimeFilterClient::Unregister() 80 void CPluginMimeFilterClient::Unregister()
58 { 81 {
59 CComPtr<IInternetSession> spSession; 82 CComPtr<IInternetSession> spSession;
60 83
61 ::CoInternetGetSession(0, &spSession, 0); 84 ::CoInternetGetSession(0, &spSession, 0);
62 if (spSession) 85 if (spSession)
63 { 86 {
64 spSession->UnregisterNameSpace(m_spCFHTTP, L"http"); 87 spSession->UnregisterNameSpace(m_spCFHTTP, L"http");
88 spSession->UnregisterNameSpace(m_spCFHTTPS, L"https");
65 } 89 }
66 } 90 }
OLDNEW
« no previous file with comments | « src/plugin/PluginMimeFilterClient.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld