Left: | ||
Right: |
OLD | NEW |
---|---|
1 #include "PluginStdAfx.h" | 1 #include "PluginStdAfx.h" |
2 | 2 |
3 #include "PluginWbPassThrough.h" | 3 #include "PluginWbPassThrough.h" |
4 #include "PluginClient.h" | 4 #include "PluginClient.h" |
5 #include "PluginClientFactory.h" | 5 #include "PluginClientFactory.h" |
6 #include "PluginFilter.h" | 6 #include "PluginFilter.h" |
7 #include "PluginSettings.h" | 7 #include "PluginSettings.h" |
8 #include "PluginClass.h" | 8 #include "PluginClass.h" |
9 #include "PluginSystem.h" | 9 #include "PluginSystem.h" |
10 #include <WinInet.h> | 10 #include <WinInet.h> |
11 #include "wtypes.h" | 11 #include "wtypes.h" |
12 #include "../shared/Utils.h" | |
12 | 13 |
13 namespace | 14 namespace |
14 { | 15 { |
15 std::string g_blockedByABPPage = "<!DOCTYPE html>" | 16 std::string g_blockedByABPPage = "<!DOCTYPE html>" |
16 "<html>" | 17 "<html>" |
17 "<body>" | 18 "<body>" |
18 "<!-- blocked by AdblockPlus -->" | 19 "<!-- blocked by AdblockPlus -->" |
19 "</body>" | 20 "</body>" |
20 "</html>"; | 21 "</html>"; |
22 | |
23 template <class T> | |
24 T ExtractHttpHeader(const T& allHeaders, const T& targetHeaderName, const T& d elimiter) | |
25 { | |
26 auto targetHeaderBeginsAt = allHeaders.find(targetHeaderName); | |
27 if (targetHeaderBeginsAt == T::npos) | |
28 { | |
29 return T(); | |
30 } | |
31 targetHeaderBeginsAt += targetHeaderName.length(); | |
32 auto targetHeaderEndsAt = allHeaders.find(delimiter, targetHeaderBeginsAt); | |
33 if (targetHeaderEndsAt == T::npos) | |
34 { | |
35 return T(); | |
36 } | |
37 return allHeaders.substr(targetHeaderBeginsAt, targetHeaderEndsAt - targetHe aderBeginsAt); | |
38 } | |
39 std::string ExtractHttpAcceptHeader(IInternetProtocol* internetProtocol) | |
sergei
2014/11/05 00:19:36
Would you shift this function one line below, so o
| |
40 { | |
41 // Despite there being HTTP_QUERY_ACCEPT and other query info flags, they do n't work here, | |
42 // only HTTP_QUERY_RAW_HEADERS_CRLF | HTTP_QUERY_FLAG_REQUEST_HEADERS does w ork. | |
43 ATL::CComPtr<IWinInetHttpInfo> winInetHttpInfo; | |
44 HRESULT hr = internetProtocol->QueryInterface(&winInetHttpInfo); | |
45 if (FAILED(hr)) | |
46 { | |
47 return ""; | |
48 } | |
49 DWORD size = 0; | |
50 DWORD flags = 0; | |
51 DWORD queryOption = HTTP_QUERY_RAW_HEADERS_CRLF | HTTP_QUERY_FLAG_REQUEST_HE ADERS; | |
52 hr = winInetHttpInfo->QueryInfo(queryOption, /*buffer*/ nullptr, /*get size* / &size, &flags, /*reserved*/ 0); | |
53 if (FAILED(hr)) | |
54 { | |
55 return ""; | |
56 } | |
57 std::string buf(size, '\0'); | |
58 hr = winInetHttpInfo->QueryInfo(queryOption, &buf[0], &size, &flags, 0); | |
59 if (FAILED(hr)) | |
60 { | |
61 return ""; | |
62 } | |
63 return ExtractHttpHeader<std::string>(buf, std::string("Accept:"), "\r\n"); | |
sergei
2014/11/05 00:19:36
It's not necessary to explicitly construct std::st
| |
64 } | |
65 | |
sergei
2014/11/05 00:19:36
this line
| |
21 } | 66 } |
22 | 67 |
23 WBPassthruSink::WBPassthruSink() | 68 WBPassthruSink::WBPassthruSink() |
24 : m_currentPositionOfSentPage(0) | 69 : m_currentPositionOfSentPage(0) |
25 , m_contentType(CFilter::EContentType::contentTypeAny) | 70 , m_contentType(CFilter::EContentType::contentTypeAny) |
26 , m_blockedInTransaction(false) | 71 , m_blockedInTransaction(false) |
27 { | 72 { |
28 } | 73 } |
29 | 74 |
30 int WBPassthruSink::GetContentTypeFromMimeType(const CString& mimeType) | 75 int WBPassthruSink::GetContentTypeFromMimeType(const CString& mimeType) |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
118 //////////////////////////////////////////////////////////////////////////////// //////// | 163 //////////////////////////////////////////////////////////////////////////////// //////// |
119 //WBPassthruSink | 164 //WBPassthruSink |
120 //Monitor and/or cancel every request and responde | 165 //Monitor and/or cancel every request and responde |
121 //WB makes, including images, sounds, scripts, etc | 166 //WB makes, including images, sounds, scripts, etc |
122 //////////////////////////////////////////////////////////////////////////////// //////// | 167 //////////////////////////////////////////////////////////////////////////////// //////// |
123 HRESULT WBPassthruSink::OnStart(LPCWSTR szUrl, IInternetProtocolSink *pOIProtSin k, | 168 HRESULT WBPassthruSink::OnStart(LPCWSTR szUrl, IInternetProtocolSink *pOIProtSin k, |
124 IInternetBindInfo *pOIBindInfo, DWORD grfPI, HAN DLE_PTR dwReserved, | 169 IInternetBindInfo *pOIBindInfo, DWORD grfPI, HAN DLE_PTR dwReserved, |
125 IInternetProtocol* pTargetProtocol, bool& handle d) | 170 IInternetProtocol* pTargetProtocol, bool& handle d) |
126 { | 171 { |
127 m_pTargetProtocol = pTargetProtocol; | 172 m_pTargetProtocol = pTargetProtocol; |
128 bool isBlocked = false; | 173 return BaseClass::OnStart(szUrl, pOIProtSink, pOIBindInfo, grfPI, dwReserved, pTargetProtocol); |
129 CString src = szUrl; | |
130 DEBUG_GENERAL(src); | |
131 CPluginClient::UnescapeUrl(src); | |
132 | |
133 // call the impl of the base class as soon as possible because it initializes the base class | |
134 // members, used by this method. It queries for the required interfaces. | |
135 HRESULT hr = BaseClass::OnStart(szUrl, pOIProtSink, pOIBindInfo, grfPI, dwRese rved, pTargetProtocol); | |
136 if (FAILED(hr)) | |
137 { | |
138 return hr; | |
139 } | |
140 | |
141 CString mimeType; | |
142 if (pOIBindInfo) | |
143 { | |
144 ULONG resLen = 0; | |
145 | |
146 // Apparently IE will report random mime type if there's more then 1 in the list. | |
147 // So we get the whole list and just use the first one (top priority one) | |
148 LPOLESTR mime[10]; | |
149 pOIBindInfo->GetBindString(BINDSTRING_ACCEPT_MIMES, mime, 10, &resLen); | |
150 if (mime && resLen > 0) | |
151 { | |
152 mimeType.SetString(mime[0]); | |
153 } | |
154 LPOLESTR bindString = nullptr; | |
155 pOIBindInfo->GetBindString(BINDSTRING_FLAG_BIND_TO_OBJECT, &bindString, 1, & resLen); | |
156 LPOLESTR domainRetrieved = nullptr; | |
157 if (resLen == 0 || wcscmp(bindString, L"FALSE") == 0) | |
158 { | |
159 HRESULT hr = pOIBindInfo->GetBindString(BINDSTRING_XDR_ORIGIN, &domainRetr ieved, 1, &resLen); | |
160 if ((hr == S_OK) && domainRetrieved && (resLen > 0)) | |
161 { | |
162 m_boundDomain = domainRetrieved; | |
163 } | |
164 } | |
165 // We can obtain IBindCtx* here, but IEnumString obtained via IBindCtx::Enum ObjectParam | |
166 // does not return any parameter, so it's useless. | |
167 } | |
168 | |
169 CString cookie; | |
170 ULONG len1 = 2048; | |
171 ULONG len2 = 2048; | |
172 | |
173 CPluginTab* tab = CPluginClass::GetTab(::GetCurrentThreadId()); | |
174 CPluginClient* client = CPluginClient::GetInstance(); | |
175 | |
176 if (tab && client) | |
177 { | |
178 CString documentUrl = tab->GetDocumentUrl(); | |
179 // Page is identical to document => don't block | |
180 if (documentUrl == src) | |
181 { | |
182 // fall through | |
183 } | |
184 else if (CPluginSettings::GetInstance()->IsPluginEnabled() && !client->IsWhi telistedUrl(std::wstring(documentUrl))) | |
185 { | |
186 m_boundDomain = tab->GetDocumentUrl(); | |
187 m_contentType = CFilter::contentTypeAny; | |
188 if (tab != nullptr && tab->IsFrameCached(src)) | |
189 { | |
190 m_contentType = CFilter::contentTypeSubdocument; | |
191 } | |
192 else | |
193 { | |
194 m_contentType = GetContentType(mimeType, m_boundDomain, src); | |
195 } | |
196 } | |
197 } | |
198 | |
199 if (tab == nullptr) | |
200 { | |
201 m_contentType = GetContentType(mimeType, m_boundDomain, src); | |
202 } | |
203 | |
204 { | |
205 // Here is the heuristic which detects the requests issued by Flash.ocx. | |
206 // It turned out that the implementation from ''Flash.ocx'' (tested version is 15.0.0.152) | |
207 // returns quite minimal configuration in comparison with the implementation from Microsofts' | |
208 // libraries (see grfBINDF and bindInfo.dwOptions). The impl from MS often i ncludes something | |
209 // else. | |
210 ATL::CComPtr<IBindStatusCallback> bscb; | |
211 if (SUCCEEDED(QueryServiceFromClient(&bscb)) && !!bscb) | |
212 { | |
213 DWORD grfBINDF = 0; | |
214 BINDINFO bindInfo = {}; | |
215 bindInfo.cbSize = sizeof(bindInfo); | |
216 if (SUCCEEDED(bscb->GetBindInfo(&grfBINDF, &bindInfo)) | |
217 && (BINDF_ASYNCHRONOUS | BINDF_ASYNCSTORAGE| BINDF_PULLDATA) == grfBINDF | |
218 && (BINDINFO_OPTIONS_ENABLE_UTF8 | BINDINFO_OPTIONS_USE_IE_ENCODING) == bindInfo.dwOptions | |
219 ) | |
220 { | |
221 m_contentType = CFilter::EContentType::contentTypeObjectSubrequest; | |
222 } | |
223 } | |
224 } | |
225 | |
226 // The descision about EContentType::contentTypeAny is made later in | |
227 // WBPassthruSink::BeginningTransaction. Sometimes here we cannot detect the r equest type, but | |
228 // in WBPassthruSink::BeginningTransaction the header Accept is available whic h allows to | |
229 // obtain the "request type" in our terminology. | |
230 if (nullptr != client | |
231 && CFilter::EContentType::contentTypeAny != m_contentType | |
232 && client->ShouldBlock(static_cast<const wchar_t*>(src), m_contentType, m_bo undDomain, true)) | |
233 { | |
234 isBlocked = true; | |
235 } | |
236 | |
237 // For IE6 and earlier there is iframe back button issue, so avoid it. | |
238 if (isBlocked && client->GetIEVersion() > 6) | |
239 { | |
240 handled = true; | |
241 if (CFilter::EContentType::contentTypeImage == m_contentType) | |
242 { | |
243 // IE shows a cross that img is not loaded | |
244 return INET_E_REDIRECT_FAILED; | |
245 } | |
246 if (CFilter::EContentType::contentTypeSubdocument == m_contentType) | |
247 { | |
248 PassthroughAPP::CustomSinkStartPolicy<WBPassthru, WBPassthruSink>::GetProt ocol(this)->m_shouldSupplyCustomContent = true; | |
249 m_spInternetProtocolSink->ReportProgress(BINDSTATUS_MIMETYPEAVAILABLE, L"t ext/html"); | |
250 m_spInternetProtocolSink->ReportData(BSCF_FIRSTDATANOTIFICATION, 0, static _cast<ULONG>(g_blockedByABPPage.size())); | |
251 return S_OK; | |
252 } | |
253 if (CFilter::EContentType::contentTypeScript == m_contentType) | |
254 { | |
255 m_spInternetProtocolSink->ReportProgress(BINDSTATUS_MIMETYPEAVAILABLE, L"t ext/javascript"); | |
256 m_spInternetProtocolSink->ReportResult(INET_E_REDIRECTING, 301, L"data:"); | |
257 return INET_E_REDIRECT_FAILED; | |
258 } | |
259 if (CFilter::EContentType::contentTypeXmlHttpRequest == m_contentType) | |
260 { | |
261 m_spInternetProtocolSink->ReportResult(INET_E_REDIRECTING, 301, L"data:"); | |
262 return INET_E_REDIRECT_FAILED; | |
263 } | |
264 if (CFilter::EContentType::contentTypeAny != m_contentType) | |
265 { | |
266 m_spInternetProtocolSink->ReportResult(INET_E_REDIRECTING, 301, L"data:"); | |
267 return INET_E_REDIRECT_FAILED; | |
268 } | |
269 } | |
270 | |
271 return isBlocked ? S_FALSE : hr; | |
272 } | 174 } |
273 | 175 |
274 HRESULT WBPassthruSink::OnRead(void* pv, ULONG cb, ULONG* pcbRead) | 176 HRESULT WBPassthruSink::OnRead(void* pv, ULONG cb, ULONG* pcbRead) |
275 { | 177 { |
276 if (pv == nullptr) | 178 if (pv == nullptr) |
277 { | 179 { |
278 return E_POINTER; | 180 return E_POINTER; |
279 } | 181 } |
280 if (pcbRead == nullptr) | 182 if (pcbRead == nullptr) |
281 { | 183 { |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
329 PROTOCOLDATA::grfFlags, eventually URLMon will turn around and call | 231 PROTOCOLDATA::grfFlags, eventually URLMon will turn around and call |
330 IInternetProtocol::Continue on the main thread. | 232 IInternetProtocol::Continue on the main thread. |
331 | 233 |
332 Or, if you happen to have a window handy that was created on the main | 234 Or, if you happen to have a window handy that was created on the main |
333 thread, you can post yourself a message. | 235 thread, you can post yourself a message. |
334 " | 236 " |
335 */ | 237 */ |
336 return m_spInternetProtocolSink ? m_spInternetProtocolSink->Switch(pProtocolDa ta) : E_UNEXPECTED; | 238 return m_spInternetProtocolSink ? m_spInternetProtocolSink->Switch(pProtocolDa ta) : E_UNEXPECTED; |
337 } | 239 } |
338 | 240 |
241 // This is the heuristic which detects the requests issued by Flash.ocx. | |
242 // It turned out that the implementation from ''Flash.ocx'' (tested version is 1 5.0.0.152) | |
243 // returns quite minimal configuration in comparison with the implementation fro m Microsofts' | |
244 // libraries (see grfBINDF and bindInfo.dwOptions). The impl from MS often inclu des something | |
245 // else. | |
246 bool WBPassthruSink::IsFlashRequest() | |
247 { | |
248 ATL::CComPtr<IBindStatusCallback> bscb; | |
249 if (SUCCEEDED(QueryServiceFromClient(&bscb)) && !!bscb) | |
250 { | |
251 DWORD grfBINDF = 0; | |
252 BINDINFO bindInfo = {}; | |
253 bindInfo.cbSize = sizeof(bindInfo); | |
254 if (SUCCEEDED(bscb->GetBindInfo(&grfBINDF, &bindInfo)) && | |
255 (BINDF_ASYNCHRONOUS | BINDF_ASYNCSTORAGE| BINDF_PULLDATA) == grfBINDF && | |
256 (BINDINFO_OPTIONS_ENABLE_UTF8 | BINDINFO_OPTIONS_USE_IE_ENCODING) == bindI nfo.dwOptions | |
257 ) | |
258 { | |
259 return true; | |
260 } | |
261 } | |
262 return false; | |
263 } | |
264 | |
339 STDMETHODIMP WBPassthruSink::BeginningTransaction(LPCWSTR szURL, LPCWSTR szHeade rs, DWORD dwReserved, LPWSTR* pszAdditionalHeaders) | 265 STDMETHODIMP WBPassthruSink::BeginningTransaction(LPCWSTR szURL, LPCWSTR szHeade rs, DWORD dwReserved, LPWSTR* pszAdditionalHeaders) |
340 { | 266 { |
341 if (pszAdditionalHeaders) | 267 if (pszAdditionalHeaders) |
342 { | 268 { |
343 *pszAdditionalHeaders = nullptr; | 269 *pszAdditionalHeaders = nullptr; |
344 } | 270 } |
271 std::wstring src = szURL; | |
272 DEBUG_GENERAL(ToCString(src)); | |
345 | 273 |
346 CPluginClient* client = nullptr; | 274 std::string acceptHeader = ExtractHttpAcceptHeader(m_spTargetProtocol); |
347 if (CFilter::EContentType::contentTypeAny == m_contentType && (client = CPlugi nClient::GetInstance())) | 275 m_contentType = GetContentTypeFromMimeType(ATL::CString(acceptHeader.c_str())) ; |
276 | |
277 CComPtr<IHttpNegotiate> httpNegotiate; | |
278 QueryServiceFromClient(&httpNegotiate); | |
279 // This fills the pszAdditionalHeaders with more headers. One of which is the Referer header, which we need. | |
280 // There doesn't seem to be any other way to get this header before the reques t has been made. | |
281 HRESULT nativeHr = httpNegotiate ? httpNegotiate->BeginningTransaction(szURL, szHeaders, dwReserved, pszAdditionalHeaders) : S_OK; | |
282 | |
283 if (*pszAdditionalHeaders != 0) | |
348 { | 284 { |
349 auto acceptHeader = [&]() -> std::string | 285 m_boundDomain = ExtractHttpHeader<std::wstring>(std::wstring(*pszAdditionalH eaders), std::wstring(L"Referer:"), L"\n").c_str(); |
286 } | |
287 m_boundDomain = TrimString(m_boundDomain); | |
288 CPluginTab* tab = CPluginClass::GetTab(::GetCurrentThreadId()); | |
289 CPluginClient* client = CPluginClient::GetInstance(); | |
290 | |
291 if (tab && client) | |
292 { | |
293 CString documentUrl = tab->GetDocumentUrl(); | |
294 // Page is identical to document => don't block | |
295 if (documentUrl == ToCString(src)) | |
350 { | 296 { |
351 // Despite there is HTTP_QUERY_ACCEPT and other query info flags, they don 't work here, | 297 return nativeHr; |
352 // only HTTP_QUERY_RAW_HEADERS_CRLF | HTTP_QUERY_FLAG_REQUEST_HEADERS does dork. | 298 } |
353 ATL::CComPtr<IWinInetHttpInfo> winInetHttpInfo; | 299 else if (CPluginSettings::GetInstance()->IsPluginEnabled() && !client->IsWhi telistedUrl(std::wstring(documentUrl))) |
354 HRESULT hr = m_spTargetProtocol->QueryInterface(&winInetHttpInfo); | 300 { |
355 if(FAILED(hr)) | 301 if (tab->IsFrameCached(ToCString(src))) |
356 { | 302 { |
357 return ""; | 303 m_contentType = CFilter::contentTypeSubdocument; |
358 } | 304 } |
359 DWORD size = 0; | |
360 DWORD flags = 0; | |
361 hr = winInetHttpInfo->QueryInfo(HTTP_QUERY_RAW_HEADERS_CRLF | HTTP_QUERY_F LAG_REQUEST_HEADERS, | |
362 /*buffer*/nullptr, /* get size */&size, &flags, /*reserved*/ 0); | |
363 if(FAILED(hr)) | |
364 { | |
365 return ""; | |
366 } | |
367 std::string buf(size, '\0'); | |
368 hr = winInetHttpInfo->QueryInfo(HTTP_QUERY_RAW_HEADERS_CRLF | HTTP_QUERY_F LAG_REQUEST_HEADERS, | |
369 &buf[0], &size, &flags, 0); | |
370 if(FAILED(hr)) | |
371 { | |
372 return ""; | |
373 } | |
374 char acceptHeader[] = "Accept:"; | |
375 auto acceptHeaderBeginsAt = buf.find(acceptHeader); | |
376 if (std::string::npos == acceptHeaderBeginsAt) | |
377 { | |
378 return ""; | |
379 } | |
380 acceptHeaderBeginsAt += sizeof(acceptHeader); | |
381 auto acceptHeaderEndsAt = buf.find("\n", acceptHeaderBeginsAt); | |
382 if (std::string::npos == acceptHeaderEndsAt) | |
383 { | |
384 return ""; | |
385 } | |
386 return buf.substr(acceptHeaderBeginsAt, acceptHeaderEndsAt - acceptHeaderB eginsAt); | |
387 }(); | |
388 m_contentType = GetContentTypeFromMimeType(ATL::CString(acceptHeader.c_str() )); | |
389 bool isBlocked = client->ShouldBlock(szURL, m_contentType, m_boundDomain, /* debug flag but must be set*/true); | |
390 if (isBlocked) | |
391 { | |
392 m_blockedInTransaction = true; | |
393 return E_ABORT; | |
394 } | 305 } |
395 } | 306 } |
396 CComPtr<IHttpNegotiate> spHttpNegotiate; | 307 |
397 QueryServiceFromClient(&spHttpNegotiate); | 308 if (IsFlashRequest()) |
398 return spHttpNegotiate ? spHttpNegotiate->BeginningTransaction(szURL, szHeader s,dwReserved, pszAdditionalHeaders) : S_OK; | 309 { |
310 m_contentType = CFilter::EContentType::contentTypeObjectSubrequest; | |
311 } | |
312 | |
313 m_blockedInTransaction = client->ShouldBlock(szURL, m_contentType, m_boundDoma in, /*debug flag but must be set*/true); | |
314 if (m_blockedInTransaction) | |
315 { | |
316 return E_ABORT; | |
317 } | |
318 return nativeHr; | |
399 } | 319 } |
400 | 320 |
401 STDMETHODIMP WBPassthruSink::OnResponse(DWORD dwResponseCode, LPCWSTR szResponse Headers, LPCWSTR szRequestHeaders, LPWSTR *pszAdditionalRequestHeaders) | 321 STDMETHODIMP WBPassthruSink::OnResponse(DWORD dwResponseCode, LPCWSTR szResponse Headers, LPCWSTR szRequestHeaders, LPWSTR *pszAdditionalRequestHeaders) |
402 { | 322 { |
403 if (pszAdditionalRequestHeaders) | 323 if (pszAdditionalRequestHeaders) |
404 { | 324 { |
405 *pszAdditionalRequestHeaders = 0; | 325 *pszAdditionalRequestHeaders = 0; |
406 } | 326 } |
407 | 327 |
408 CComPtr<IHttpNegotiate> spHttpNegotiate; | 328 CComPtr<IHttpNegotiate> spHttpNegotiate; |
(...skipping 15 matching lines...) Expand all Loading... | |
424 // Current method is called by the original protocol implementation and we a re intercepting the | 344 // Current method is called by the original protocol implementation and we a re intercepting the |
425 // call here and eating it, we will call the proper ReportResult later by ou rself. | 345 // call here and eating it, we will call the proper ReportResult later by ou rself. |
426 return S_OK; | 346 return S_OK; |
427 } | 347 } |
428 return BaseClass::ReportResult(hrResult, dwError, szResult); | 348 return BaseClass::ReportResult(hrResult, dwError, szResult); |
429 } | 349 } |
430 | 350 |
431 | 351 |
432 WBPassthru::WBPassthru() | 352 WBPassthru::WBPassthru() |
433 : m_shouldSupplyCustomContent(false) | 353 : m_shouldSupplyCustomContent(false) |
434 , m_hasOriginalStartCalled(false) | |
435 { | 354 { |
436 } | 355 } |
437 | 356 |
438 STDMETHODIMP WBPassthru::Start(LPCWSTR szUrl, IInternetProtocolSink *pOIProtSink , | 357 STDMETHODIMP WBPassthru::Start(LPCWSTR szUrl, IInternetProtocolSink *pOIProtSink , |
439 IInternetBindInfo *pOIBindInfo, DWORD grfPI, HANDLE_PTR dwReserved) | 358 IInternetBindInfo *pOIBindInfo, DWORD grfPI, HANDLE_PTR dwReserved) |
440 { | 359 { |
441 ATLASSERT(m_spInternetProtocol != 0); | 360 ATLASSERT(m_spInternetProtocol != 0); |
442 if (!m_spInternetProtocol) | 361 if (!m_spInternetProtocol) |
443 { | 362 { |
444 return E_UNEXPECTED; | 363 return E_UNEXPECTED; |
445 } | 364 } |
446 | 365 |
447 return OnStart(szUrl, pOIProtSink, pOIBindInfo, grfPI, dwReserved, m_spInterne tProtocol); | 366 return OnStart(szUrl, pOIProtSink, pOIBindInfo, grfPI, dwReserved, m_spInterne tProtocol); |
448 } | 367 } |
449 | 368 |
450 STDMETHODIMP WBPassthru::Read(/* [in, out] */ void *pv,/* [in] */ ULONG cb,/* [o ut] */ ULONG *pcbRead) | 369 STDMETHODIMP WBPassthru::Read(/* [in, out] */ void *pv,/* [in] */ ULONG cb,/* [o ut] */ ULONG *pcbRead) |
451 { | 370 { |
452 WBPassthruSink* pSink = GetSink(); | 371 WBPassthruSink* pSink = GetSink(); |
453 return pSink->OnRead(pv, cb, pcbRead); | 372 return pSink->OnRead(pv, cb, pcbRead); |
454 } | 373 } |
455 | 374 |
456 STDMETHODIMP WBPassthru::LockRequest(/* [in] */ DWORD options) | 375 STDMETHODIMP WBPassthru::LockRequest(/* [in] */ DWORD options) |
457 { | 376 { |
458 if (!m_hasOriginalStartCalled) | |
459 { | |
460 return S_OK; | |
461 } | |
462 return BaseClass::LockRequest(options); | 377 return BaseClass::LockRequest(options); |
463 } | 378 } |
464 | 379 |
465 STDMETHODIMP WBPassthru::UnlockRequest() | 380 STDMETHODIMP WBPassthru::UnlockRequest() |
466 { | 381 { |
467 if (!m_hasOriginalStartCalled) | |
468 { | |
469 return S_OK; | |
470 } | |
471 return BaseClass::UnlockRequest(); | 382 return BaseClass::UnlockRequest(); |
472 } | 383 } |
OLD | NEW |