LEFT | RIGHT |
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 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 return ContentType::CONTENT_TYPE_OTHER; | 177 return ContentType::CONTENT_TYPE_OTHER; |
178 } | 178 } |
179 | 179 |
180 ContentType WBPassthruSink::GetContentTypeFromURL(const std::wstring& src) | 180 ContentType WBPassthruSink::GetContentTypeFromURL(const std::wstring& src) |
181 { | 181 { |
182 std::wstring schemeAndHierarchicalPart = GetSchemeAndHierarchicalPart(src); | 182 std::wstring schemeAndHierarchicalPart = GetSchemeAndHierarchicalPart(src); |
183 auto contentType = GetContentTypeFromString(schemeAndHierarchicalPart); | 183 auto contentType = GetContentTypeFromString(schemeAndHierarchicalPart); |
184 if (contentType == ContentType::CONTENT_TYPE_OTHER && | 184 if (contentType == ContentType::CONTENT_TYPE_OTHER && |
185 AdblockPlus::IE::InstalledMajorVersion() == 8) | 185 AdblockPlus::IE::InstalledMajorVersion() == 8) |
186 { | 186 { |
187 ForEachQueryStringParameter(GetQueryString(src), | 187 std::wstring queryString = GetQueryString(src); |
188 [&contentType](const std::wstring& name, const std::wstring& value)->bool | 188 wchar_t* nextToken = nullptr; |
189 { | 189 const wchar_t* token = wcstok_s(&queryString[0], L"&=", &nextToken); |
190 if (!value.empty()) | 190 while (token != nullptr) |
191 { | 191 { |
192 contentType = GetContentTypeFromString(value); | 192 contentType = GetContentTypeFromString(token); |
193 if (contentType != ContentType::CONTENT_TYPE_OTHER) | |
194 { | |
195 return false; | |
196 } | |
197 } | |
198 contentType = GetContentTypeFromString(name); | |
199 if (contentType != ContentType::CONTENT_TYPE_OTHER) | 193 if (contentType != ContentType::CONTENT_TYPE_OTHER) |
200 { | 194 { |
201 return false; | 195 return contentType; |
202 } | 196 } |
203 return true; | 197 token = wcstok_s(nullptr, L"&=", &nextToken); |
204 }); | 198 } |
205 } | 199 } |
206 return contentType; | 200 return contentType; |
207 } | 201 } |
208 | 202 |
209 ContentType WBPassthruSink::GetContentType(const CString& mimeType, const std::w
string& domain, const std::wstring& src) | 203 ContentType WBPassthruSink::GetContentType(const CString& mimeType, const std::w
string& domain, const std::wstring& src) |
210 { | 204 { |
211 // No referer or mime type | 205 // No referer or mime type |
212 // BINDSTRING_XDR_ORIGIN works only for IE v8+ | 206 // BINDSTRING_XDR_ORIGIN works only for IE v8+ |
213 if (mimeType.IsEmpty() && domain.empty() && AdblockPlus::IE::InstalledMajorVer
sion() >= 8) | 207 if (mimeType.IsEmpty() && domain.empty() && AdblockPlus::IE::InstalledMajorVer
sion() >= 8) |
214 { | 208 { |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
446 } | 440 } |
447 | 441 |
448 return OnStart(szUrl, pOIProtSink, pOIBindInfo, grfPI, dwReserved, m_spInterne
tProtocol); | 442 return OnStart(szUrl, pOIProtSink, pOIBindInfo, grfPI, dwReserved, m_spInterne
tProtocol); |
449 } | 443 } |
450 | 444 |
451 STDMETHODIMP WBPassthru::Read(/* [in, out] */ void *pv,/* [in] */ ULONG cb,/* [o
ut] */ ULONG *pcbRead) | 445 STDMETHODIMP WBPassthru::Read(/* [in, out] */ void *pv,/* [in] */ ULONG cb,/* [o
ut] */ ULONG *pcbRead) |
452 { | 446 { |
453 WBPassthruSink* pSink = GetSink(); | 447 WBPassthruSink* pSink = GetSink(); |
454 return pSink->OnRead(pv, cb, pcbRead); | 448 return pSink->OnRead(pv, cb, pcbRead); |
455 } | 449 } |
LEFT | RIGHT |