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

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

Issue 5171077567217664: Issue 1699 - Missed using of url to detect request type (Closed)
Patch Set: Created Dec. 15, 2014, 11:27 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | 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 #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>
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 STDMETHODIMP WBPassthruSink::BeginningTransaction(LPCWSTR szURL, LPCWSTR szHeade rs, DWORD dwReserved, LPWSTR* pszAdditionalHeaders) 275 STDMETHODIMP WBPassthruSink::BeginningTransaction(LPCWSTR szURL, LPCWSTR szHeade rs, DWORD dwReserved, LPWSTR* pszAdditionalHeaders)
276 { 276 {
277 if (!szURL) 277 if (!szURL)
278 { 278 {
279 return E_POINTER; 279 return E_POINTER;
280 } 280 }
281 std::wstring src = szURL; 281 std::wstring src = szURL;
282 DEBUG_GENERAL(ToCString(src)); 282 DEBUG_GENERAL(ToCString(src));
283 283
284 std::string acceptHeader = ExtractHttpAcceptHeader(m_spTargetProtocol); 284 std::string acceptHeader = ExtractHttpAcceptHeader(m_spTargetProtocol);
285 m_contentType = GetContentTypeFromMimeType(ATL::CString(acceptHeader.c_str())) ;
286 285
287 if (pszAdditionalHeaders) 286 if (pszAdditionalHeaders)
288 { 287 {
289 *pszAdditionalHeaders = nullptr; 288 *pszAdditionalHeaders = nullptr;
290 } 289 }
291 290
292 CComPtr<IHttpNegotiate> httpNegotiate; 291 CComPtr<IHttpNegotiate> httpNegotiate;
293 QueryServiceFromClient(&httpNegotiate); 292 QueryServiceFromClient(&httpNegotiate);
294 // This fills the pszAdditionalHeaders with more headers. One of which is the Referer header, which we need. 293 // This fills the pszAdditionalHeaders with more headers. One of which is the Referer header, which we need.
295 // There doesn't seem to be any other way to get this header before the reques t has been made. 294 // There doesn't seem to be any other way to get this header before the reques t has been made.
296 HRESULT nativeHr = httpNegotiate ? httpNegotiate->BeginningTransaction(szURL, szHeaders, dwReserved, pszAdditionalHeaders) : S_OK; 295 HRESULT nativeHr = httpNegotiate ? httpNegotiate->BeginningTransaction(szURL, szHeaders, dwReserved, pszAdditionalHeaders) : S_OK;
297 296
298 if (pszAdditionalHeaders && *pszAdditionalHeaders) 297 if (pszAdditionalHeaders && *pszAdditionalHeaders)
299 { 298 {
300 m_boundDomain = ExtractHttpHeader<std::wstring>(*pszAdditionalHeaders, L"Ref erer:", L"\n"); 299 m_boundDomain = ExtractHttpHeader<std::wstring>(*pszAdditionalHeaders, L"Ref erer:", L"\n");
301 } 300 }
302 m_boundDomain = TrimString(m_boundDomain); 301 m_boundDomain = TrimString(m_boundDomain);
302 m_contentType = GetContentType(ATL::CString(acceptHeader.c_str()), m_boundDoma in, ToCString(src));
303 CPluginTab* tab = CPluginClass::GetTab(::GetCurrentThreadId()); 303 CPluginTab* tab = CPluginClass::GetTab(::GetCurrentThreadId());
304 CPluginClient* client = CPluginClient::GetInstance(); 304 CPluginClient* client = CPluginClient::GetInstance();
305 305
306 if (tab && client) 306 if (tab && client)
307 { 307 {
308 CString documentUrl = tab->GetDocumentUrl(); 308 CString documentUrl = tab->GetDocumentUrl();
309 // Page is identical to document => don't block 309 // Page is identical to document => don't block
310 if (documentUrl == ToCString(src)) 310 if (documentUrl == ToCString(src))
311 { 311 {
312 return nativeHr; 312 return nativeHr;
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 } 388 }
389 389
390 return OnStart(szUrl, pOIProtSink, pOIBindInfo, grfPI, dwReserved, m_spInterne tProtocol); 390 return OnStart(szUrl, pOIProtSink, pOIBindInfo, grfPI, dwReserved, m_spInterne tProtocol);
391 } 391 }
392 392
393 STDMETHODIMP WBPassthru::Read(/* [in, out] */ void *pv,/* [in] */ ULONG cb,/* [o ut] */ ULONG *pcbRead) 393 STDMETHODIMP WBPassthru::Read(/* [in, out] */ void *pv,/* [in] */ ULONG cb,/* [o ut] */ ULONG *pcbRead)
394 { 394 {
395 WBPassthruSink* pSink = GetSink(); 395 WBPassthruSink* pSink = GetSink();
396 return pSink->OnRead(pv, cb, pcbRead); 396 return pSink->OnRead(pv, cb, pcbRead);
397 } 397 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld