OLD | NEW |
1 #pragma once | 1 #pragma once |
2 | 2 #include <cstdint> |
3 #include "ProtocolCF.h" | 3 #include "ProtocolCF.h" |
4 #include "ProtocolImpl.h" | 4 #include "ProtocolImpl.h" |
5 #define IE_MAX_URL_LENGTH 2048 | 5 #define IE_MAX_URL_LENGTH 2048 |
6 | 6 |
7 class WBPassthruSink : | 7 class WBPassthruSink : |
8 public PassthroughAPP::CInternetProtocolSinkWithSP<WBPassthruSink, CComM
ultiThreadModel>, | 8 public PassthroughAPP::CInternetProtocolSinkWithSP<WBPassthruSink, CComM
ultiThreadModel>, |
9 public IHttpNegotiate | 9 public IHttpNegotiate |
10 { | 10 { |
11 typedef PassthroughAPP::CInternetProtocolSinkWithSP<WBPassthruSink, CCom
MultiThreadModel> BaseClass; | 11 typedef PassthroughAPP::CInternetProtocolSinkWithSP<WBPassthruSink, CCom
MultiThreadModel> BaseClass; |
12 | 12 |
13 public: | 13 public: |
| 14 WBPassthruSink(); |
14 | 15 |
15 » bool m_shouldBlock; | 16 » uint64_t m_currentPositionOfSentPage; |
16 » bool m_lastDataReported; | |
17 CComPtr<IInternetProtocol> m_pTargetProtocol; | 17 CComPtr<IInternetProtocol> m_pTargetProtocol; |
| 18 int m_contentType; |
| 19 std::wstring m_boundDomain; |
| 20 bool m_blockedInTransaction; |
18 | 21 |
19 int GetContentTypeFromMimeType(CString mimeType); | 22 » int GetContentTypeFromMimeType(const CString& mimeType); |
20 int GetContentTypeFromURL(CString src); | 23 » int GetContentTypeFromURL(const CString& src); |
21 int GetContentType(CString mimeType, std::wstring domain, CString src); | 24 » int GetContentType(const CString& mimeType, const std::wstring& domain,
const CString& src); |
22 public: | 25 public: |
23 BEGIN_COM_MAP(WBPassthruSink) | 26 BEGIN_COM_MAP(WBPassthruSink) |
24 COM_INTERFACE_ENTRY(IHttpNegotiate) | 27 COM_INTERFACE_ENTRY(IHttpNegotiate) |
25 COM_INTERFACE_ENTRY_CHAIN(BaseClass) | 28 COM_INTERFACE_ENTRY_CHAIN(BaseClass) |
26 END_COM_MAP() | 29 END_COM_MAP() |
27 | 30 |
28 BEGIN_SERVICE_MAP(WBPassthruSink) | 31 BEGIN_SERVICE_MAP(WBPassthruSink) |
29 SERVICE_ENTRY(IID_IHttpNegotiate) | 32 SERVICE_ENTRY(IID_IHttpNegotiate) |
30 END_SERVICE_MAP() | 33 END_SERVICE_MAP() |
31 | 34 |
32 STDMETHODIMP BeginningTransaction( | 35 STDMETHODIMP BeginningTransaction( |
33 /* [in] */ LPCWSTR szURL, | 36 /* [in] */ LPCWSTR szURL, |
34 /* [in] */ LPCWSTR szHeaders, | 37 /* [in] */ LPCWSTR szHeaders, |
35 /* [in] */ DWORD dwReserved, | 38 /* [in] */ DWORD dwReserved, |
36 /* [out] */ LPWSTR *pszAdditionalHeaders); | 39 /* [out] */ LPWSTR *pszAdditionalHeaders); |
37 | 40 |
38 STDMETHODIMP OnResponse( | 41 STDMETHODIMP OnResponse( |
39 /* [in] */ DWORD dwResponseCode, | 42 /* [in] */ DWORD dwResponseCode, |
40 /* [in] */ LPCWSTR szResponseHeaders, | 43 /* [in] */ LPCWSTR szResponseHeaders, |
41 /* [in] */ LPCWSTR szRequestHeaders, | 44 /* [in] */ LPCWSTR szRequestHeaders, |
42 /* [out] */ LPWSTR *pszAdditionalRequestHeaders); | 45 /* [out] */ LPWSTR *pszAdditionalRequestHeaders); |
43 | 46 |
44 HRESULT OnStart(LPCWSTR szUrl, IInternetProtocolSink *pOIProtSink, | 47 HRESULT OnStart(LPCWSTR szUrl, IInternetProtocolSink *pOIProtSink, |
45 IInternetBindInfo *pOIBindInfo, DWORD grfPI, HANDLE_PTR dwReserv
ed, | 48 IInternetBindInfo *pOIBindInfo, DWORD grfPI, HANDLE_PTR dwReserv
ed, |
46 » » IInternetProtocol* pTargetProtocol); | 49 » » IInternetProtocol* pTargetProtocol, bool& handled); |
47 » HRESULT Read(void *pv, ULONG cb, ULONG* pcbRead); | 50 » HRESULT OnRead(void *pv, ULONG cb, ULONG* pcbRead); |
48 | 51 |
49 STDMETHODIMP ReportProgress( | 52 STDMETHODIMP ReportProgress( |
50 /* [in] */ ULONG ulStatusCode, | 53 /* [in] */ ULONG ulStatusCode, |
51 /* [in] */ LPCWSTR szStatusText); | 54 /* [in] */ LPCWSTR szStatusText); |
52 | 55 |
| 56 STDMETHODIMP ReportResult( |
| 57 /* [in] */ HRESULT hrResult, |
| 58 /* [in] */ DWORD dwError, |
| 59 /* [in] */ LPCWSTR szResult); |
| 60 |
53 STDMETHODIMP Switch( | 61 STDMETHODIMP Switch( |
54 /* [in] */ PROTOCOLDATA *pProtocolData); | 62 /* [in] */ PROTOCOLDATA *pProtocolData); |
55 }; | 63 }; |
56 | 64 |
57 class WBPassthru; | 65 class WBPassthru; |
58 typedef PassthroughAPP::CustomSinkStartPolicy<WBPassthru, WBPassthruSink> WBStar
tPolicy; | 66 typedef PassthroughAPP::CustomSinkStartPolicy<WBPassthru, WBPassthruSink> WBStar
tPolicy; |
59 | 67 |
60 class WBPassthru : public PassthroughAPP::CInternetProtocol<WBStartPolicy> | 68 class WBPassthru : public PassthroughAPP::CInternetProtocol<WBStartPolicy> |
61 { | 69 { |
| 70 typedef PassthroughAPP::CInternetProtocol<WBStartPolicy> BaseClass; |
62 public: | 71 public: |
| 72 WBPassthru(); |
63 // IInternetProtocolRoot | 73 // IInternetProtocolRoot |
64 STDMETHODIMP Start(LPCWSTR szUrl, IInternetProtocolSink *pOIProtSink, | 74 STDMETHODIMP Start(LPCWSTR szUrl, IInternetProtocolSink *pOIProtSink, |
65 IInternetBindInfo *pOIBindInfo, DWORD grfPI, HANDLE_PTR dwReserved); | 75 IInternetBindInfo *pOIBindInfo, DWORD grfPI, HANDLE_PTR dwReserved) override
; |
66 | 76 |
67 //IInternetProtocol | 77 //IInternetProtocol |
68 STDMETHODIMP Read(» /* [in, out] */ void *pv,/* [in] */ ULONG cb,/* [out] */
ULONG *pcbRead); | 78 STDMETHODIMP Read(/* [in, out] */ void *pv,/* [in] */ ULONG cb,/* [out] */ ULO
NG *pcbRead) override; |
| 79 |
| 80 STDMETHODIMP LockRequest(/* [in] */ DWORD dwOptions) override; |
| 81 STDMETHODIMP UnlockRequest() override; |
| 82 |
| 83 bool m_shouldSupplyCustomContent; |
| 84 bool m_hasOriginalStartCalled; |
69 }; | 85 }; |
OLD | NEW |