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

Delta Between Two Patch Sets: src/plugin/PluginWbPassThrough.cpp

Issue 5634261554036736: Issue 1562 - Improve detecting of XmlHttmlRequest requests (Closed)
Left Patch Set: Created Nov. 13, 2014, 9:11 a.m.
Right Patch Set: add CORS Created Nov. 13, 2014, 10:42 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 if (FAILED(hr)) 60 if (FAILED(hr))
61 { 61 {
62 return ""; 62 return "";
63 } 63 }
64 return ExtractHttpHeader<std::string>(buf, "Accept:", "\r\n"); 64 return ExtractHttpHeader<std::string>(buf, "Accept:", "\r\n");
65 } 65 }
66 66
67 bool IsXmlHttpRequest(const std::wstring& additionalHeaders) 67 bool IsXmlHttpRequest(const std::wstring& additionalHeaders)
68 { 68 {
69 auto requestedWithHeader = ExtractHttpHeader<std::wstring>(additionalHeaders , L"X-Requested-With:", L"\n"); 69 auto requestedWithHeader = ExtractHttpHeader<std::wstring>(additionalHeaders , L"X-Requested-With:", L"\n");
70 return TrimString(requestedWithHeader) == L"XMLHttpRequest"; 70 if(TrimString(requestedWithHeader) == L"XMLHttpRequest")
71 {
72 return true;
73 }
74 // CORS
75 auto originHeader = ExtractHttpHeader<std::wstring>(additionalHeaders, L"Ori gin:", L"\n");
76 return !TrimString(originHeader).empty();
71 } 77 }
72 } 78 }
73 79
74 WBPassthruSink::WBPassthruSink() 80 WBPassthruSink::WBPassthruSink()
75 : m_currentPositionOfSentPage(0) 81 : m_currentPositionOfSentPage(0)
76 , m_contentType(CFilter::EContentType::contentTypeAny) 82 , m_contentType(CFilter::EContentType::contentTypeAny)
77 , m_blockedInTransaction(false) 83 , m_blockedInTransaction(false)
78 { 84 {
79 } 85 }
80 86
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 400
395 STDMETHODIMP WBPassthru::LockRequest(/* [in] */ DWORD options) 401 STDMETHODIMP WBPassthru::LockRequest(/* [in] */ DWORD options)
396 { 402 {
397 return BaseClass::LockRequest(options); 403 return BaseClass::LockRequest(options);
398 } 404 }
399 405
400 STDMETHODIMP WBPassthru::UnlockRequest() 406 STDMETHODIMP WBPassthru::UnlockRequest()
401 { 407 {
402 return BaseClass::UnlockRequest(); 408 return BaseClass::UnlockRequest();
403 } 409 }
LEFTRIGHT
« no previous file | no next file » | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

Powered by Google App Engine
This is Rietveld