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

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

Issue 29330709: Issue #3343 - Eliminate unescaping of URL (Closed)
Patch Set: Created Nov. 23, 2015, 2:16 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
« src/plugin/PluginClass.cpp ('K') | « src/plugin/PluginUtil.cpp ('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 /* 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
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 std::string acceptHeader = ExtractHttpAcceptHeader(m_spTargetProtocol); 330 std::string acceptHeader = ExtractHttpAcceptHeader(m_spTargetProtocol);
332 331
333 if (pszAdditionalHeaders) 332 if (pszAdditionalHeaders)
334 { 333 {
335 *pszAdditionalHeaders = nullptr; 334 *pszAdditionalHeaders = nullptr;
336 } 335 }
337 336
338 CComPtr<IHttpNegotiate> httpNegotiate; 337 CComPtr<IHttpNegotiate> httpNegotiate;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 if (IsFlashRequest(pszAdditionalHeaders)) 370 if (IsFlashRequest(pszAdditionalHeaders))
372 { 371 {
373 m_contentType = ContentType::CONTENT_TYPE_OBJECT_SUBREQUEST; 372 m_contentType = ContentType::CONTENT_TYPE_OBJECT_SUBREQUEST;
374 } 373 }
375 374
376 if (pszAdditionalHeaders && *pszAdditionalHeaders && IsXmlHttpRequest(*pszAddi tionalHeaders)) 375 if (pszAdditionalHeaders && *pszAdditionalHeaders && IsXmlHttpRequest(*pszAddi tionalHeaders))
377 { 376 {
378 m_contentType = ContentType::CONTENT_TYPE_XMLHTTPREQUEST; 377 m_contentType = ContentType::CONTENT_TYPE_XMLHTTPREQUEST;
379 } 378 }
380 379
381 if (client->ShouldBlock(szURL, m_contentType, m_boundDomain, /*debug flag but must be set*/true)) 380 if (client->ShouldBlock(src, m_contentType, m_boundDomain, /*debug flag but mu st be set*/true))
382 { 381 {
383 // NOTE: Feeding custom HTML to Flash, instead of original object subrequest 382 // NOTE: Feeding custom HTML to Flash, instead of original object subrequest
384 // doesn't have much sense. It also can manifest in unwanted result 383 // doesn't have much sense. It also can manifest in unwanted result
385 // like video being blocked (See https://issues.adblockplus.org/ticket/1669) 384 // like video being blocked (See https://issues.adblockplus.org/ticket/1669)
386 // So we report blocked object subrequests as failed, not just empty HTML. 385 // So we report blocked object subrequests as failed, not just empty HTML.
387 m_isCustomResponse = m_contentType != ContentType::CONTENT_TYPE_OBJECT_SUBRE QUEST; 386 m_isCustomResponse = m_contentType != ContentType::CONTENT_TYPE_OBJECT_SUBRE QUEST;
388 return E_ABORT; 387 return E_ABORT;
389 } 388 }
390 return nativeHr; 389 return nativeHr;
391 } 390 }
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 } 435 }
437 436
438 return OnStart(szUrl, pOIProtSink, pOIBindInfo, grfPI, dwReserved, m_spInterne tProtocol); 437 return OnStart(szUrl, pOIProtSink, pOIBindInfo, grfPI, dwReserved, m_spInterne tProtocol);
439 } 438 }
440 439
441 STDMETHODIMP WBPassthru::Read(/* [in, out] */ void *pv,/* [in] */ ULONG cb,/* [o ut] */ ULONG *pcbRead) 440 STDMETHODIMP WBPassthru::Read(/* [in, out] */ void *pv,/* [in] */ ULONG cb,/* [o ut] */ ULONG *pcbRead)
442 { 441 {
443 WBPassthruSink* pSink = GetSink(); 442 WBPassthruSink* pSink = GetSink();
444 return pSink->OnRead(pv, cb, pcbRead); 443 return pSink->OnRead(pv, cb, pcbRead);
445 } 444 }
OLDNEW
« src/plugin/PluginClass.cpp ('K') | « src/plugin/PluginUtil.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld