| 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 #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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 return ""; | 56 return ""; |
| 57 } | 57 } |
| 58 std::string buf(size, '\0'); | 58 std::string buf(size, '\0'); |
| 59 hr = winInetHttpInfo->QueryInfo(queryOption, &buf[0], &size, &flags, 0); | 59 hr = winInetHttpInfo->QueryInfo(queryOption, &buf[0], &size, &flags, 0); |
| 60 if (FAILED(hr)) | 60 if (FAILED(hr)) |
| 61 { | 61 { |
| 62 return ""; | 62 return ""; |
| 63 } | 63 } |
| 64 return ExtractHttpHeader<std::string>(buf, "Accept:", "\r\n"); | 64 return ExtractHttpHeader<std::string>(buf, "Accept:", "\r\n"); |
| 65 } | 65 } |
| 66 |
| 67 bool IsXmlHttpRequest(const std::wstring& additionalHeaders) |
| 68 { |
| 69 auto requestedWithHeader = ExtractHttpHeader<std::wstring>(additionalHeaders
, L"X-Requested-With:", L"\n"); |
| 70 if(TrimString(requestedWithHeader) == L"XMLHttpRequest") |
| 71 { |
| 72 return true; |
| 73 } |
| 74 // CORS |
| 75 auto originHeader = ExtractHttpHeader<std::wstring>(additionalHeaders, L"Ori
gin:", L"\n"); |
| 76 return !TrimString(originHeader).empty(); |
| 77 } |
| 66 } | 78 } |
| 67 | 79 |
| 68 WBPassthruSink::WBPassthruSink() | 80 WBPassthruSink::WBPassthruSink() |
| 69 : m_currentPositionOfSentPage(0) | 81 : m_currentPositionOfSentPage(0) |
| 70 , m_contentType(CFilter::EContentType::contentTypeAny) | 82 , m_contentType(CFilter::EContentType::contentTypeAny) |
| 71 , m_blockedInTransaction(false) | 83 , m_blockedInTransaction(false) |
| 72 { | 84 { |
| 73 } | 85 } |
| 74 | 86 |
| 75 int WBPassthruSink::GetContentTypeFromMimeType(const CString& mimeType) | 87 int WBPassthruSink::GetContentTypeFromMimeType(const CString& mimeType) |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 { | 321 { |
| 310 if (tab->IsFrameCached(ToCString(src))) | 322 if (tab->IsFrameCached(ToCString(src))) |
| 311 { | 323 { |
| 312 m_contentType = CFilter::contentTypeSubdocument; | 324 m_contentType = CFilter::contentTypeSubdocument; |
| 313 } | 325 } |
| 314 } | 326 } |
| 315 } | 327 } |
| 316 | 328 |
| 317 if (IsFlashRequest(pszAdditionalHeaders)) | 329 if (IsFlashRequest(pszAdditionalHeaders)) |
| 318 { | 330 { |
| 319 m_contentType = CFilter::EContentType::contentTypeObjectSubrequest; | 331 m_contentType = CFilter::EContentType::contentTypeObjectSubrequest; |
| 332 } |
| 333 |
| 334 if (pszAdditionalHeaders && IsXmlHttpRequest(*pszAdditionalHeaders)) |
| 335 { |
| 336 m_contentType = CFilter::EContentType::contentTypeXmlHttpRequest; |
| 320 } | 337 } |
| 321 | 338 |
| 322 m_blockedInTransaction = client->ShouldBlock(szURL, m_contentType, m_boundDoma
in, /*debug flag but must be set*/true); | 339 m_blockedInTransaction = client->ShouldBlock(szURL, m_contentType, m_boundDoma
in, /*debug flag but must be set*/true); |
| 323 if (m_blockedInTransaction) | 340 if (m_blockedInTransaction) |
| 324 { | 341 { |
| 325 return E_ABORT; | 342 return E_ABORT; |
| 326 } | 343 } |
| 327 return nativeHr; | 344 return nativeHr; |
| 328 } | 345 } |
| 329 | 346 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 | 400 |
| 384 STDMETHODIMP WBPassthru::LockRequest(/* [in] */ DWORD options) | 401 STDMETHODIMP WBPassthru::LockRequest(/* [in] */ DWORD options) |
| 385 { | 402 { |
| 386 return BaseClass::LockRequest(options); | 403 return BaseClass::LockRequest(options); |
| 387 } | 404 } |
| 388 | 405 |
| 389 STDMETHODIMP WBPassthru::UnlockRequest() | 406 STDMETHODIMP WBPassthru::UnlockRequest() |
| 390 { | 407 { |
| 391 return BaseClass::UnlockRequest(); | 408 return BaseClass::UnlockRequest(); |
| 392 } | 409 } |
| OLD | NEW |