react-native-windows 0.70.0 → 0.70.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Microsoft.ReactNative/Pch/pch.h +0 -1
- package/Microsoft.ReactNative/Views/ViewManagerBase.cpp +4 -2
- package/PropertySheets/Generated/PackageVersion.g.props +2 -2
- package/Shared/Modules/HttpModule.cpp +4 -2
- package/Shared/Networking/IHttpResource.h +1 -1
- package/Shared/Networking/IRedirectEventSource.h +18 -0
- package/Shared/Networking/IWinRTHttpRequestFactory.h +22 -0
- package/Shared/Networking/OriginPolicyHttpFilter.cpp +47 -16
- package/Shared/Networking/OriginPolicyHttpFilter.h +16 -3
- package/Shared/Networking/RedirectHttpFilter.cpp +283 -0
- package/Shared/Networking/RedirectHttpFilter.h +97 -0
- package/Shared/Networking/WinRTHttpResource.cpp +207 -154
- package/Shared/Networking/WinRTHttpResource.h +17 -4
- package/Shared/Shared.vcxitems +4 -0
- package/Shared/Shared.vcxitems.filters +12 -0
- package/package.json +1 -1
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
#include "IHttpResource.h"
|
|
7
7
|
|
|
8
8
|
#include <Modules/IHttpModuleProxy.h>
|
|
9
|
+
#include "IWinRTHttpRequestFactory.h"
|
|
9
10
|
#include "WinRTTypes.h"
|
|
10
11
|
|
|
11
12
|
// Windows API
|
|
@@ -18,6 +19,7 @@ namespace Microsoft::React::Networking {
|
|
|
18
19
|
|
|
19
20
|
class WinRTHttpResource : public IHttpResource,
|
|
20
21
|
public IHttpModuleProxy,
|
|
22
|
+
public IWinRTHttpRequestFactory,
|
|
21
23
|
public std::enable_shared_from_this<WinRTHttpResource> {
|
|
22
24
|
winrt::Windows::Web::Http::IHttpClient m_client;
|
|
23
25
|
std::mutex m_mutex;
|
|
@@ -27,7 +29,7 @@ class WinRTHttpResource : public IHttpResource,
|
|
|
27
29
|
std::function<void(int64_t requestId, Response &&response)> m_onResponse;
|
|
28
30
|
std::function<void(int64_t requestId, std::string &&responseData)> m_onData;
|
|
29
31
|
std::function<void(int64_t requestId, folly::dynamic &&responseData)> m_onDataDynamic;
|
|
30
|
-
std::function<void(int64_t requestId, std::string &&errorMessage
|
|
32
|
+
std::function<void(int64_t requestId, std::string &&errorMessage, bool isTimeout)> m_onError;
|
|
31
33
|
|
|
32
34
|
// Used for IHttpModuleProxy
|
|
33
35
|
std::weak_ptr<IUriHandler> m_uriHandler;
|
|
@@ -39,7 +41,8 @@ class WinRTHttpResource : public IHttpResource,
|
|
|
39
41
|
void UntrackResponse(int64_t requestId) noexcept;
|
|
40
42
|
|
|
41
43
|
winrt::fire_and_forget PerformSendRequest(
|
|
42
|
-
winrt::Windows::Web::Http::
|
|
44
|
+
winrt::Windows::Web::Http::HttpMethod &&method,
|
|
45
|
+
winrt::Windows::Foundation::Uri &&uri,
|
|
43
46
|
winrt::Windows::Foundation::IInspectable const &args) noexcept;
|
|
44
47
|
|
|
45
48
|
public:
|
|
@@ -47,6 +50,16 @@ class WinRTHttpResource : public IHttpResource,
|
|
|
47
50
|
|
|
48
51
|
WinRTHttpResource(winrt::Windows::Web::Http::IHttpClient &&client) noexcept;
|
|
49
52
|
|
|
53
|
+
#pragma region IWinRTHttpRequestFactory
|
|
54
|
+
|
|
55
|
+
winrt::Windows::Foundation::IAsyncOperation<winrt::Windows::Web::Http::HttpRequestMessage> CreateRequest(
|
|
56
|
+
winrt::Windows::Web::Http::HttpMethod &&method,
|
|
57
|
+
winrt::Windows::Foundation::Uri &&uri,
|
|
58
|
+
winrt::Windows::Foundation::Collections::IMap<winrt::hstring, winrt::Windows::Foundation::IInspectable>
|
|
59
|
+
props) noexcept override;
|
|
60
|
+
|
|
61
|
+
#pragma endregion IWinRTHttpRequestFactory
|
|
62
|
+
|
|
50
63
|
#pragma region IHttpResource
|
|
51
64
|
|
|
52
65
|
void SendRequest(
|
|
@@ -67,8 +80,8 @@ class WinRTHttpResource : public IHttpResource,
|
|
|
67
80
|
void SetOnResponse(std::function<void(int64_t requestId, Response &&response)> &&handler) noexcept override;
|
|
68
81
|
void SetOnData(std::function<void(int64_t requestId, std::string &&responseData)> &&handler) noexcept override;
|
|
69
82
|
void SetOnData(std::function<void(int64_t requestId, folly::dynamic &&responseData)> &&handler) noexcept override;
|
|
70
|
-
void SetOnError(
|
|
71
|
-
|
|
83
|
+
void SetOnError(
|
|
84
|
+
std::function<void(int64_t requestId, std::string &&errorMessage, bool isTimeout)> &&handler) noexcept override;
|
|
72
85
|
|
|
73
86
|
#pragma endregion IHttpResource
|
|
74
87
|
|
package/Shared/Shared.vcxitems
CHANGED
|
@@ -56,6 +56,7 @@
|
|
|
56
56
|
<ClCompile Include="$(MSBuildThisFileDirectory)Modules\StatusBarManagerModule.cpp" />
|
|
57
57
|
<ClCompile Include="$(MSBuildThisFileDirectory)Modules\WebSocketModule.cpp" />
|
|
58
58
|
<ClCompile Include="$(MSBuildThisFileDirectory)Networking\OriginPolicyHttpFilter.cpp" />
|
|
59
|
+
<ClCompile Include="$(MSBuildThisFileDirectory)Networking\RedirectHttpFilter.cpp" />
|
|
59
60
|
<ClCompile Include="$(MSBuildThisFileDirectory)Networking\WinRTHttpResource.cpp" />
|
|
60
61
|
<ClCompile Include="$(MSBuildThisFileDirectory)Networking\WinRTWebSocketResource.cpp" />
|
|
61
62
|
<ClCompile Include="$(MSBuildThisFileDirectory)OInstance.cpp" />
|
|
@@ -103,9 +104,12 @@
|
|
|
103
104
|
<ClInclude Include="$(MSBuildThisFileDirectory)Modules\HttpModule.h" />
|
|
104
105
|
<ClInclude Include="$(MSBuildThisFileDirectory)Modules\NetworkingModule.h" />
|
|
105
106
|
<ClInclude Include="$(MSBuildThisFileDirectory)Networking\IHttpResource.h" />
|
|
107
|
+
<ClInclude Include="$(MSBuildThisFileDirectory)Networking\IRedirectEventSource.h" />
|
|
106
108
|
<ClInclude Include="$(MSBuildThisFileDirectory)Networking\IWebSocketResource.h" />
|
|
109
|
+
<ClInclude Include="$(MSBuildThisFileDirectory)Networking\IWinRTHttpRequestFactory.h" />
|
|
107
110
|
<ClInclude Include="$(MSBuildThisFileDirectory)Networking\OriginPolicy.h" />
|
|
108
111
|
<ClInclude Include="$(MSBuildThisFileDirectory)Networking\OriginPolicyHttpFilter.h" />
|
|
112
|
+
<ClInclude Include="$(MSBuildThisFileDirectory)Networking\RedirectHttpFilter.h" />
|
|
109
113
|
<ClInclude Include="$(MSBuildThisFileDirectory)Networking\WinRTHttpResource.h" />
|
|
110
114
|
<ClInclude Include="$(MSBuildThisFileDirectory)Networking\WinRTTypes.h" />
|
|
111
115
|
<ClInclude Include="$(MSBuildThisFileDirectory)Networking\WinRTWebSocketResource.h" />
|
|
@@ -152,6 +152,9 @@
|
|
|
152
152
|
<ClCompile Include="$(MSBuildThisFileDirectory)Modules\FileReaderModule.cpp">
|
|
153
153
|
<Filter>Source Files\Modules</Filter>
|
|
154
154
|
</ClCompile>
|
|
155
|
+
<ClCompile Include="$(MSBuildThisFileDirectory)Networking\RedirectHttpFilter.cpp">
|
|
156
|
+
<Filter>Source Files\Networking</Filter>
|
|
157
|
+
</ClCompile>
|
|
155
158
|
</ItemGroup>
|
|
156
159
|
<ItemGroup>
|
|
157
160
|
<Filter Include="Source Files">
|
|
@@ -457,6 +460,15 @@
|
|
|
457
460
|
<ClInclude Include="$(MSBuildThisFileDirectory)Modules\FileReaderModule.h">
|
|
458
461
|
<Filter>Header Files\Modules</Filter>
|
|
459
462
|
</ClInclude>
|
|
463
|
+
<ClInclude Include="$(MSBuildThisFileDirectory)Networking\RedirectHttpFilter.h">
|
|
464
|
+
<Filter>Header Files\Networking</Filter>
|
|
465
|
+
</ClInclude>
|
|
466
|
+
<ClInclude Include="$(MSBuildThisFileDirectory)Networking\IWinRTHttpRequestFactory.h">
|
|
467
|
+
<Filter>Header Files\Networking</Filter>
|
|
468
|
+
</ClInclude>
|
|
469
|
+
<ClInclude Include="$(MSBuildThisFileDirectory)Networking\IRedirectEventSource.h">
|
|
470
|
+
<Filter>Header Files\Networking</Filter>
|
|
471
|
+
</ClInclude>
|
|
460
472
|
</ItemGroup>
|
|
461
473
|
<ItemGroup>
|
|
462
474
|
<None Include="$(MSBuildThisFileDirectory)tracing\rnw.wprp">
|