Skip to content

Commit

Permalink
File HTTPExtensions make POST reentrant
Browse files Browse the repository at this point in the history
  • Loading branch information
rajsite committed Jun 28, 2022
1 parent bc48a71 commit fc6860d
Show file tree
Hide file tree
Showing 6 changed files with 822 additions and 520 deletions.
32 changes: 16 additions & 16 deletions File/HTTPExtensions.gcomp/POST Multipart Ex - String.gvi
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<SourceFile Checksum="3399C78CD49CF27B991EEEDCE89F69B325406967FAF9248E2D05EFAB5FF22D3F81316CA37585FA2623BD2E4A773EA0738B41899BB0AA2D0A50E0D9F535DADD3F" Timestamp="1D889B61FD44C58" xmlns="http://www.ni.com/PlatformFramework">
<SourceFile Checksum="88B6D05FACF9EBF83AD1F18E9BFBBBEBD7DE09D47DDA865909FCEB8A2BA1E7577200D32967B79851579EC9CA9673E436190BCA85ABD3FD5256C7789183AE109C" Timestamp="1D88B07D47294E3" xmlns="http://www.ni.com/PlatformFramework">
<SourceModelFeatureSet>
<ParsableNamespace AssemblyFileVersion="9.1.0.50238" FeatureSetName="LabVIEW Controls" Name="http://www.ni.com/Controls.LabVIEW.Design" OldestCompatibleVersion="8.1.0.49152" Version="8.1.0.49152" />
<ParsableNamespace AssemblyFileVersion="9.1.0.50238" FeatureSetName="LabVIEW Virtual Instrument" Name="http://www.ni.com/LabVIEW.VI" OldestCompatibleVersion="8.1.0.49152" Version="8.1.0.49152" />
<ParsableNamespace AssemblyFileVersion="9.1.0.50238" FeatureSetName="Common language components" Name="http://www.ni.com/MocCommon" OldestCompatibleVersion="8.1.0.49152" Version="8.1.0.49152" />
<ParsableNamespace AssemblyFileVersion="9.1.0.50238" FeatureSetName="Editor" Name="http://www.ni.com/PanelCommon" OldestCompatibleVersion="6.1.0.0" Version="6.1.0.49152" />
<ParsableNamespace AssemblyFileVersion="9.1.0.50238" FeatureSetName="Editor" Name="http://www.ni.com/PlatformFramework" OldestCompatibleVersion="8.1.0.49152" Version="8.1.0.49152" />
<ApplicationVersionInfo Build="9.1.0.50238" Name="G Web Development Software" Version="21.0.0" />
<ParsableNamespace AssemblyFileVersion="9.3.0.49613" FeatureSetName="LabVIEW Controls" Name="http://www.ni.com/Controls.LabVIEW.Design" OldestCompatibleVersion="8.1.0.49152" Version="8.1.0.49152" />
<ParsableNamespace AssemblyFileVersion="9.3.0.49613" FeatureSetName="LabVIEW Virtual Instrument" Name="http://www.ni.com/LabVIEW.VI" OldestCompatibleVersion="8.1.0.49152" Version="8.1.0.49152" />
<ParsableNamespace AssemblyFileVersion="9.3.0.49613" FeatureSetName="Common language components" Name="http://www.ni.com/MocCommon" OldestCompatibleVersion="8.1.0.49152" Version="8.1.0.49152" />
<ParsableNamespace AssemblyFileVersion="9.3.0.49613" FeatureSetName="Editor" Name="http://www.ni.com/PanelCommon" OldestCompatibleVersion="6.1.0.0" Version="6.1.0.49152" />
<ParsableNamespace AssemblyFileVersion="9.3.0.49613" FeatureSetName="Editor" Name="http://www.ni.com/PlatformFramework" OldestCompatibleVersion="8.1.0.49152" Version="8.1.0.49152" />
<ApplicationVersionInfo Build="9.3.0.49613" Name="G Web Development Software" Version="22.0.0" />
</SourceModelFeatureSet>
<VirtualInstrument Id="adae695aa1024cf59ef89d11fa486396" xmlns="http://www.ni.com/LabVIEW.VI">
<VirtualInstrument Id="adae695aa1024cf59ef89d11fa486396" Reentrancy="Stateful" xmlns="http://www.ni.com/LabVIEW.VI">
<Icon Id="44d365132a3c459faa220891f91e022d" ListViewIconCrop="0 0 40 40" xmlns="http://www.ni.com/PlatformFramework">
<IconPanel Height="[float]40" Id="a26d8f5a4d1c4b689b6cb9a8aabd0f61" Left="[float]0" PanelSizeMode="Resize" Top="[float]0" Width="[float]40">
<IconTemplate ClipMargin="[SMThickness]3,3,3,3" Height="[float]40" HorizontalAlignment="[HorizontalAlignment]Stretch" Id="e87efbeccff349b686f2ff9caf3891f4" Left="[float]0" TemplateName="[string]GrayNoText" Top="[float]0" VerticalAlignment="[VerticalAlignment]Stretch" Width="[float]40">
Expand Down Expand Up @@ -100,7 +100,7 @@
</NodeLabel>
<FlattenToJson Bounds="1110 540 40 40" Id="f436e360e0e9457686441c51489e7a80" />
<Wire Id="126c88e78f4449599ce441bb8059e334" Joints="N(bf82e6c291c743fca2d5f612d2f84dbe:Value)|(1015,515) h(90) v(30) N(f436e360e0e9457686441c51489e7a80:anything)|(1110,545)" xmlns="http://www.ni.com/PlatformFramework" />
<MethodCall Bounds="1045 540 40 40" Id="2c1ba0f2d9e24441ab14eacca8957586" ResolveFailedHint="&quot;C:\\dev\\GitHub\\webvi-experiments\\File\\HTTPExtensions.gcomp\\Support\\Validate Empty Path.gvi&quot;" Signature="@3790b3ef4d524ca395166dcac30c63cb" Target="HTTPExtensions::Support::Validate Empty Path.gvi" xmlns="http://www.ni.com/MocCommon">
<MethodCall Bounds="1045 540 40 40" Id="2c1ba0f2d9e24441ab14eacca8957586" ResolveFailedHint="&quot;C:\\dev\\github\\webvi-experiments\\File\\HTTPExtensions.gcomp\\Support\\Validate Empty Path.gvi&quot;" Signature="@3790b3ef4d524ca395166dcac30c63cb" Target="HTTPExtensions::Support::Validate Empty Path.gvi" xmlns="http://www.ni.com/MocCommon">
<p.MethodDeclaration>
<MethodDeclaration xmlns="http://www.ni.com/PlatformFramework">
<Parameter Id="L0" Desc="path" />
Expand All @@ -115,7 +115,7 @@
<Wire Id="ecc8d72dda064bd09b8aa6773b06a160" Joints="N(2c1ba0f2d9e24441ab14eacca8957586:R3)|(1085,575) N(f436e360e0e9457686441c51489e7a80:error in (no error\))|(1110,575)" xmlns="http://www.ni.com/PlatformFramework" />
<Wire Id="447071da33034da8b93e01c2b5b90d42" Joints="N(8fc880e1dd5944079edae1d22da5f0a3:Value)|(1015,575) N(2c1ba0f2d9e24441ab14eacca8957586:L3)|(1045,575)" xmlns="http://www.ni.com/PlatformFramework" />
<Wire Id="7a2910fbaeab4e9d9827af9610a8b167" Joints="N(9cdd067e47994ce292d81cba712ed09e:Value)|(1015,545) N(2c1ba0f2d9e24441ab14eacca8957586:L0)|(1045,545)" xmlns="http://www.ni.com/PlatformFramework" />
<MethodCall Bounds="1285 540 40 40" Id="3ec0be8376f04adebe8c6456dcc1db7a" ResolveFailedHint="&quot;C:\\dev\\GitHub\\webvi-experiments\\File\\HTTPExtensions.gcomp\\Support\\Format Post Data.gvi&quot;" Signature="@46e6a02fad184b5cad7a15e222f7b807" Target="HTTPExtensions::Support::Format Post Data.gvi" xmlns="http://www.ni.com/MocCommon">
<MethodCall Bounds="1285 540 40 40" Id="3ec0be8376f04adebe8c6456dcc1db7a" ResolveFailedHint="&quot;C:\\dev\\github\\webvi-experiments\\File\\HTTPExtensions.gcomp\\Support\\Format Post Data.gvi&quot;" Signature="@46e6a02fad184b5cad7a15e222f7b807" Target="HTTPExtensions::Support::Format Post Data.gvi" xmlns="http://www.ni.com/MocCommon">
<p.MethodDeclaration>
<MethodDeclaration xmlns="http://www.ni.com/PlatformFramework">
<Parameter Id="L0" Desc="data" />
Expand Down Expand Up @@ -161,10 +161,10 @@
<Wire Id="240b7f583acf4a7880f7b36c157ab7d9" Joints="N(ab07083a461349aabbfa0e8b7fe6a7e8:Value)|(1260,520) h(90) v(25) N(af4b032f751e4a4ab986972f2ca70050:L3)|(1400,545)" xmlns="http://www.ni.com/PlatformFramework" />
<Wire Id="9c0a305e521e476895e49e131652d1b0" Joints="N(153e33198aee40ecb90c1bcca4982732:Value)|(1260,495) h(100) v(40) N(af4b032f751e4a4ab986972f2ca70050:L2)|(1400,535)" xmlns="http://www.ni.com/PlatformFramework" />
<Wire Id="2c91125360d2490eb6d7266e22d4d4f8" Joints="N(f436e360e0e9457686441c51489e7a80:JSON string)|(1150,545) h(6) v(-70) h(214) v(50) N(af4b032f751e4a4ab986972f2ca70050:L1)|(1400,525)" xmlns="http://www.ni.com/PlatformFramework" />
<MethodCall Bounds="1465 540 40 40" Id="ff55aea7ee81441d9e9e1e7a6093ea1e" ResolveFailedHint="&quot;C:\\dev\\GitHub\\webvi-experiments\\File\\HTTPExtensions.gcomp\\Support\\Handle Response - String.gvi&quot;" Signature="@b2d773a09c0145a08e8618d90350d2c0" Target="HTTPExtensions::Support::Handle Result - String.gvi" xmlns="http://www.ni.com/MocCommon">
<MethodCall Bounds="1465 540 40 40" Id="ff55aea7ee81441d9e9e1e7a6093ea1e" ResolveFailedHint="&quot;C:\\dev\\github\\webvi-experiments\\File\\HTTPExtensions.gcomp\\Support\\Handle Result - String.gvi&quot;" Signature="@795fbe8040d047b8b770d3833cb7e037" Target="HTTPExtensions::Support::Handle Result - String.gvi" xmlns="http://www.ni.com/MocCommon">
<p.MethodDeclaration>
<MethodDeclaration xmlns="http://www.ni.com/PlatformFramework">
<Parameter Id="L0" Desc="http response" />
<Parameter Id="L0" Desc="http result" />
<Parameter Id="L3" Desc="error in" />
<Parameter Id="R0" Desc="status code" />
<Parameter Id="R1" Desc="headers" />
Expand Down Expand Up @@ -411,8 +411,8 @@
</AttributeValues>
</Attributed>
</p.TypeReference>
<p.TypeReference TypeId="b2d773a09c0145a08e8618d90350d2c0">
<Attributed AttributedType="@8a9e2ac1f83a489aae03438f072d15ff">
<p.TypeReference TypeId="795fbe8040d047b8b770d3833cb7e037">
<Attributed AttributedType="@24f0951841984573a1c8111f3beb9418">
<AttributeValues>
<AttributeValue Name="NI.ConnectorPaneHeight" Value="[int]40" />
<AttributeValue Name="NI.ConnectorPaneWidth" Value="[int]40" />
Expand Down Expand Up @@ -549,12 +549,12 @@
</Parameters>
</Function>
</p.TypeReference>
<p.TypeReference TypeId="8a9e2ac1f83a489aae03438f072d15ff">
<p.TypeReference TypeId="24f0951841984573a1c8111f3beb9418">
<Function Id="1" IsStatic="True" IsConstructor="False" Name="Handle Result - String.gvi" ReturnType="Void" GenericTypeDefinition="Void">
<Parameters>
<Attributed AttributedType="@048d2afa24574724ba8ae9fc9cbfaba0">
<AttributeValues>
<AttributeValue Name="NI.UserDefinedName" Value="[string]http response" />
<AttributeValue Name="NI.UserDefinedName" Value="[string]http result" />
</AttributeValues>
</Attributed>
<Attributed AttributedType="@c9d9e4dab77e47f58c733cc1b24a4831">
Expand Down
6 changes: 3 additions & 3 deletions File/HTTPExtensions.gcomp/Support/Format Post Data.gvi
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<SourceFile Checksum="AEE0EE5575EFC9E5F21327B40C18AB09F4C05011F23147E05A8FD2CDCFB1F97CB002776B96F77F302D7FCCAE5CF82510A9C123330512AB9D1E927A25C3F4532A" Timestamp="1D885F79D42C351" xmlns="http://www.ni.com/PlatformFramework">
<SourceFile Checksum="024968A701768C05964A26B10035D724B78C628A153A6C4D1B164C02F164B5BD65E8C08F32A0C72AE5E122CD3C33E0D49C9BC2B762CDEFF764FB77F58AA06C14" Timestamp="1D88B05AAE91215" xmlns="http://www.ni.com/PlatformFramework">
<SourceModelFeatureSet>
<ParsableNamespace AssemblyFileVersion="9.3.0.49613" FeatureSetName="LabVIEW Controls" Name="http://www.ni.com/Controls.LabVIEW.Design" OldestCompatibleVersion="8.1.0.49152" Version="8.1.0.49152" />
<ParsableNamespace AssemblyFileVersion="9.3.0.49613" FeatureSetName="LabVIEW Virtual Instrument" Name="http://www.ni.com/LabVIEW.VI" OldestCompatibleVersion="8.1.0.49152" Version="8.1.0.49152" />
Expand All @@ -8,7 +8,7 @@
<ParsableNamespace AssemblyFileVersion="9.3.0.49613" FeatureSetName="Editor" Name="http://www.ni.com/PlatformFramework" OldestCompatibleVersion="8.1.0.49152" Version="8.1.0.49152" />
<ApplicationVersionInfo Build="9.3.0.49613" Name="G Web Development Software" Version="22.0.0" />
</SourceModelFeatureSet>
<VirtualInstrument Id="c5610b1e35244fec95f265025f071234" xmlns="http://www.ni.com/LabVIEW.VI">
<VirtualInstrument Id="c5610b1e35244fec95f265025f071234" Reentrancy="Stateful" xmlns="http://www.ni.com/LabVIEW.VI">
<Icon Id="9cbf4614b57e4a16b025cba84b78c638" ListViewIconCrop="0 0 40 40" xmlns="http://www.ni.com/PlatformFramework">
<IconPanel Height="[float]40" Id="837f6eabe6c94b8a99aef63d013b6b26" Left="[float]0" PanelSizeMode="Resize" Top="[float]0" Width="[float]40">
<IconTemplate ClipMargin="[SMThickness]3,3,3,3" Height="[float]40" Id="ec3f7465989e4e68a938f1c7f2103e99" Left="[float]0" TemplateName="[string]Gray" Top="[float]0" Width="[float]40">
Expand Down Expand Up @@ -266,7 +266,7 @@
<p5:Label Height="[float]16" Id="9a77f29bb75340d68231cca070b9e5fa" IsVisualChild="[bool]False" LabelOwner="[UIModel]bfe857898526410e8324027fb0fe2cbe" Left="[float]61" Text="[string]multipart data ext" Top="[float]-14" Width="[float]95" />
</Cluster>
</ArrayViewer>
<Label Id="7010a4a55a3948c0b7a5c427fe174f5c" LabelOwner="[UIModel]73068541d1814be598d4c511020658c0" Left="[float]100" Text="[string]data" Top="[float]96" xmlns="http://www.ni.com/PanelCommon" />
<Label Height="[float]16" Id="7010a4a55a3948c0b7a5c427fe174f5c" LabelOwner="[UIModel]73068541d1814be598d4c511020658c0" Left="[float]100" Text="[string]data" Top="[float]96" Width="[float]24" xmlns="http://www.ni.com/PanelCommon" />
</NativeFrontPanel>
<DataItem AdaptToDiagramType="True" CallDirection="Input" CallIndex="0" CallUsage="Required" DataType="@29cfba2712604cd9bf656801d62e3c65" Id="501d3b9b274f400a8cc550b957378389" Name="data" xmlns="http://www.ni.com/MocCommon">
<p.DefaultValue>null</p.DefaultValue>
Expand Down
10 changes: 5 additions & 5 deletions File/HTTPExtensions.gcomp/Support/HTTPExtensions.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,24 @@

const fetchWithTimeout = async function (url, timeout, options) {
let controller;
const opts = {...options};
const optionsCopy = {...options};
// Editor does not support AbortController
if (window.AbortController) {
controller = new AbortController();
timeoutAt(controller, timeout);
opts.signal = controller.signal;
optionsCopy.signal = controller.signal;
}
try {
return await fetch(url, opts);
return await fetch(url, optionsCopy);
} catch (ex) {
if (controller && controller.signal.aborted) {
// Editor does not support AbortController
if (window.AbortController && controller.signal.aborted) {
throw controller.signal.reason;
}
throw ex;
}
};

// TODO implement LabVIEW error codes
const postMultipartExt = async function (requestConfigurationJSON, url, timeout, postDataJSON, postDataFiles) {
const {includeCredentials, headersConfiguration} = JSON.parse(requestConfigurationJSON);
const postData = JSON.parse(postDataJSON);
Expand Down
16 changes: 8 additions & 8 deletions File/HTTPExtensions.gcomp/Support/Handle Result - String.gvi
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<SourceFile Checksum="690CD64B740F8A8122C6D3F9BFC26F766776EBBD7C4F8CE919D84D708D5816DE316AC21A5BC28E10E198CCFFAD3FE923D5E8EB5236F4DE50B559D27A4861048E" Timestamp="1D88A922BD3BDF4" xmlns="http://www.ni.com/PlatformFramework">
<SourceFile Checksum="78AE884E996A6DD37947F350A13DED2F2CDD554A264CA3624299F173B764BBDA10081EDEC45A83FB0BBFCD82B9C9E937626370869F118C8734A74F756DFF83E5" Timestamp="1D88B05AAE91215" xmlns="http://www.ni.com/PlatformFramework">
<SourceModelFeatureSet>
<ParsableNamespace AssemblyFileVersion="9.1.0.50238" FeatureSetName="LabVIEW Controls" Name="http://www.ni.com/Controls.LabVIEW.Design" OldestCompatibleVersion="8.1.0.49152" Version="8.1.0.49152" />
<ParsableNamespace AssemblyFileVersion="9.1.0.50238" FeatureSetName="LabVIEW Virtual Instrument" Name="http://www.ni.com/LabVIEW.VI" OldestCompatibleVersion="8.1.0.49152" Version="8.1.0.49152" />
<ParsableNamespace AssemblyFileVersion="9.1.0.50238" FeatureSetName="Common language components" Name="http://www.ni.com/MocCommon" OldestCompatibleVersion="8.1.0.49152" Version="8.1.0.49152" />
<ParsableNamespace AssemblyFileVersion="9.1.0.50238" FeatureSetName="Editor" Name="http://www.ni.com/PanelCommon" OldestCompatibleVersion="6.1.0.0" Version="6.1.0.49152" />
<ParsableNamespace AssemblyFileVersion="9.1.0.50238" FeatureSetName="Editor" Name="http://www.ni.com/PlatformFramework" OldestCompatibleVersion="8.1.0.49152" Version="8.1.0.49152" />
<ApplicationVersionInfo Build="9.1.0.50238" Name="G Web Development Software" Version="21.0.0" />
<ParsableNamespace AssemblyFileVersion="9.3.0.49613" FeatureSetName="LabVIEW Controls" Name="http://www.ni.com/Controls.LabVIEW.Design" OldestCompatibleVersion="8.1.0.49152" Version="8.1.0.49152" />
<ParsableNamespace AssemblyFileVersion="9.3.0.49613" FeatureSetName="LabVIEW Virtual Instrument" Name="http://www.ni.com/LabVIEW.VI" OldestCompatibleVersion="8.1.0.49152" Version="8.1.0.49152" />
<ParsableNamespace AssemblyFileVersion="9.3.0.49613" FeatureSetName="Common language components" Name="http://www.ni.com/MocCommon" OldestCompatibleVersion="8.1.0.49152" Version="8.1.0.49152" />
<ParsableNamespace AssemblyFileVersion="9.3.0.49613" FeatureSetName="Editor" Name="http://www.ni.com/PanelCommon" OldestCompatibleVersion="6.1.0.0" Version="6.1.0.49152" />
<ParsableNamespace AssemblyFileVersion="9.3.0.49613" FeatureSetName="Editor" Name="http://www.ni.com/PlatformFramework" OldestCompatibleVersion="8.1.0.49152" Version="8.1.0.49152" />
<ApplicationVersionInfo Build="9.3.0.49613" Name="G Web Development Software" Version="22.0.0" />
</SourceModelFeatureSet>
<VirtualInstrument Id="20ea0f77f7e4848b5c208c2a6e0ae66" xmlns="http://www.ni.com/LabVIEW.VI">
<VirtualInstrument Id="20ea0f77f7e4848b5c208c2a6e0ae66" Reentrancy="Stateful" xmlns="http://www.ni.com/LabVIEW.VI">
<Icon Id="91d68e221b0d4519b7ab6eef48b005a3" ListViewIconCrop="0 0 40 40" xmlns="http://www.ni.com/PlatformFramework">
<IconPanel Height="[float]40" Id="d13d0075970940659dbe4526ad801e69" Left="[float]0" PanelSizeMode="Resize" Top="[float]0" Width="[float]40">
<IconTemplate ClipMargin="[SMThickness]3,3,3,3" Height="[float]40" Id="f7c7666585bd40e5bd7bbe45b4056920" Left="[float]0" TemplateName="[string]Gray" Top="[float]0" Width="[float]40">
Expand Down
Loading

0 comments on commit fc6860d

Please sign in to comment.