Skip to content

Commit d299934

Browse files
committed
feat: add polyfill
1 parent f4d30e2 commit d299934

22 files changed

Lines changed: 1375 additions & 181 deletions

.github/workflows/ci.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,6 @@ jobs:
4343
NUGET_KEY: ${{secrets.NUGET_API_KEY}}
4444
VERSION_FILE_PATH: src/Directory.Build.props
4545
PROJECT_FILE_PATH: |
46+
src/Zapto.AspNetCore.Polyfill/Zapto.AspNetCore.Polyfill.csproj
4647
src/Zapto.AspNetCore.NetFx/Zapto.AspNetCore.NetFx.csproj
48+

AspNetCore.sln

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{B3DA0F06
1212
EndProject
1313
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Zapto.AspNetCore.NetFx.Tests", "tests\Zapto.AspNetCore.NetFx.Tests\Zapto.AspNetCore.NetFx.Tests.csproj", "{305C7374-1A54-4409-B527-968D49B258DF}"
1414
EndProject
15+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Zapto.AspNetCore.Polyfill", "src\Zapto.AspNetCore.Polyfill\Zapto.AspNetCore.Polyfill.csproj", "{507A2467-52E9-4181-8414-426AC45E01B3}"
16+
EndProject
1517
Global
1618
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1719
Debug|Any CPU = Debug|Any CPU
@@ -21,6 +23,7 @@ Global
2123
{C3CEF02D-43F9-4C28-BC1D-18ED3D1FC0E4} = {7F209FD2-1190-4721-9A08-9569AB4AA8D5}
2224
{77FA9DA3-FB50-46EC-B9B8-905121594EA1} = {DD6845EA-4012-4E0A-8B78-8BAE5FF6967B}
2325
{305C7374-1A54-4409-B527-968D49B258DF} = {B3DA0F06-4511-4791-BB12-A84655F02BFA}
26+
{507A2467-52E9-4181-8414-426AC45E01B3} = {7F209FD2-1190-4721-9A08-9569AB4AA8D5}
2427
EndGlobalSection
2528
GlobalSection(ProjectConfigurationPlatforms) = postSolution
2629
{C3CEF02D-43F9-4C28-BC1D-18ED3D1FC0E4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
@@ -35,5 +38,9 @@ Global
3538
{305C7374-1A54-4409-B527-968D49B258DF}.Debug|Any CPU.Build.0 = Debug|Any CPU
3639
{305C7374-1A54-4409-B527-968D49B258DF}.Release|Any CPU.ActiveCfg = Release|Any CPU
3740
{305C7374-1A54-4409-B527-968D49B258DF}.Release|Any CPU.Build.0 = Release|Any CPU
41+
{507A2467-52E9-4181-8414-426AC45E01B3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
42+
{507A2467-52E9-4181-8414-426AC45E01B3}.Debug|Any CPU.Build.0 = Debug|Any CPU
43+
{507A2467-52E9-4181-8414-426AC45E01B3}.Release|Any CPU.ActiveCfg = Release|Any CPU
44+
{507A2467-52E9-4181-8414-426AC45E01B3}.Release|Any CPU.Build.0 = Release|Any CPU
3845
EndGlobalSection
3946
EndGlobal

sandbox/WebFormsApp/Modules/TestModule.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
using Zapto.AspNetCore.Http;
77
using Microsoft.AspNetCore.Builder;
88
using Microsoft.AspNetCore.Http;
9+
using Microsoft.AspNetCore.Http.Features;
910
using Microsoft.AspNetCore.Routing;
1011
using Microsoft.Extensions.Configuration;
1112
using Microsoft.Extensions.DependencyInjection;
@@ -30,6 +31,14 @@ public override void Configure(IApplicationBuilder app)
3031

3132
app.Use(async (context, next) =>
3233
{
34+
if (context.Request.Path.StartsWithSegments("/file"))
35+
{
36+
var httpBodyFeature = context.Features.Get<IHttpResponseBodyFeature>() ?? throw new InvalidOperationException("IHttpResponseBodyFeature not found");
37+
38+
await httpBodyFeature.SendFileAsync("test.txt", 0, null);
39+
return;
40+
}
41+
3342
if (context.Request.Path.StartsWithSegments("/ws/echo") && context.WebSockets.IsWebSocketRequest)
3443
{
3544
var webSocket = await context.WebSockets.AcceptWebSocketAsync();

sandbox/WebFormsApp/Properties/AssemblyInfo.cs

Lines changed: 0 additions & 35 deletions
This file was deleted.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"profiles": {
3+
"IIS Express": {
4+
"commandName": "Executable",
5+
"executablePath": "C:/Program Files (x86)/IIS Express/iisexpress.exe",
6+
"commandLineArgs": "/config:$(ProjectDir)/applicationhost.config /site:Site /apppool:Clr4IntegratedAppPool",
7+
"workingDirectory": "C:/Program Files (x86)/IIS Express",
8+
"environmentVariables": {
9+
"WEBSITE_PATH": "$(ProjectDir)"
10+
}
11+
}
12+
}
13+
}
Lines changed: 13 additions & 139 deletions
Original file line numberDiff line numberDiff line change
@@ -1,147 +1,21 @@
1-
<?xml version="1.0" encoding="utf-8"?>
2-
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3-
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')"/>
1+
<Project Sdk="MSBuild.SDK.SystemWeb/4.0.104">
42
<PropertyGroup>
5-
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6-
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7-
<SchemaVersion>2.0</SchemaVersion>
8-
<ProjectGuid>{77FA9DA3-FB50-46EC-B9B8-905121594EA1}</ProjectGuid>
9-
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
10-
<OutputType>Library</OutputType>
11-
<AppDesignerFolder>Properties</AppDesignerFolder>
12-
<RootNamespace>WebFormsApp</RootNamespace>
13-
<AssemblyName>WebFormsApp</AssemblyName>
14-
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
15-
<RuntimeIdentifiers>win</RuntimeIdentifiers>
16-
<MvcBuildViews>false</MvcBuildViews>
17-
<UseIISExpress>true</UseIISExpress>
18-
<Use64BitIISExpress/>
19-
<IISExpressSSLPort/>
20-
<IISExpressAnonymousAuthentication/>
21-
<IISExpressWindowsAuthentication/>
22-
<IISExpressUseClassicPipelineMode/>
23-
<UseGlobalApplicationHostFile/>
24-
<NuGetPackageImportStamp/>
25-
<GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
26-
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
27-
<AutoUnifyAssemblyReferences>true</AutoUnifyAssemblyReferences>
28-
</PropertyGroup>
29-
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
30-
<DebugSymbols>true</DebugSymbols>
31-
<DebugType>full</DebugType>
32-
<Optimize>false</Optimize>
33-
<OutputPath>bin\</OutputPath>
34-
<DefineConstants>DEBUG;TRACE</DefineConstants>
35-
<ErrorReport>prompt</ErrorReport>
36-
<WarningLevel>4</WarningLevel>
3+
<TargetFramework>net472</TargetFramework>
4+
<LangVersion>11</LangVersion>
5+
<OutputPath>bin</OutputPath>
376
</PropertyGroup>
38-
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
39-
<DebugSymbols>true</DebugSymbols>
40-
<DebugType>pdbonly</DebugType>
41-
<Optimize>true</Optimize>
42-
<OutputPath>bin\</OutputPath>
43-
<DefineConstants>TRACE</DefineConstants>
44-
<ErrorReport>prompt</ErrorReport>
45-
<WarningLevel>4</WarningLevel>
7+
8+
<PropertyGroup>
9+
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
10+
<GeneratedBindingRedirectsAction>Overwrite</GeneratedBindingRedirectsAction>
4611
</PropertyGroup>
47-
<ItemGroup>
48-
<Reference Include="Microsoft.CSharp"/>
49-
<Reference Include="System"/>
50-
<Reference Include="System.Data"/>
51-
<Reference Include="System.Drawing"/>
52-
<Reference Include="System.Web.DynamicData"/>
53-
<Reference Include="System.Web.ApplicationServices"/>
54-
<Reference Include="System.ComponentModel.DataAnnotations"/>
55-
<Reference Include="System.Core"/>
56-
<Reference Include="System.Data.DataSetExtensions"/>
57-
<Reference Include="System.Web.WebPages">
58-
<HintPath>..\..\..\..\Users\gsmit\AppData\Local\Temp\Temporary ASP.NET Files\root\4b230560\d061206e\assembly\dl3\31e8ab4f\003c87e2_1a87d401\System.Web.WebPages.DLL</HintPath>
59-
</Reference>
60-
<Reference Include="System.Xml.Linq"/>
61-
<Reference Include="System.Web"/>
62-
<Reference Include="System.Web.Extensions"/>
63-
<Reference Include="System.Web.Abstractions"/>
64-
<Reference Include="System.Web.Routing"/>
65-
<Reference Include="System.Xml"/>
66-
<Reference Include="System.Configuration"/>
67-
<Reference Include="System.Web.Services"/>
68-
<Reference Include="System.EnterpriseServices"/>
69-
<Reference Include="System.Net.Http">
70-
</Reference>
71-
<Reference Include="System.Net.Http.WebRequest">
72-
</Reference>
73-
</ItemGroup>
74-
<ItemGroup>
75-
<Compile Include="Controllers\CounterController.cs" />
76-
<Compile Include="Global.asax.cs">
77-
<DependentUpon>Global.asax</DependentUpon>
78-
</Compile>
79-
<Compile Include="Modules\CounterService.cs" />
80-
<Compile Include="Modules\TestModule.cs"/>
81-
<Compile Include="Properties\AssemblyInfo.cs"/>
82-
<Compile Include="WebForms.aspx.cs">
83-
<SubType>ASPXCodeBehind</SubType>
84-
<DependentUpon>WebForms.aspx</DependentUpon>
85-
</Compile>
86-
<Compile Include="WebSocketEcho.aspx.cs">
87-
<SubType>ASPXCodeBehind</SubType>
88-
<DependentUpon>WebSocketEcho.aspx</DependentUpon>
89-
</Compile>
90-
</ItemGroup>
91-
<ItemGroup>
92-
<Content Include="favicon.ico"/>
93-
<Content Include="Global.asax"/>
94-
<Content Include="WebForms.aspx" />
95-
<Content Include="Web.config"/>
96-
<Content Include="Web.Debug.config">
97-
<DependentUpon>Web.config</DependentUpon>
98-
</Content>
99-
<Content Include="Web.Release.config">
100-
<DependentUpon>Web.config</DependentUpon>
101-
</Content>
102-
<Content Include="WebSocketEcho.aspx" />
103-
</ItemGroup>
104-
<ItemGroup>
105-
<ProjectReference Include="..\..\src\Zapto.AspNetCore.NetFx\Zapto.AspNetCore.NetFx.csproj">
106-
<Project>{c3cef02d-43f9-4c28-bc1d-18ed3d1fc0e4}</Project>
107-
<Name>Zapto.AspNetCore.NetFx</Name>
108-
</ProjectReference>
109-
</ItemGroup>
12+
11013
<ItemGroup>
11114
<PackageReference Include="Microsoft.AspNetCore.Mvc.Core" Version="2.3.0" />
112-
<PackageReference Include="Microsoft.CodeDom.Providers.DotNetCompilerPlatform" Version="2.0.0"/>
11315
<PackageReference Include="Microsoft.AspNetCore.Routing" Version="2.3.0"/>
11416
</ItemGroup>
115-
<PropertyGroup>
116-
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
117-
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
118-
</PropertyGroup>
119-
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets"/>
120-
<Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''"/>
121-
<Target Name="MvcBuildViews" AfterTargets="AfterBuild" Condition="'$(MvcBuildViews)'=='true'">
122-
<AspNetCompiler VirtualPath="temp" PhysicalPath="$(WebProjectOutputDir)"/>
123-
</Target>
124-
<ProjectExtensions>
125-
<VisualStudio>
126-
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
127-
<WebProjectProperties>
128-
<UseIIS>True</UseIIS>
129-
<AutoAssignPort>True</AutoAssignPort>
130-
<DevelopmentServerPort>5000</DevelopmentServerPort>
131-
<DevelopmentServerVPath>/</DevelopmentServerVPath>
132-
<IISUrl>http://localhost:5000/</IISUrl>
133-
<NTLMAuthentication>False</NTLMAuthentication>
134-
<UseCustomServer>False</UseCustomServer>
135-
<CustomServerUrl/>
136-
<SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
137-
</WebProjectProperties>
138-
</FlavorProperties>
139-
</VisualStudio>
140-
</ProjectExtensions>
141-
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
142-
Other similar extension points exist, see Microsoft.Common.targets.
143-
<Target Name="BeforeBuild">
144-
</Target>
145-
<Target Name="AfterBuild">
146-
</Target> -->
17+
18+
<ItemGroup>
19+
<ProjectReference Include="..\..\src\Zapto.AspNetCore.NetFx\Zapto.AspNetCore.NetFx.csproj" />
20+
</ItemGroup>
14721
</Project>

0 commit comments

Comments
 (0)