| Left: | ||
| Right: |
| 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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 135 } | 135 } |
| 136 } | 136 } |
| 137 | 137 |
| 138 WBPassthruSink::WBPassthruSink() | 138 WBPassthruSink::WBPassthruSink() |
| 139 : m_currentPositionOfSentPage(0) | 139 : m_currentPositionOfSentPage(0) |
| 140 , m_contentType(ContentType::CONTENT_TYPE_OTHER) | 140 , m_contentType(ContentType::CONTENT_TYPE_OTHER) |
| 141 , m_isCustomResponse(false) | 141 , m_isCustomResponse(false) |
| 142 { | 142 { |
| 143 } | 143 } |
| 144 | 144 |
| 145 ContentType WBPassthruSink::GetContentTypeFromMimeType(const std::wstring& mimeT ype) | 145 ContentType WBPassthruSink::GetContentTypeFromMimeType(const std::wstring& mimeT ype) |
|
Eric
2015/12/01 20:32:56
Here's the relevant section on the Accept header f
Oleksandr
2015/12/15 02:10:16
It is not known really if the order has any effect
Eric
2015/12/15 03:18:18
Given the data you've gathered, it seems that IE i
| |
| 146 { | 146 { |
| 147 if (mimeType.find(L"image/") != std::wstring::npos) | 147 if (mimeType.find(L"image/") != std::wstring::npos) |
| 148 { | 148 { |
| 149 // Ambivalent mime type suggests both image and other types. | |
| 150 // Heuristically this is more likely a SUBDOCUMENT request. | |
| 151 if ((mimeType.find(L"text/") != std::wstring::npos) || | |
|
sergei
2015/12/01 10:53:59
In IE11 on my machine Accept header for "subdocume
Eric
2015/12/01 20:32:57
We don't have anything like a crawler for IE, but
Oleksandr
2015/12/15 02:10:16
I have only been able to log 2 types here:
text/ht
Eric
2015/12/15 03:18:18
These are the strings I'd like to see in a comment
| |
| 152 (mimeType.find(L"application/") != std::wstring::npos)) | |
| 153 { | |
| 154 return ContentType::CONTENT_TYPE_SUBDOCUMENT; | |
| 155 } | |
| 149 return ContentType::CONTENT_TYPE_IMAGE; | 156 return ContentType::CONTENT_TYPE_IMAGE; |
| 150 } | 157 } |
| 151 if (mimeType.find(L"text/css") != std::wstring::npos) | 158 if (mimeType.find(L"text/css") != std::wstring::npos) |
| 152 { | 159 { |
| 153 return ContentType::CONTENT_TYPE_STYLESHEET; | 160 return ContentType::CONTENT_TYPE_STYLESHEET; |
| 154 } | 161 } |
| 155 if ((mimeType.find(L"application/javascript") != std::wstring::npos) || (mimeT ype.find(L"application/json") != std::wstring::npos)) | 162 if ((mimeType.find(L"application/javascript") != std::wstring::npos) || (mimeT ype.find(L"application/json") != std::wstring::npos)) |
| 156 { | 163 { |
| 157 return ContentType::CONTENT_TYPE_SCRIPT; | 164 return ContentType::CONTENT_TYPE_SCRIPT; |
| 158 } | 165 } |
| 159 if (mimeType.find(L"application/x-shockwave-flash") != std::wstring::npos) | 166 if (mimeType.find(L"application/x-shockwave-flash") != std::wstring::npos) |
| 160 { | 167 { |
| 161 return ContentType::CONTENT_TYPE_OBJECT; | 168 return ContentType::CONTENT_TYPE_OBJECT; |
| 162 } | 169 } |
| 163 if (mimeType.find(L"text/html") != std::wstring::npos) | 170 if (mimeType.find(L"text/html") != std::wstring::npos) |
|
Eric
2015/12/01 20:32:56
Rather than testing for "text/html" when there's a
Oleksandr
2015/12/15 02:10:16
Seems like it does, based on my tests. Done.
| |
| 164 { | 171 { |
| 165 return ContentType::CONTENT_TYPE_SUBDOCUMENT; | 172 return ContentType::CONTENT_TYPE_SUBDOCUMENT; |
| 166 } | 173 } |
| 167 // It is important to have this check last, since it is rather generic, and mi ght overlay text/html, for example | 174 // It is important to have this check last, since it is rather generic, and mi ght overlay text/html, for example |
| 168 if (mimeType.find(L"xml") != std::wstring::npos) | 175 if (mimeType.find(L"xml") != std::wstring::npos) |
| 169 { | 176 { |
| 170 return ContentType::CONTENT_TYPE_XMLHTTPREQUEST; | 177 return ContentType::CONTENT_TYPE_XMLHTTPREQUEST; |
| 171 } | 178 } |
| 172 | 179 |
| 173 return ContentType::CONTENT_TYPE_OTHER; | 180 return ContentType::CONTENT_TYPE_OTHER; |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 433 } | 440 } |
| 434 | 441 |
| 435 return OnStart(szUrl, pOIProtSink, pOIBindInfo, grfPI, dwReserved, m_spInterne tProtocol); | 442 return OnStart(szUrl, pOIProtSink, pOIBindInfo, grfPI, dwReserved, m_spInterne tProtocol); |
| 436 } | 443 } |
| 437 | 444 |
| 438 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) |
| 439 { | 446 { |
| 440 WBPassthruSink* pSink = GetSink(); | 447 WBPassthruSink* pSink = GetSink(); |
| 441 return pSink->OnRead(pv, cb, pcbRead); | 448 return pSink->OnRead(pv, cb, pcbRead); |
| 442 } | 449 } |
| OLD | NEW |