Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
7cc7973
Implement Origin Policy filter (#9771)
JunielKatarn Sep 16, 2022
3e2cdbb
Allow >10MB HTTP downloads (#9957)
JunielKatarn May 20, 2022
26d9ecf
Remove change files
JunielKatarn Sep 16, 2022
ae782ae
Implement Blob module (#9352)
JunielKatarn Sep 16, 2022
f5a3f6d
Use logical OR to assert HTTP responseType (#10095)
JunielKatarn Jun 10, 2022
e4f5e1b
Remove change files
JunielKatarn Sep 16, 2022
eb4e709
Implement HTTP client timeout (#10261)
JunielKatarn Jul 19, 2022
351305f
Remove change files
JunielKatarn Sep 16, 2022
8f7fbbc
Use uint8_t const in IBlobPersistor.h (#10276)
rozele Jul 23, 2022
55c280e
Remove change files
JunielKatarn Sep 16, 2022
3c03c87
Adds missing headers for HttpRequestHeaderCollection (#10277)
rozele Aug 15, 2022
62b7151
Remove change files
JunielKatarn Sep 16, 2022
e6961f6
Skip user agent HTTP header validation (#10279)
rozele Aug 15, 2022
c178140
Remove change files
JunielKatarn Sep 16, 2022
b0b1015
Implement HTTP redirection (#10534)
JunielKatarn Sep 16, 2022
5f8c7e1
Change files
JunielKatarn Sep 16, 2022
0cf1e76
Fix merge errors
JunielKatarn Sep 16, 2022
9af6751
clang format
JunielKatarn Sep 16, 2022
d6c1318
Use global.FileReader
JunielKatarn Sep 17, 2022
748268b
Remove duplicate JS override
JunielKatarn Sep 17, 2022
572b374
Enable Blob module in UWP (#10187)
JunielKatarn Jun 26, 2022
0c4c802
Merge branch 'cors-redir-68' of github.com:jurocha-ms/react-native-wi…
JunielKatarn Sep 17, 2022
5c9b4e9
clang format
JunielKatarn Sep 17, 2022
1f694b5
Revert unwanted changes
JunielKatarn Sep 17, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "Implement HTTP redirection (#10534)",
"packageName": "react-native-windows",
"email": "julio.rocha@microsoft.com",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@
<Import Project="$(ReactNativeWindowsDir)\PropertySheets\External\Microsoft.ReactNative.Uwp.CSharpApp.props" Condition="Exists('$(ReactNativeWindowsDir)\PropertySheets\External\Microsoft.ReactNative.Uwp.CSharpApp.props')" />
</ImportGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform">
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform">
<Version>6.2.9</Version>
</PackageReference>
<PackageReference Include="XamlTreeDump">
Expand All @@ -165,4 +165,4 @@
<Error Condition="!Exists('$(ReactNativeWindowsDir)\PropertySheets\External\Microsoft.ReactNative.Uwp.CSharpApp.props')" Text="$([System.String]::Format('$(ErrorText)', '$(ReactNativeWindowsDir)\PropertySheets\External\Microsoft.ReactNative.Uwp.CSharpApp.props'))" />
<Error Condition="!Exists('$(ReactNativeWindowsDir)\PropertySheets\External\Microsoft.ReactNative.Uwp.CSharpApp.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(ReactNativeWindowsDir)\PropertySheets\External\Microsoft.ReactNative.Uwp.CSharpApp.targets'))" />
</Target>
</Project>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ using namespace Microsoft::VisualStudio::CppUnitTestFramework;

namespace http = boost::beast::http;

using folly::dynamic;
using Microsoft::React::Networking::IHttpResource;
using Microsoft::React::Networking::OriginPolicy;
using std::make_shared;
Expand Down Expand Up @@ -82,7 +83,8 @@ TEST_CLASS(HttpOriginPolicyIntegrationTest)

auto reqHandler = [&serverArgs](const DynamicRequest& request) -> ResponseWrapper
{
return { std::move(serverArgs.Response) };
// Don't use move constructor in case of multiple requests
return { serverArgs.Response };
};

switch (clientArgs.Method)
Expand Down Expand Up @@ -133,7 +135,7 @@ TEST_CLASS(HttpOriginPolicyIntegrationTest)
clientArgs.ResponseContent = std::move(content);
clientArgs.ContentPromise.set_value();
});
resource->SetOnError([&clientArgs](int64_t, string&& message)
resource->SetOnError([&clientArgs](int64_t, string&& message, bool)
{
clientArgs.ErrorMessage = std::move(message);
clientArgs.ContentPromise.set_value();
Expand All @@ -144,10 +146,10 @@ TEST_CLASS(HttpOriginPolicyIntegrationTest)
string{server1Args.Url},
0, /*requestId*/
std::move(clientArgs.RequestHeaders),
{}, /*data*/
dynamic::object("string", ""), /*data*/
"text",
false, /*useIncrementalUpdates*/
1000, /*timeout*/
0, /*timeout*/
clientArgs.WithCredentials, /*withCredentials*/
[](int64_t){} /*reactCallback*/
);
Expand Down Expand Up @@ -187,7 +189,7 @@ TEST_CLASS(HttpOriginPolicyIntegrationTest)
clientArgs.ResponseContent = std::move(content);
clientArgs.ContentPromise.set_value();
});
resource->SetOnError([&clientArgs](int64_t, string&& message)
resource->SetOnError([&clientArgs](int64_t, string&& message, bool)
{
clientArgs.ErrorMessage = std::move(message);
clientArgs.ContentPromise.set_value();
Expand All @@ -198,10 +200,10 @@ TEST_CLASS(HttpOriginPolicyIntegrationTest)
string{serverArgs.Url},
0, /*requestId*/
std::move(clientArgs.RequestHeaders),
{}, /*data*/
dynamic::object("string", ""), /*data*/
"text",
false, /*useIncrementalUpdates*/
1000, /*timeout*/
0, /*timeout*/
clientArgs.WithCredentials, /*withCredentials*/
[](int64_t) {} /*reactCallback*/
);
Expand All @@ -223,16 +225,16 @@ TEST_CLASS(HttpOriginPolicyIntegrationTest)

TEST_METHOD_CLEANUP(MethodCleanup)
{
// Clear any runtime options that may be used by tests in this class.
SetRuntimeOptionInt("Http.OriginPolicy", static_cast<int32_t>(OriginPolicy::None));
SetRuntimeOptionString("Http.GlobalOrigin", {});
SetRuntimeOptionBool("Http.OmitCredentials", false);

// Bug in HttpServer does not correctly release TCP port between test methods.
// Using a different por per test for now.
s_port++;
}

//TODO: NoCors_InvalidMethod_Failed?

BEGIN_TEST_METHOD_ATTRIBUTE(NoCorsForbiddenMethodSucceeds)
// CONNECT, TRACE, and TRACK methods not supported by Windows.Web.Http
// https://docs.microsoft.com/en-us/uwp/api/windows.web.http.httpmethod?view=winrt-19041#properties
Expand Down Expand Up @@ -283,7 +285,7 @@ TEST_CLASS(HttpOriginPolicyIntegrationTest)
getContent = std::move(content);
getDataPromise.set_value();
});
resource->SetOnError([&server, &error, &getDataPromise](int64_t, string&& message)
resource->SetOnError([&server, &error, &getDataPromise](int64_t, string&& message, bool)
{
error = std::move(message);
getDataPromise.set_value();
Expand All @@ -296,11 +298,10 @@ TEST_CLASS(HttpOriginPolicyIntegrationTest)
{
{"ValidHeader", "AnyValue"}
},
{}, /*data*/
//{} /*bodyData*/,
dynamic::object("string", ""), /*data*/
"text",
false /*useIncrementalUpdates*/,
1000 /*timeout*/,
0 /*timeout*/,
false /*withCredentials*/,
[](int64_t) {} /*callback*/
);
Expand All @@ -324,6 +325,7 @@ TEST_CLASS(HttpOriginPolicyIntegrationTest)

SetRuntimeOptionString("Http.GlobalOrigin", s_crossOriginUrl);
SetRuntimeOptionInt("Http.OriginPolicy", static_cast<int32_t>(OriginPolicy::SimpleCrossOriginResourceSharing));

TestOriginPolicy(serverArgs, clientArgs, s_shouldFail);
}// SimpleCorsForbiddenMethodFails

Expand All @@ -344,8 +346,6 @@ TEST_CLASS(HttpOriginPolicyIntegrationTest)
TestOriginPolicy(serverArgs, clientArgs, true /*shouldSucceed*/);
}// NoCorsCrossOriginFetchRequestSucceeds

//NoCors_CrossOriginFetchRequestWithTimeout_Succeeded //TODO: Implement timeout

BEGIN_TEST_METHOD_ATTRIBUTE(NoCorsCrossOriginPatchSucceededs)
END_TEST_METHOD_ATTRIBUTE()
TEST_METHOD(NoCorsCrossOriginPatchSucceededs)
Expand Down Expand Up @@ -377,6 +377,7 @@ TEST_CLASS(HttpOriginPolicyIntegrationTest)

SetRuntimeOptionString("Http.GlobalOrigin", serverArgs.Url.c_str());
SetRuntimeOptionInt("Http.OriginPolicy", static_cast<int32_t>(OriginPolicy::SimpleCrossOriginResourceSharing));

TestOriginPolicy(serverArgs, clientArgs, true /*shouldSucceed*/);
}// SimpleCorsSameOriginSucceededs

Expand All @@ -390,6 +391,7 @@ TEST_CLASS(HttpOriginPolicyIntegrationTest)

SetRuntimeOptionString("Http.GlobalOrigin", s_crossOriginUrl);
SetRuntimeOptionInt("Http.OriginPolicy", static_cast<int32_t>(OriginPolicy::SimpleCrossOriginResourceSharing));

TestOriginPolicy(serverArgs, clientArgs, s_shouldFail);
}// SimpleCorsCrossOriginFetchFails

Expand All @@ -404,6 +406,7 @@ TEST_CLASS(HttpOriginPolicyIntegrationTest)

SetRuntimeOptionString("Http.GlobalOrigin", serverArgs.Url.c_str());
SetRuntimeOptionInt("Http.OriginPolicy", static_cast<int32_t>(OriginPolicy::CrossOriginResourceSharing));

TestOriginPolicy(serverArgs, clientArgs, true /*shouldSucceed*/);
}// FullCorsSameOriginRequestSucceeds

Expand Down Expand Up @@ -669,9 +672,6 @@ TEST_CLASS(HttpOriginPolicyIntegrationTest)
} // FullCorsCrossOriginToAnotherCrossOriginRedirectSucceeds

BEGIN_TEST_METHOD_ATTRIBUTE(FullCorsCrossOriginToAnotherCrossOriginRedirectWithPreflightSucceeds)
// [0x80072f88] The HTTP redirect request must be confirmed by the user
//TODO: Figure out manual redirection.
TEST_IGNORE()
END_TEST_METHOD_ATTRIBUTE()
TEST_METHOD(FullCorsCrossOriginToAnotherCrossOriginRedirectWithPreflightSucceeds)
{
Expand Down Expand Up @@ -763,8 +763,6 @@ TEST_CLASS(HttpOriginPolicyIntegrationTest)
// The current implementation omits withCredentials flag from request and always sets it to false
// Configure the responses for CORS request
BEGIN_TEST_METHOD_ATTRIBUTE(FullCorsCrossOriginWithCredentialsSucceeds)
//TODO: Fails if run after FullCorsCrossOriginWithCredentialsFails
TEST_IGNORE()
END_TEST_METHOD_ATTRIBUTE()
TEST_METHOD(FullCorsCrossOriginWithCredentialsSucceeds)
{
Expand Down Expand Up @@ -823,15 +821,6 @@ TEST_CLASS(HttpOriginPolicyIntegrationTest)

TestOriginPolicy(serverArgs, clientArgs, s_shouldFail);
}// RequestWithProxyAuthorizationHeaderFails

BEGIN_TEST_METHOD_ATTRIBUTE(ExceedingRedirectLimitFails)
TEST_IGNORE()
END_TEST_METHOD_ATTRIBUTE()
TEST_METHOD(ExceedingRedirectLimitFails)
{
Assert::Fail(L"NOT IMPLEMENTED");
}// ExceedingRedirectLimitFails

};

uint16_t HttpOriginPolicyIntegrationTest::s_port = 7777;
Expand Down
Loading