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

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

Issue 5506777797885952: Issue 1530 - Improve detecting of subrequest issued by flash addon (Closed)
Patch Set: remove changes for another issue Created Nov. 13, 2014, 8:43 a.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/PluginWbPassThrough.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 "PluginWbPassThrough.h" 3 #include "PluginWbPassThrough.h"
4 #include "PluginClient.h" 4 #include "PluginClient.h"
5 #include "PluginClientFactory.h" 5 #include "PluginClientFactory.h"
6 #include "PluginFilter.h" 6 #include "PluginFilter.h"
7 #include "PluginSettings.h" 7 #include "PluginSettings.h"
8 #include "PluginClass.h" 8 #include "PluginClass.h"
9 #include "PluginSystem.h" 9 #include "PluginSystem.h"
10 #include <WinInet.h> 10 #include <WinInet.h>
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 " 236 "
237 */ 237 */
238 return m_spInternetProtocolSink ? m_spInternetProtocolSink->Switch(pProtocolDa ta) : E_UNEXPECTED; 238 return m_spInternetProtocolSink ? m_spInternetProtocolSink->Switch(pProtocolDa ta) : E_UNEXPECTED;
239 } 239 }
240 240
241 // This is the heuristic which detects the requests issued by Flash.ocx. 241 // This is the heuristic which detects the requests issued by Flash.ocx.
242 // It turned out that the implementation from ''Flash.ocx'' (tested version is 1 5.0.0.152) 242 // It turned out that the implementation from ''Flash.ocx'' (tested version is 1 5.0.0.152)
243 // returns quite minimal configuration in comparison with the implementation fro m Microsofts' 243 // returns quite minimal configuration in comparison with the implementation fro m Microsofts'
244 // libraries (see grfBINDF and bindInfo.dwOptions). The impl from MS often inclu des something 244 // libraries (see grfBINDF and bindInfo.dwOptions). The impl from MS often inclu des something
245 // else. 245 // else.
246 bool WBPassthruSink::IsFlashRequest() 246 bool WBPassthruSink::IsFlashRequest(const wchar_t* const* additionalHeaders)
247 { 247 {
248 if (additionalHeaders && *additionalHeaders)
249 {
250 auto flashVersionHeader = ExtractHttpHeader<std::wstring>(*additionalHeaders , L"x-flash-version:", L"\n");
251 if (!TrimString(flashVersionHeader).empty())
252 {
253 return true;
254 }
255 }
248 ATL::CComPtr<IBindStatusCallback> bscb; 256 ATL::CComPtr<IBindStatusCallback> bscb;
249 if (SUCCEEDED(QueryServiceFromClient(&bscb)) && !!bscb) 257 if (SUCCEEDED(QueryServiceFromClient(&bscb)) && !!bscb)
250 { 258 {
251 DWORD grfBINDF = 0; 259 DWORD grfBINDF = 0;
252 BINDINFO bindInfo = {}; 260 BINDINFO bindInfo = {};
253 bindInfo.cbSize = sizeof(bindInfo); 261 bindInfo.cbSize = sizeof(bindInfo);
254 if (SUCCEEDED(bscb->GetBindInfo(&grfBINDF, &bindInfo)) && 262 if (SUCCEEDED(bscb->GetBindInfo(&grfBINDF, &bindInfo)) &&
255 (BINDF_ASYNCHRONOUS | BINDF_ASYNCSTORAGE| BINDF_PULLDATA) == grfBINDF && 263 (BINDF_ASYNCHRONOUS | BINDF_ASYNCSTORAGE| BINDF_PULLDATA) == grfBINDF &&
256 (BINDINFO_OPTIONS_ENABLE_UTF8 | BINDINFO_OPTIONS_USE_IE_ENCODING) == bindI nfo.dwOptions 264 (BINDINFO_OPTIONS_ENABLE_UTF8 | BINDINFO_OPTIONS_USE_IE_ENCODING) == bindI nfo.dwOptions
257 ) 265 )
(...skipping 16 matching lines...) Expand all
274 { 282 {
275 *pszAdditionalHeaders = nullptr; 283 *pszAdditionalHeaders = nullptr;
276 } 284 }
277 285
278 CComPtr<IHttpNegotiate> httpNegotiate; 286 CComPtr<IHttpNegotiate> httpNegotiate;
279 QueryServiceFromClient(&httpNegotiate); 287 QueryServiceFromClient(&httpNegotiate);
280 // This fills the pszAdditionalHeaders with more headers. One of which is the Referer header, which we need. 288 // This fills the pszAdditionalHeaders with more headers. One of which is the Referer header, which we need.
281 // There doesn't seem to be any other way to get this header before the reques t has been made. 289 // There doesn't seem to be any other way to get this header before the reques t has been made.
282 HRESULT nativeHr = httpNegotiate ? httpNegotiate->BeginningTransaction(szURL, szHeaders, dwReserved, pszAdditionalHeaders) : S_OK; 290 HRESULT nativeHr = httpNegotiate ? httpNegotiate->BeginningTransaction(szURL, szHeaders, dwReserved, pszAdditionalHeaders) : S_OK;
283 291
284 if (*pszAdditionalHeaders != 0) 292 if (pszAdditionalHeaders && *pszAdditionalHeaders)
285 { 293 {
286 m_boundDomain = ExtractHttpHeader<std::wstring>(*pszAdditionalHeaders, L"Ref erer:", L"\n").c_str(); 294 m_boundDomain = ExtractHttpHeader<std::wstring>(*pszAdditionalHeaders, L"Ref erer:", L"\n");
287 } 295 }
288 m_boundDomain = TrimString(m_boundDomain); 296 m_boundDomain = TrimString(m_boundDomain);
289 CPluginTab* tab = CPluginClass::GetTab(::GetCurrentThreadId()); 297 CPluginTab* tab = CPluginClass::GetTab(::GetCurrentThreadId());
290 CPluginClient* client = CPluginClient::GetInstance(); 298 CPluginClient* client = CPluginClient::GetInstance();
291 299
292 if (tab && client) 300 if (tab && client)
293 { 301 {
294 CString documentUrl = tab->GetDocumentUrl(); 302 CString documentUrl = tab->GetDocumentUrl();
295 // Page is identical to document => don't block 303 // Page is identical to document => don't block
296 if (documentUrl == ToCString(src)) 304 if (documentUrl == ToCString(src))
297 { 305 {
298 return nativeHr; 306 return nativeHr;
299 } 307 }
300 else if (CPluginSettings::GetInstance()->IsPluginEnabled() && !client->IsWhi telistedUrl(std::wstring(documentUrl))) 308 else if (CPluginSettings::GetInstance()->IsPluginEnabled() && !client->IsWhi telistedUrl(std::wstring(documentUrl)))
301 { 309 {
302 if (tab->IsFrameCached(ToCString(src))) 310 if (tab->IsFrameCached(ToCString(src)))
303 { 311 {
304 m_contentType = CFilter::contentTypeSubdocument; 312 m_contentType = CFilter::contentTypeSubdocument;
305 } 313 }
306 } 314 }
307 } 315 }
308 316
309 if (IsFlashRequest()) 317 if (IsFlashRequest(pszAdditionalHeaders))
310 { 318 {
311 m_contentType = CFilter::EContentType::contentTypeObjectSubrequest; 319 m_contentType = CFilter::EContentType::contentTypeObjectSubrequest;
312 } 320 }
313 321
314 m_blockedInTransaction = client->ShouldBlock(szURL, m_contentType, m_boundDoma in, /*debug flag but must be set*/true); 322 m_blockedInTransaction = client->ShouldBlock(szURL, m_contentType, m_boundDoma in, /*debug flag but must be set*/true);
315 if (m_blockedInTransaction) 323 if (m_blockedInTransaction)
316 { 324 {
317 return E_ABORT; 325 return E_ABORT;
318 } 326 }
319 return nativeHr; 327 return nativeHr;
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 383
376 STDMETHODIMP WBPassthru::LockRequest(/* [in] */ DWORD options) 384 STDMETHODIMP WBPassthru::LockRequest(/* [in] */ DWORD options)
377 { 385 {
378 return BaseClass::LockRequest(options); 386 return BaseClass::LockRequest(options);
379 } 387 }
380 388
381 STDMETHODIMP WBPassthru::UnlockRequest() 389 STDMETHODIMP WBPassthru::UnlockRequest()
382 { 390 {
383 return BaseClass::UnlockRequest(); 391 return BaseClass::UnlockRequest();
384 } 392 }
OLDNEW
« no previous file with comments | « src/plugin/PluginWbPassThrough.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld