| OLD | NEW |
| 1 /* | 1 /* |
| 2 * This file is part of Adblock Plus <https://adblockplus.org/>, | 2 * This file is part of Adblock Plus <https://adblockplus.org/>, |
| 3 * Copyright (C) 2006-2015 Eyeo GmbH | 3 * Copyright (C) 2006-2015 Eyeo GmbH |
| 4 * | 4 * |
| 5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify |
| 6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as |
| 7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
| 8 * | 8 * |
| 9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| (...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 return false; | 318 return false; |
| 319 } | 319 } |
| 320 | 320 |
| 321 STDMETHODIMP WBPassthruSink::BeginningTransaction(LPCWSTR szURL, LPCWSTR szHeade
rs, DWORD dwReserved, LPWSTR* pszAdditionalHeaders) | 321 STDMETHODIMP WBPassthruSink::BeginningTransaction(LPCWSTR szURL, LPCWSTR szHeade
rs, DWORD dwReserved, LPWSTR* pszAdditionalHeaders) |
| 322 { | 322 { |
| 323 if (!szURL) | 323 if (!szURL) |
| 324 { | 324 { |
| 325 return E_POINTER; | 325 return E_POINTER; |
| 326 } | 326 } |
| 327 std::wstring src = szURL; | 327 std::wstring src = szURL; |
| 328 UnescapeUrl(src); | |
| 329 DEBUG_GENERAL(src); | 328 DEBUG_GENERAL(src); |
| 330 | 329 |
| 331 if (pszAdditionalHeaders) | 330 if (pszAdditionalHeaders) |
| 332 { | 331 { |
| 333 *pszAdditionalHeaders = nullptr; | 332 *pszAdditionalHeaders = nullptr; |
| 334 } | 333 } |
| 335 | 334 |
| 336 CComPtr<IHttpNegotiate> httpNegotiate; | 335 CComPtr<IHttpNegotiate> httpNegotiate; |
| 337 QueryServiceFromClient(&httpNegotiate); | 336 QueryServiceFromClient(&httpNegotiate); |
| 338 // This fills the pszAdditionalHeaders with more headers. One of which is the
Referer header, which we need. | 337 // This fills the pszAdditionalHeaders with more headers. One of which is the
Referer header, which we need. |
| (...skipping 30 matching lines...) Expand all Loading... |
| 369 if (IsFlashRequest(pszAdditionalHeaders)) | 368 if (IsFlashRequest(pszAdditionalHeaders)) |
| 370 { | 369 { |
| 371 m_contentType = ContentType::CONTENT_TYPE_OBJECT_SUBREQUEST; | 370 m_contentType = ContentType::CONTENT_TYPE_OBJECT_SUBREQUEST; |
| 372 } | 371 } |
| 373 | 372 |
| 374 if (pszAdditionalHeaders && *pszAdditionalHeaders && IsXmlHttpRequest(*pszAddi
tionalHeaders)) | 373 if (pszAdditionalHeaders && *pszAdditionalHeaders && IsXmlHttpRequest(*pszAddi
tionalHeaders)) |
| 375 { | 374 { |
| 376 m_contentType = ContentType::CONTENT_TYPE_XMLHTTPREQUEST; | 375 m_contentType = ContentType::CONTENT_TYPE_XMLHTTPREQUEST; |
| 377 } | 376 } |
| 378 | 377 |
| 379 if (client->ShouldBlock(szURL, m_contentType, m_boundDomain, /*debug flag but
must be set*/true)) | 378 if (client->ShouldBlock(src, m_contentType, m_boundDomain, /*debug flag but mu
st be set*/true)) |
| 380 { | 379 { |
| 381 // NOTE: Feeding custom HTML to Flash, instead of original object subrequest | 380 // NOTE: Feeding custom HTML to Flash, instead of original object subrequest |
| 382 // doesn't have much sense. It also can manifest in unwanted result | 381 // doesn't have much sense. It also can manifest in unwanted result |
| 383 // like video being blocked (See https://issues.adblockplus.org/ticket/1669) | 382 // like video being blocked (See https://issues.adblockplus.org/ticket/1669) |
| 384 // So we report blocked object subrequests as failed, not just empty HTML. | 383 // So we report blocked object subrequests as failed, not just empty HTML. |
| 385 m_isCustomResponse = m_contentType != ContentType::CONTENT_TYPE_OBJECT_SUBRE
QUEST; | 384 m_isCustomResponse = m_contentType != ContentType::CONTENT_TYPE_OBJECT_SUBRE
QUEST; |
| 386 return E_ABORT; | 385 return E_ABORT; |
| 387 } | 386 } |
| 388 return nativeHr; | 387 return nativeHr; |
| 389 } | 388 } |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 434 } | 433 } |
| 435 | 434 |
| 436 return OnStart(szUrl, pOIProtSink, pOIBindInfo, grfPI, dwReserved, m_spInterne
tProtocol); | 435 return OnStart(szUrl, pOIProtSink, pOIBindInfo, grfPI, dwReserved, m_spInterne
tProtocol); |
| 437 } | 436 } |
| 438 | 437 |
| 439 STDMETHODIMP WBPassthru::Read(/* [in, out] */ void *pv,/* [in] */ ULONG cb,/* [o
ut] */ ULONG *pcbRead) | 438 STDMETHODIMP WBPassthru::Read(/* [in, out] */ void *pv,/* [in] */ ULONG cb,/* [o
ut] */ ULONG *pcbRead) |
| 440 { | 439 { |
| 441 WBPassthruSink* pSink = GetSink(); | 440 WBPassthruSink* pSink = GetSink(); |
| 442 return pSink->OnRead(pv, cb, pcbRead); | 441 return pSink->OnRead(pv, cb, pcbRead); |
| 443 } | 442 } |
| OLD | NEW |