OLD | NEW |
1 #include "PluginStdAfx.h" | 1 #include "PluginStdAfx.h" |
2 | 2 |
3 #include "PluginWbPassThrough.h" | 3 #include "PluginWbPassThrough.h" |
4 #include "PluginClient.h" | 4 #include "PluginClient.h" |
5 #include "PluginClientFactory.h" | 5 #include "PluginClientFactory.h" |
6 #ifdef SUPPORT_FILTER | 6 #ifdef SUPPORT_FILTER |
7 #include "PluginFilter.h" | 7 #include "PluginFilter.h" |
8 #endif | 8 #endif |
9 #include "PluginSettings.h" | 9 #include "PluginSettings.h" |
10 #include "PluginClass.h" | 10 #include "PluginClass.h" |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 { | 85 { |
86 return CFilter::contentTypeSubdocument; | 86 return CFilter::contentTypeSubdocument; |
87 } | 87 } |
88 else | 88 else |
89 { | 89 { |
90 return CFilter::contentTypeAny & ~CFilter::contentTypeSubdocument; | 90 return CFilter::contentTypeAny & ~CFilter::contentTypeSubdocument; |
91 } | 91 } |
92 | 92 |
93 } | 93 } |
94 | 94 |
95 int WBPassthruSink::GetContentType(CString mimeType, CString domain, CString src
) | 95 int WBPassthruSink::GetContentType(CString mimeType, std::wstring domain, CStrin
g src) |
96 { | 96 { |
97 // No referer or mime type | 97 // No referer or mime type |
98 // BINDSTRING_XDR_ORIGIN works only for IE v8+ | 98 // BINDSTRING_XDR_ORIGIN works only for IE v8+ |
99 if (mimeType.IsEmpty() && domain.IsEmpty() && CPluginClient::GetInstance()->Ge
tIEVersion() >= 8) | 99 if (mimeType.IsEmpty() && domain.empty() && CPluginClient::GetInstance()->GetI
EVersion() >= 8) |
100 { | 100 { |
101 return CFilter::contentTypeXmlHttpRequest; | 101 return CFilter::contentTypeXmlHttpRequest; |
102 } | 102 } |
103 int contentType = GetContentTypeFromMimeType(mimeType); | 103 int contentType = GetContentTypeFromMimeType(mimeType); |
104 if (contentType == CFilter::contentTypeAny) | 104 if (contentType == CFilter::contentTypeAny) |
105 { | 105 { |
106 contentType = GetContentTypeFromURL(src); | 106 contentType = GetContentTypeFromURL(src); |
107 } | 107 } |
108 return contentType; | 108 return contentType; |
109 } | 109 } |
(...skipping 10 matching lines...) Expand all Loading... |
120 | 120 |
121 m_pTargetProtocol = pTargetProtocol; | 121 m_pTargetProtocol = pTargetProtocol; |
122 bool isBlocked = false; | 122 bool isBlocked = false; |
123 m_shouldBlock = false; | 123 m_shouldBlock = false; |
124 m_lastDataReported = false; | 124 m_lastDataReported = false; |
125 CString src; | 125 CString src; |
126 src.Append(szUrl); | 126 src.Append(szUrl); |
127 DEBUG_GENERAL(src); | 127 DEBUG_GENERAL(src); |
128 CPluginClient::UnescapeUrl(src); | 128 CPluginClient::UnescapeUrl(src); |
129 | 129 |
130 CString boundDomain; | 130 std::wstring boundDomain; |
131 CString mimeType; | 131 CString mimeType; |
132 LPOLESTR mime[10]; | 132 LPOLESTR mime[10]; |
133 if (pOIBindInfo) | 133 if (pOIBindInfo) |
134 { | 134 { |
135 ULONG resLen = 0; | 135 ULONG resLen = 0; |
136 | 136 |
137 // Apparently IE will report random mime type if there's more then 1 in the
list. | 137 // Apparently IE will report random mime type if there's more then 1 in the
list. |
138 // So we get the whole list and just use the first one (top priority one) | 138 // So we get the whole list and just use the first one (top priority one) |
139 pOIBindInfo->GetBindString(BINDSTRING_ACCEPT_MIMES, mime, 10, &resLen); | 139 pOIBindInfo->GetBindString(BINDSTRING_ACCEPT_MIMES, mime, 10, &resLen); |
140 if (mime && resLen > 0) | 140 if (mime && resLen > 0) |
141 { | 141 { |
142 mimeType.SetString(mime[0]); | 142 mimeType.SetString(mime[0]); |
143 } | 143 } |
144 LPOLESTR bindToObject = 0; | 144 LPOLESTR bindToObject = 0; |
145 pOIBindInfo->GetBindString(BINDSTRING_FLAG_BIND_TO_OBJECT, &bindToObject, 1,
&resLen); | 145 pOIBindInfo->GetBindString(BINDSTRING_FLAG_BIND_TO_OBJECT, &bindToObject, 1,
&resLen); |
146 LPOLESTR domainRetrieved = 0; | 146 wchar_t* domainRetrieved = 0; |
147 if (resLen == 0 || wcscmp(bindToObject, L"FALSE") == 0) | 147 if (resLen == 0 || wcscmp(bindToObject, L"FALSE") == 0) |
148 { | 148 { |
149 HRESULT hr = pOIBindInfo->GetBindString(BINDSTRING_XDR_ORIGIN, &domainRetr
ieved, 1, &resLen); | 149 HRESULT hr = pOIBindInfo->GetBindString(BINDSTRING_XDR_ORIGIN, &domainRetr
ieved, 1, &resLen); |
150 | 150 |
151 if ((hr == S_OK) && domainRetrieved && (resLen > 0)) | 151 if ((hr == S_OK) && domainRetrieved && (resLen > 0)) |
152 { | 152 { |
153 boundDomain.SetString(domainRetrieved); | 153 boundDomain = std::wstring(domainRetrieved); |
154 } | 154 } |
155 } | 155 } |
156 } | 156 } |
157 | 157 |
158 CString cookie; | 158 CString cookie; |
159 ULONG len1 = 2048; | 159 ULONG len1 = 2048; |
160 ULONG len2 = 2048; | 160 ULONG len2 = 2048; |
161 | 161 |
162 #ifdef SUPPORT_FILTER | 162 #ifdef SUPPORT_FILTER |
163 int contentType = CFilter::contentTypeAny; | 163 int contentType = CFilter::contentTypeAny; |
164 | 164 |
165 CPluginTab* tab = CPluginClass::GetTab(::GetCurrentThreadId()); | 165 CPluginTab* tab = CPluginClass::GetTab(::GetCurrentThreadId()); |
166 CPluginClient* client = CPluginClient::GetInstance(); | 166 CPluginClient* client = CPluginClient::GetInstance(); |
167 | 167 |
168 | 168 |
169 if (tab && client) | 169 if (tab && client) |
170 { | 170 { |
171 CString documentUrl = tab->GetDocumentUrl(); | 171 CString documentUrl = tab->GetDocumentUrl(); |
172 // Page is identical to document => don't block | 172 // Page is identical to document => don't block |
173 if (documentUrl == src) | 173 if (documentUrl == src) |
174 { | 174 { |
175 // fall through | 175 // fall through |
176 } | 176 } |
177 else if (CPluginSettings::GetInstance()->IsPluginEnabled() && !client->IsWhi
telistedUrl(std::wstring(documentUrl))) | 177 else if (CPluginSettings::GetInstance()->IsPluginEnabled() && !client->IsWhi
telistedUrl(std::wstring(documentUrl))) |
178 { | 178 { |
179 boundDomain = tab->GetDocumentUrl(); | 179 boundDomain = to_wstring(tab->GetDocumentUrl()); |
180 | 180 |
181 contentType = CFilter::contentTypeAny; | 181 contentType = CFilter::contentTypeAny; |
182 | 182 |
183 #ifdef SUPPORT_FRAME_CACHING | 183 #ifdef SUPPORT_FRAME_CACHING |
184 if ((tab != 0) && (tab->IsFrameCached(src))) | 184 if ((tab != 0) && (tab->IsFrameCached(src))) |
185 { | 185 { |
186 contentType = CFilter::contentTypeSubdocument; | 186 contentType = CFilter::contentTypeSubdocument; |
187 } | 187 } |
188 else | 188 else |
189 #endif // SUPPORT_FRAME_CACHING | 189 #endif // SUPPORT_FRAME_CACHING |
190 contentType = GetContentType(mimeType, boundDomain, src); | 190 contentType = GetContentType(mimeType, boundDomain, src); |
191 if (client->ShouldBlock(to_wstring(src), contentType, to_wstring(boundDoma
in), true)) | 191 if (client->ShouldBlock(to_wstring(src), contentType, boundDomain, true)) |
192 { | 192 { |
193 isBlocked = true; | 193 isBlocked = true; |
194 DEBUG_BLOCKER("Blocker::Blocking Http-request:" + src); | 194 DEBUG_BLOCKER("Blocker::Blocking Http-request:" + src); |
195 } | 195 } |
196 } | 196 } |
197 if (!isBlocked) | 197 if (!isBlocked) |
198 { | 198 { |
199 DEBUG_BLOCKER("Blocker::Ignoring Http-request:" + src) | 199 DEBUG_BLOCKER("Blocker::Ignoring Http-request:" + src) |
200 } | 200 } |
201 } | 201 } |
202 | 202 |
203 | 203 |
204 if (tab == NULL) | 204 if (tab == NULL) |
205 { | 205 { |
206 contentType = GetContentType(mimeType, boundDomain, src); | 206 contentType = GetContentType(mimeType, boundDomain, src); |
207 if (client->ShouldBlock(to_wstring(src), contentType, to_wstring(boundDomain
), true)) | 207 if (client->ShouldBlock(to_wstring(src), contentType, boundDomain, true)) |
208 { | 208 { |
209 isBlocked = true; | 209 isBlocked = true; |
210 } | 210 } |
211 } | 211 } |
212 | 212 |
213 #ifdef _DEBUG | 213 #ifdef _DEBUG |
214 CString type; | 214 CString type; |
215 | 215 |
216 if (contentType == CFilter::contentTypeDocument) type = "DOCUMENT"; | 216 if (contentType == CFilter::contentTypeDocument) type = "DOCUMENT"; |
217 else if (contentType == CFilter::contentTypeObject) type = "OBJECT"; | 217 else if (contentType == CFilter::contentTypeObject) type = "OBJECT"; |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
394 return OnStart(szUrl, pOIProtSink, pOIBindInfo, grfPI, | 394 return OnStart(szUrl, pOIProtSink, pOIBindInfo, grfPI, |
395 dwReserved, m_spInternetProtocol); | 395 dwReserved, m_spInternetProtocol); |
396 } | 396 } |
397 | 397 |
398 STDMETHODIMP WBPassthru::Read( /* [in, out] */ void *pv,/* [in] */ ULONG cb,/*
[out] */ ULONG *pcbRead) | 398 STDMETHODIMP WBPassthru::Read( /* [in, out] */ void *pv,/* [in] */ ULONG cb,/*
[out] */ ULONG *pcbRead) |
399 { | 399 { |
400 | 400 |
401 WBPassthruSink* pSink = GetSink(); | 401 WBPassthruSink* pSink = GetSink(); |
402 return pSink->Read(pv, cb, pcbRead); | 402 return pSink->Read(pv, cb, pcbRead); |
403 } | 403 } |
OLD | NEW |