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 20 matching lines...) Expand all Loading... |
31 | 31 |
32 namespace | 32 namespace |
33 { | 33 { |
34 const std::string g_blockedByABPPage = "<!DOCTYPE html>" | 34 const std::string g_blockedByABPPage = "<!DOCTYPE html>" |
35 "<html>" | 35 "<html>" |
36 "<body>" | 36 "<body>" |
37 "<!-- blocked by AdblockPlus -->" | 37 "<!-- blocked by AdblockPlus -->" |
38 "</body>" | 38 "</body>" |
39 "</html>"; | 39 "</html>"; |
40 | 40 |
41 template <typename T> | |
42 T ASCIIStringToLower(const T& text) | |
43 { | |
44 T textlower; | |
45 std::transform(text.begin(), text.end(), std::back_inserter(textlower), | |
46 [](T::value_type ch) | |
47 { | |
48 return std::tolower(ch, std::locale()); | |
49 } | |
50 ); | |
51 return textlower; | |
52 } | |
53 | |
54 typedef AdblockPlus::FilterEngine::ContentType ContentType; | 41 typedef AdblockPlus::FilterEngine::ContentType ContentType; |
55 | 42 |
56 template <class T> | 43 template <class T> |
57 T ExtractHttpHeader(const T& allHeaders, const T& targetHeaderNameWithColon, c
onst T& delimiter) | 44 T ExtractHttpHeader(const T& allHeaders, const T& targetHeaderNameWithColon, c
onst T& delimiter) |
58 { | 45 { |
59 const T allHeadersLower = ASCIIStringToLower(allHeaders); | 46 const T allHeadersLower = ASCIIStringToLower(allHeaders); |
60 auto targetHeaderBeginsAt = allHeadersLower.find(ASCIIStringToLower(targetHe
aderNameWithColon)); | 47 auto targetHeaderBeginsAt = allHeadersLower.find(ASCIIStringToLower(targetHe
aderNameWithColon)); |
61 if (targetHeaderBeginsAt == T::npos) | 48 if (targetHeaderBeginsAt == T::npos) |
62 { | 49 { |
63 return T(); | 50 return T(); |
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
425 } | 412 } |
426 | 413 |
427 return OnStart(szUrl, pOIProtSink, pOIBindInfo, grfPI, dwReserved, m_spInterne
tProtocol); | 414 return OnStart(szUrl, pOIProtSink, pOIBindInfo, grfPI, dwReserved, m_spInterne
tProtocol); |
428 } | 415 } |
429 | 416 |
430 STDMETHODIMP WBPassthru::Read(/* [in, out] */ void *pv,/* [in] */ ULONG cb,/* [o
ut] */ ULONG *pcbRead) | 417 STDMETHODIMP WBPassthru::Read(/* [in, out] */ void *pv,/* [in] */ ULONG cb,/* [o
ut] */ ULONG *pcbRead) |
431 { | 418 { |
432 WBPassthruSink* pSink = GetSink(); | 419 WBPassthruSink* pSink = GetSink(); |
433 return pSink->OnRead(pv, cb, pcbRead); | 420 return pSink->OnRead(pv, cb, pcbRead); |
434 } | 421 } |
OLD | NEW |