Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
9dffac7
Allow >10MB HTTP downloads (#9957)
JunielKatarn May 20, 2022
87f358c
Implement Blob module (#9352)
JunielKatarn May 21, 2022
0c98789
Remove change file
JunielKatarn Dec 7, 2022
b43f2d7
Use logical OR to assert HTTP responseType (#10095)
JunielKatarn Jun 10, 2022
912d248
Remove change file
JunielKatarn Dec 7, 2022
14fb864
Implement HTTP client timeout (#10261)
JunielKatarn Jul 19, 2022
3749f13
Remove change file
JunielKatarn Dec 7, 2022
7e8bff3
Use uint8_t const in IBlobPersistor.h (#10276)
rozele Jul 23, 2022
77d5812
Remove change file
JunielKatarn Dec 7, 2022
a9ecf4e
Adds missing headers for HttpRequestHeaderCollection (#10277)
rozele Aug 15, 2022
e4fb0ca
Remove change file
JunielKatarn Dec 7, 2022
8b2e1f9
Skip user agent HTTP header validation (#10279)
rozele Aug 15, 2022
532bdea
Remove change file
JunielKatarn Dec 7, 2022
60501c8
Implement HTTP redirection (#10534)
JunielKatarn Sep 16, 2022
fd68cb8
Remove change file
JunielKatarn Dec 7, 2022
0ab5cb2
Implement Form Data requests (#10797)
JunielKatarn Nov 7, 2022
b2d6fcf
Remove change file
JunielKatarn Dec 7, 2022
c68ba3f
Allow >10MB content for blob responses (#10885)
JunielKatarn Nov 16, 2022
37d63cb
Remove change file
JunielKatarn Dec 7, 2022
b375b21
Implement HTTP incremental updates (#10933)
JunielKatarn Dec 7, 2022
b69eeea
Remove change file
JunielKatarn Dec 7, 2022
8c52692
clang format
JunielKatarn Dec 7, 2022
8e8d730
Reset fles
JunielKatarn Dec 7, 2022
dd07d6e
Set User-Agent header in Origin Policy filter (#10695)
JunielKatarn Oct 7, 2022
f17d42d
Remove change file
JunielKatarn Dec 7, 2022
f4540ef
Fix OInstance.h
JunielKatarn Dec 7, 2022
1bb2c96
Always instantiate Blob module in UWP (#10848)
JunielKatarn Nov 14, 2022
7c754d6
Remove change file
JunielKatarn Dec 7, 2022
72ff282
Fix CoreNativeModules.cpp
JunielKatarn Dec 7, 2022
2ff49bb
Revert OP integration tests
JunielKatarn Dec 7, 2022
1178d9d
clang format
JunielKatarn Dec 7, 2022
595e5ad
format oinstance
JunielKatarn Dec 7, 2022
25adced
format oinstance
JunielKatarn Dec 7, 2022
2d71387
Remove Monolithic module usage
JunielKatarn Dec 7, 2022
598326e
Remove Monolithic module usage
JunielKatarn Dec 7, 2022
51897b4
Add pre/post build compliance templates and address PoliCheck issues …
JunielKatarn Dec 7, 2022
47fb229
Fix OP filter
JunielKatarn Dec 7, 2022
9041bf6
Fix FileReader
JunielKatarn Dec 7, 2022
a3a7b0a
Adds header to fix clang build in FileReaderModule (#10329)
rozele Jul 28, 2022
c24b4ad
Remove change file
JunielKatarn Dec 7, 2022
99b5db4
Fix blob module
JunielKatarn Dec 7, 2022
3a5f561
Fix format
JunielKatarn Dec 7, 2022
0916e82
Fix overrides
JunielKatarn Dec 7, 2022
a13a21c
Fix HTTPRc
JunielKatarn Dec 7, 2022
25220f4
Fix tests
JunielKatarn Dec 7, 2022
34fccb7
Merge branch '0.69-stable' of github.com:microsoft/react-native-windo…
JunielKatarn Dec 10, 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
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"**/lib/**/*.js": true,
"**/dist/**/*.js": true
},
"editor.formatOnSave": true,
"editor.formatOnSave": false,
"eslint.format.enable": true,
"eslint.packageManager": "yarn",
"eslint.enable": true,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "prerelease",
"comment": "Allow fetching HTTP content by segments",
"packageName": "react-native-windows",
"email": "julio.rocha@microsoft.com",
"dependentChangeType": "patch"
}
10 changes: 9 additions & 1 deletion packages/@react-native-windows/tester/overrides.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@
"baseHash": "a1d1c6638e815f6dd53504983813fda92f3b5478",
"issue": 6341
},
{
"type": "platform",
"file": "src/js/examples/HTTP/HTTPExample.js"
},
{
"type": "platform",
"file": "src/js/examples/HTTP/HTTPExampleMultiPartFormData.js"
},
{
"type": "patch",
"file": "src/js/examples/Pressable/PressableExample.windows.js",
Expand Down Expand Up @@ -48,4 +56,4 @@
"baseHash": "d12b4947135ada2dcb1c68835f53d7f0beff8a4e"
}
]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/**
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* @flow
* @format
*/
'use strict';

const React = require('react');
const HTTPExampleMultiPartFormData = require('./HTTPExampleMultiPartFormData');
const XHRExampleFetch = require('../XHR/XHRExampleFetch');

exports.framework = 'React';
exports.title = 'HTTP';
exports.category = 'Basic';
exports.description =
('Example that demonstrates direct and indirect HTTP native module usage.': string);
exports.examples = [
{
title: 'multipart/form-data POST',
render(): React.Node {
return <HTTPExampleMultiPartFormData />;
},
},
{
title: 'Fetch Test',
render(): React.Node {
return <XHRExampleFetch />;
},
},
];
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
/**
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* @flow
* @format
*/
'use strict';

const React = require('react');

const {StyleSheet, Text, TextInput, View} = require('react-native');

/**
* See https://www.w3schools.com/php/php_form_validation.asp
*/
class HTTPExampleMultiPartFormData extends React.Component<any, any> {
responseURL: ?string;
responseHeaders: ?Object;

constructor(props: any) {
super(props);
this.state = {
responseText: null,
};
this.responseURL = null;
this.responseHeaders = null;
}

submit(uri: string) {
const formData = new FormData();

formData.append('name', {
string: 'Name',
type: 'application/text',
});
formData.append('email', {
string: 'me@mail.com',
type: 'application/text',
});
formData.append('website', {
string: 'http://aweb.com',
type: 'application/text',
});
formData.append('comment', {
string: 'Hello',
type: 'application/text',
});
formData.append('gender', {
string: 'Other',
type: 'application/text',
});

fetch(uri, {
method: 'POST',
headers: {
'Content-Type': 'multipart/form-data',
},
body: formData,
})
.then(response => {
this.responseURL = response.url;
this.responseHeaders = response.headers;

return response.text();
})
.then(body => {
this.setState({responseText: body});
});
}

_renderHeaders(): null | Array<React.Node> {
if (!this.responseHeaders) {
return null;
}

const responseHeaders = [];
const keys = Object.keys(this.responseHeaders.map);
for (let i = 0; i < keys.length; i++) {
const key = keys[i];
// $FlowFixMe[incompatible-use]
const value = this.responseHeaders.get(key);
responseHeaders.push(
<Text>
{key}: {value}
</Text>,
);
}
return responseHeaders;
}

render(): React.Node {
const responseURL = this.responseURL ? (
<View style={{marginTop: 10}}>
<Text style={styles.label}>Server response URL:</Text>
<Text>{this.responseURL}</Text>
</View>
) : null;

const responseHeaders = this.responseHeaders ? (
<View style={{marginTop: 10}}>
<Text style={styles.label}>Server response headers:</Text>
{this._renderHeaders()}
</View>
) : null;

const response = this.state.responseText ? (
<View style={{marginTop: 10}}>
<Text style={styles.label}>Server response:</Text>
<TextInput
editable={false}
multiline={true}
defaultValue={this.state.responseText}
style={styles.textOutput}
/>
</View>
) : null;

return (
<View>
<Text style={styles.label}>Edit URL to submit:</Text>
<TextInput
returnKeyType="go"
defaultValue="https://tryphp.w3schools.com/demo/demo_form_validation_complete.php"
onSubmitEditing={event => {
this.submit(event.nativeEvent.text);
}}
style={styles.textInput}
/>
{responseURL}
{responseHeaders}
{response}
</View>
);
}
}

const styles = StyleSheet.create({
textInput: {
flex: 1,
borderRadius: 3,
borderColor: 'grey',
borderWidth: 1,
height: 30,
paddingLeft: 8,
},
label: {
flex: 1,
color: '#aaa',
fontWeight: '500',
height: 20,
},
textOutput: {
flex: 1,
fontSize: 17,
borderRadius: 3,
borderColor: 'grey',
borderWidth: 1,
height: 200,
paddingLeft: 8,
},
});

module.exports = HTTPExampleMultiPartFormData;
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ import type {RNTesterModuleInfo} from '../types/RNTesterTypes';
import ReactNativeFeatureFlags from 'react-native/Libraries/ReactNative/ReactNativeFeatureFlags';

const Components: Array<RNTesterModuleInfo> = [
{
key: 'HTTPExample',
module: require('../examples/HTTP/HTTPExample'),
},
{
key: 'XHRExample',
module: require('../examples/XHR/XHRExample'),
},
{
key: 'ActivityIndicatorExample',
category: 'UI',
Expand Down
1 change: 0 additions & 1 deletion vnext/Desktop.DLL/react-native-win32.x64.def
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ EXPORTS
?makeChakraRuntime@JSI@Microsoft@@YA?AV?$unique_ptr@VRuntime@jsi@facebook@@U?$default_delete@VRuntime@jsi@facebook@@@std@@@std@@$$QEAUChakraRuntimeArgs@12@@Z
?Make@IHttpResource@Networking@React@Microsoft@@SA?AV?$shared_ptr@UIHttpResource@Networking@React@Microsoft@@@std@@XZ
?CreateTimingModule@react@facebook@@YA?AV?$unique_ptr@VCxxModule@module@xplat@facebook@@U?$default_delete@VCxxModule@module@xplat@facebook@@@std@@@std@@AEBV?$shared_ptr@VMessageQueueThread@react@facebook@@@4@@Z
??0NetworkingModule@React@Microsoft@@QEAA@XZ
?MakeJSQueueThread@ReactNative@Microsoft@@YA?AV?$shared_ptr@VMessageQueueThread@react@facebook@@@std@@XZ
?Hash128@SpookyHashV2@hash@folly@@SAXPEBX_KPEA_K2@Z
??1Instance@react@facebook@@QEAA@XZ
Expand Down
1 change: 0 additions & 1 deletion vnext/Desktop.DLL/react-native-win32.x86.def
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ EXPORTS
?makeChakraRuntime@JSI@Microsoft@@YG?AV?$unique_ptr@VRuntime@jsi@facebook@@U?$default_delete@VRuntime@jsi@facebook@@@std@@@std@@$$QAUChakraRuntimeArgs@12@@Z
?CreateTimingModule@react@facebook@@YG?AV?$unique_ptr@VCxxModule@module@xplat@facebook@@U?$default_delete@VCxxModule@module@xplat@facebook@@@std@@@std@@ABV?$shared_ptr@VMessageQueueThread@react@facebook@@@4@@Z
?Make@IHttpResource@Networking@React@Microsoft@@SG?AV?$shared_ptr@UIHttpResource@Networking@React@Microsoft@@@std@@XZ
??0NetworkingModule@React@Microsoft@@QAE@XZ
?MakeJSQueueThread@ReactNative@Microsoft@@YG?AV?$shared_ptr@VMessageQueueThread@react@facebook@@@std@@XZ
?Hash128@SpookyHashV2@hash@folly@@SGXPBXIPA_K1@Z
?assertionFailure@detail@folly@@YGXPBD00I0H@Z
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ TEST_MODULE_INITIALIZE(InitModule) {

SetRuntimeOptionBool("WebSocket.AcceptSelfSigned", true);
SetRuntimeOptionBool("UseBeastWebSocket", false);
SetRuntimeOptionBool("Http.UseMonolithicModule", false);
SetRuntimeOptionBool("Blob.EnableModule", true);

// WebSocketJSExecutor can't register native log hooks.
Expand Down
31 changes: 9 additions & 22 deletions vnext/Microsoft.ReactNative/Base/CoreNativeModules.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,8 @@

namespace Microsoft::ReactNative {

using winrt::Microsoft::ReactNative::ReactPropertyBag;

namespace {

using winrt::Microsoft::ReactNative::ReactPropertyId;

bool HasPackageIdentity() noexcept {
static const bool hasPackageIdentity = []() noexcept {
auto packageStatics = winrt::get_activation_factory<winrt::Windows::ApplicationModel::IPackageStatics>(
Expand All @@ -39,13 +35,6 @@ bool HasPackageIdentity() noexcept {
return hasPackageIdentity;
}

ReactPropertyId<bool> HttpUseMonolithicModuleProperty() noexcept {
static ReactPropertyId<bool> propId{
L"ReactNative.Http"
L"UseMonolithicModule"};
return propId;
}

} // namespace

std::vector<facebook::react::NativeModuleDescription> GetCoreModules(
Expand All @@ -61,17 +50,15 @@ std::vector<facebook::react::NativeModuleDescription> GetCoreModules(
[props = context->Properties()]() { return Microsoft::React::CreateHttpModule(props); },
jsMessageQueue);

if (!ReactPropertyBag(context->Properties()).Get(HttpUseMonolithicModuleProperty())) {
modules.emplace_back(
Microsoft::React::GetBlobModuleName(),
[props = context->Properties()]() { return Microsoft::React::CreateBlobModule(props); },
batchingUIMessageQueue);

modules.emplace_back(
Microsoft::React::GetFileReaderModuleName(),
[props = context->Properties()]() { return Microsoft::React::CreateFileReaderModule(props); },
batchingUIMessageQueue);
}
modules.emplace_back(
Microsoft::React::GetBlobModuleName(),
[props = context->Properties()]() { return Microsoft::React::CreateBlobModule(props); },
batchingUIMessageQueue);

modules.emplace_back(
Microsoft::React::GetFileReaderModuleName(),
[props = context->Properties()]() { return Microsoft::React::CreateFileReaderModule(props); },
batchingUIMessageQueue);

modules.emplace_back(
"Timing",
Expand Down
1 change: 1 addition & 0 deletions vnext/Shared/Modules/FileReaderModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "FileReaderModule.h"

#include <ReactPropertyBag.h>
#include <sstream>

// Boost Library
#include <boost/archive/iterators/base64_from_binary.hpp>
Expand Down
Loading