├── src
├── main
│ ├── Owin.Types
│ │ ├── Generated.txt
│ │ ├── Extensions
│ │ │ ├── OwinRequestExtensions.MethodOverride.cs
│ │ │ └── OwinRequestExtensions.Forwarded..cs
│ │ ├── Owin.Types.nuspec
│ │ ├── Owin.Types.Sources.nuspec
│ │ ├── Helpers
│ │ │ ├── OwinHelpers.MethodOverride.cs
│ │ │ ├── OwinHelpers.Uri.cs
│ │ │ ├── OwinHelpers.Forwarded.cs
│ │ │ └── OwinHelpers.Header.cs
│ │ ├── OwinResponse.cs
│ │ ├── OwinWebSocketParameters.Spec-WebSocket.cs
│ │ ├── OwinOpaqueParameters.cs
│ │ ├── OwinWebSocketParameters.cs
│ │ ├── OwinOpaque.Spec-Opaque.cs
│ │ ├── OwinRequest.cs
│ │ ├── Properties
│ │ │ └── AssemblyInfo.cs
│ │ ├── OwinRequest.Spec-Opaque.cs
│ │ ├── OwinWebSocket.cs
│ │ ├── OwinWebSocketReceiveMessage.cs
│ │ ├── OwinRequest.Spec-WebSocket.cs
│ │ ├── OwinOpaque.Generated.cs
│ │ ├── OwinResponse.Spec-SendFile.cs
│ │ ├── OwinWebSocket.Generated.cs
│ │ ├── OwinResponse.Spec-Owin.cs
│ │ ├── OwinOpaqueParameters.Generated.cs
│ │ ├── OwinRequest.Spec-CommonKeys.cs
│ │ ├── OwinWebSocketParameters.Generated.cs
│ │ ├── OwinWebSocket.Spec-WebSocket.cs
│ │ ├── OwinRequest.Spec-Owin.cs
│ │ ├── Owin.Types.csproj
│ │ ├── OwinRequest.Generated.cs
│ │ └── OwinResponse.Generated.cs
│ ├── Owin.Loader
│ │ ├── GlobalSuppressions.cs
│ │ ├── packages.config
│ │ ├── Owin.Loader.nuspec
│ │ ├── Owin.Loader.Sources.nuspec
│ │ ├── NullLoader.cs
│ │ ├── Properties
│ │ │ └── AssemblyInfo.cs
│ │ └── Owin.Loader.csproj
│ ├── Owin.Builder
│ │ ├── packages.config
│ │ ├── Owin.Builder.nuspec
│ │ ├── Owin.Builder.Sources.nuspec
│ │ ├── GlobalSuppressions.cs
│ │ ├── NotFound.cs
│ │ ├── Properties
│ │ │ └── AssemblyInfo.cs
│ │ └── Owin.Builder.csproj
│ ├── Owin.AutoStartup
│ │ ├── packages.config
│ │ ├── web.config.transform
│ │ ├── Startup.cs.pp
│ │ ├── Owin.AutoStartup.nuspec
│ │ ├── Owin.AutoStartup.Sources.nuspec
│ │ ├── Owin.AutoStartup.SystemWeb.nuspec
│ │ ├── Owin.AutoStartup.HttpListener.nuspec
│ │ ├── Properties
│ │ │ └── AssemblyInfo.cs
│ │ └── Owin.AutoStartup.csproj
│ ├── Owin.Extensions
│ │ ├── packages.config
│ │ ├── CustomDictionary.xml
│ │ ├── Owin.Extensions.nuspec
│ │ ├── Owin.Extensions.Sources.nuspec
│ │ ├── Properties
│ │ │ └── AssemblyInfo.cs
│ │ ├── StartupExtensions.Type.cs
│ │ ├── Owin.Extensions.csproj
│ │ └── StartupExtensions.cs
│ └── Owin.Startup
│ │ ├── Owin.nuspec_archived
│ │ ├── GlobalSuppressions.cs
│ │ ├── Properties
│ │ └── AssemblyInfo.cs
│ │ ├── Owin.csproj
│ │ └── IAppBuilder.cs
├── Common.snk.gpg
├── test
│ ├── StartupConvention1
│ │ ├── packages.config
│ │ ├── Web.config
│ │ ├── Web.Debug.config
│ │ ├── Web.Release.config
│ │ ├── Properties
│ │ │ └── AssemblyInfo.cs
│ │ └── Startup.cs
│ ├── Owin.Loader.Tests
│ │ ├── packages.config
│ │ ├── Properties
│ │ │ └── AssemblyInfo.cs
│ │ └── Owin.Loader.Tests.csproj
│ ├── MiddlewareConvention2
│ │ ├── packages.config
│ │ ├── Properties
│ │ │ └── AssemblyInfo.cs
│ │ ├── Beta.cs
│ │ ├── Delta.cs
│ │ └── MiddlewareConvention2.csproj
│ ├── Owin.Types.Tests
│ │ ├── packages.config
│ │ ├── Properties
│ │ │ └── AssemblyInfo.cs
│ │ ├── OwinResponseSendFileTests.cs
│ │ ├── OwinResponseTests.cs
│ │ ├── Owin.Types.Tests.csproj
│ │ └── OwinHelpersMethodOverrideTests.cs
│ ├── MiddlewareConvention1
│ │ ├── packages.config
│ │ ├── Properties
│ │ │ └── AssemblyInfo.cs
│ │ ├── Alpha.cs
│ │ ├── Gamma.cs
│ │ └── MiddlewareConvention1.csproj
│ ├── Owin.Builder.Tests
│ │ ├── packages.config
│ │ ├── ConventionsTests.cs
│ │ ├── Properties
│ │ │ └── AssemblyInfo.cs
│ │ └── Owin.Builder.Tests.csproj
│ ├── StartupConvention2
│ │ ├── Web.config
│ │ ├── Web.Debug.config
│ │ ├── Web.Release.config
│ │ ├── Startup.cs
│ │ ├── Properties
│ │ │ └── AssemblyInfo.cs
│ │ └── StartupConvention2.csproj
│ └── Utils
│ │ ├── Properties
│ │ └── AssemblyInfo.cs
│ │ ├── OwinHelper.cs
│ │ └── Utils.csproj
└── Common.targets
├── _line.shade
├── README.md
├── .nuget
├── nuget.exe
└── NuGet.Config
├── NOTICE.txt
├── .gitignore
├── OwinHosting.sln.DotSettings
├── FileGrammar.shade
└── Sakefile.shade
/src/main/Owin.Types/Generated.txt:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/_line.shade:
--------------------------------------------------------------------------------
1 | render
2 | |!{"\r\n"}
3 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | owin-hosting
2 | ============
3 |
4 | OWIN hosting components
--------------------------------------------------------------------------------
/.nuget/nuget.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/owin-contrib/owin-hosting/HEAD/.nuget/nuget.exe
--------------------------------------------------------------------------------
/src/Common.snk.gpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/owin-contrib/owin-hosting/HEAD/src/Common.snk.gpg
--------------------------------------------------------------------------------
/NOTICE.txt:
--------------------------------------------------------------------------------
1 | OWIN hosting components
2 | Copyright 2012 Louis DeJardin
3 | Copyright 2012 Chris Ross
4 |
--------------------------------------------------------------------------------
/src/main/Owin.Loader/GlobalSuppressions.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/owin-contrib/owin-hosting/HEAD/src/main/Owin.Loader/GlobalSuppressions.cs
--------------------------------------------------------------------------------
/src/main/Owin.Builder/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/src/main/Owin.Loader/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/src/main/Owin.AutoStartup/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/src/main/Owin.Extensions/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/src/test/StartupConvention1/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/src/test/Owin.Loader.Tests/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/src/test/MiddlewareConvention2/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/.nuget/NuGet.Config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | bin
2 | obj
3 | *.suo
4 | *.user
5 | _ReSharper.*
6 | *.DS_Store
7 | *.userprefs
8 | *.pidb
9 | TestResult.xml
10 | nugetkey
11 | packages
12 | target
13 | StyleCop.Cache
14 | TestResults/*
15 | *.snk
16 |
--------------------------------------------------------------------------------
/src/main/Owin.Extensions/CustomDictionary.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Owin
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/src/test/Owin.Types.Tests/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/src/test/MiddlewareConvention1/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/src/Common.targets:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | ..\..\Common.snk
5 | true
6 |
7 |
8 |
--------------------------------------------------------------------------------
/src/test/Owin.Builder.Tests/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/src/test/StartupConvention1/Web.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/src/test/StartupConvention2/Web.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/src/main/Owin.Types/Extensions/OwinRequestExtensions.MethodOverride.cs:
--------------------------------------------------------------------------------
1 | using Owin.Types.Helpers;
2 |
3 | namespace Owin.Types.Extensions
4 | {
5 | public static partial class OwinRequestExtensions
6 | {
7 | public static string GetMethodOverride(this OwinRequest request)
8 | {
9 | return OwinHelpers.GetMethodOverride(request);
10 | }
11 |
12 | public static OwinRequest ApplyMethodOverride(this OwinRequest request)
13 | {
14 | return OwinHelpers.ApplyMethodOverride(request);
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/main/Owin.Startup/Owin.nuspec_archived:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | $id$
5 | 1.0
6 | OWIN
7 | $authors$
8 | $authors$
9 | https://github.com/owin-contrib/owin-hosting/blob/master/LICENSE.txt
10 | https://github.com/owin-contrib/owin-hosting/
11 | false
12 | OWIN IAppBuilder startup interface
13 | OWIN
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/src/main/Owin.Types/Owin.Types.nuspec:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | $id$
5 | $version$
6 | $authors$
7 | $authors$
8 | https://github.com/owin-contrib/owin-hosting/blob/master/LICENSE.txt
9 | https://github.com/owin-contrib/owin-hosting/
10 | false
11 | OWIN types
12 | OWIN
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/src/main/Owin.Types/Owin.Types.Sources.nuspec:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | $id$
5 | $version$
6 | $authors$
7 | $authors$
8 | https://github.com/owin-contrib/owin-hosting/blob/master/LICENSE.txt
9 | https://github.com/owin-contrib/owin-hosting/
10 | false
11 | OWIN types
12 | OWIN
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/src/main/Owin.AutoStartup/web.config.transform:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/src/test/Owin.Builder.Tests/ConventionsTests.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using Xunit;
6 |
7 | namespace Owin.Builder.Tests
8 | {
9 | public class ConventionsTests
10 | {
11 | [Fact]
12 | public void StartupConvetion1Success()
13 | {
14 | IAppBuilder builder = new AppBuilder();
15 | new StartupConvention1.Startup().Configuration(builder);
16 | builder.Build();
17 | }
18 |
19 | [Fact]
20 | public void StartupConvetion2Success()
21 | {
22 | IAppBuilder builder = new AppBuilder();
23 | new StartupConvention2.Startup().Configuration(builder.Properties);
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/main/Owin.Loader/Owin.Loader.nuspec:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | $id$
5 | $version$
6 | $authors$
7 | $authors$
8 | https://github.com/owin-contrib/owin-hosting/blob/master/LICENSE.txt
9 | https://github.com/owin-contrib/owin-hosting/
10 | false
11 | OWIN common loader
12 | OWIN
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/src/main/Owin.Builder/Owin.Builder.nuspec:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | $id$
5 | $version$
6 | $authors$
7 | $authors$
8 | https://github.com/owin-contrib/owin-hosting/blob/master/LICENSE.txt
9 | https://github.com/owin-contrib/owin-hosting/
10 | false
11 | OWIN common builder
12 | OWIN
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/src/main/Owin.Extensions/Owin.Extensions.nuspec:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | $id$
5 | $version$
6 | $authors$
7 | $authors$
8 | https://github.com/owin-contrib/owin-hosting/blob/master/LICENSE.txt
9 | https://github.com/owin-contrib/owin-hosting/
10 | false
11 | OWIN common extensions
12 | OWIN
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/src/main/Owin.AutoStartup/Startup.cs.pp:
--------------------------------------------------------------------------------
1 | using System;
2 | using Owin;
3 | using Owin.AutoStartup;
4 |
5 | namespace $rootnamespace$
6 | {
7 | public partial class Startup
8 | {
9 | public IServiceProvider ServiceProvider { get; set; }
10 |
11 | public Startup()
12 | {
13 | }
14 |
15 | public Startup(IServiceProvider serviceProvider)
16 | {
17 | ServiceProvider = serviceProvider;
18 | }
19 |
20 | public void AutoConfiguration(IAppBuilder app)
21 | {
22 | AutoStartupInfrastructure.ExecuteConfigurationMethods(this, app);
23 | }
24 |
25 | public void Post050_ExecuteOwinAutoStartups(IAppBuilder app)
26 | {
27 | AutoStartupInfrastructure.ExecuteOwinAutoStartups(ServiceProvider, app);
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/src/main/Owin.Builder/Owin.Builder.Sources.nuspec:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | $id$
5 | $version$
6 | $authors$
7 | $authors$
8 | https://github.com/owin-contrib/owin-hosting/blob/master/LICENSE.txt
9 | https://github.com/owin-contrib/owin-hosting/
10 | false
11 | OWIN common builder sources
12 | OWIN
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/src/main/Owin.Loader/Owin.Loader.Sources.nuspec:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | $id$
5 | $version$
6 | $authors$
7 | $authors$
8 | https://github.com/owin-contrib/owin-hosting/blob/master/LICENSE.txt
9 | https://github.com/owin-contrib/owin-hosting/
10 | false
11 | OWIN common loader sources
12 | OWIN
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/src/main/Owin.AutoStartup/Owin.AutoStartup.nuspec:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | $id$
5 | $version$
6 | $authors$
7 | $authors$
8 | https://github.com/owin-contrib/owin-hosting/blob/master/LICENSE.txt
9 | https://github.com/owin-contrib/owin-hosting/
10 | false
11 | OWIN auto startup
12 | OWIN
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/src/main/Owin.AutoStartup/Owin.AutoStartup.Sources.nuspec:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | $id$
5 | $version$
6 | $authors$
7 | $authors$
8 | https://github.com/owin-contrib/owin-hosting/blob/master/LICENSE.txt
9 | https://github.com/owin-contrib/owin-hosting/
10 | false
11 | OWIN auto startup
12 | OWIN
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/src/main/Owin.AutoStartup/Owin.AutoStartup.SystemWeb.nuspec:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | $id$
5 | $version$
6 | $authors$
7 | $authors$
8 | https://github.com/owin-contrib/owin-hosting/blob/master/LICENSE.txt
9 | https://github.com/owin-contrib/owin-hosting/
10 | false
11 | OWIN common builder sources
12 | OWIN
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/src/main/Owin.Extensions/Owin.Extensions.Sources.nuspec:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | $id$
5 | $version$
6 | $authors$
7 | $authors$
8 | https://github.com/owin-contrib/owin-hosting/blob/master/LICENSE.txt
9 | https://github.com/owin-contrib/owin-hosting/
10 | false
11 | OWIN common extensions sources
12 | OWIN
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/src/main/Owin.AutoStartup/Owin.AutoStartup.HttpListener.nuspec:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | $id$
5 | $version$
6 | $authors$
7 | $authors$
8 | https://github.com/owin-contrib/owin-hosting/blob/master/LICENSE.txt
9 | https://github.com/owin-contrib/owin-hosting/
10 | false
11 | OWIN common builder sources
12 | OWIN
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/src/main/Owin.Types/Helpers/OwinHelpers.MethodOverride.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | namespace Owin.Types.Helpers
5 | {
6 | public static partial class OwinHelpers
7 | {
8 | public static string GetMethodOverride(OwinRequest request)
9 | {
10 | var method = request.Method;
11 | if (!string.Equals("POST", method, StringComparison.OrdinalIgnoreCase))
12 | {
13 | // override has no effect on POST
14 | return method;
15 | }
16 |
17 | var methodOverride = GetHeader(request.Headers, "X-Http-Method-Override");
18 | if (string.IsNullOrEmpty(methodOverride))
19 | {
20 | return method;
21 | }
22 |
23 | return methodOverride;
24 | }
25 |
26 | public static OwinRequest ApplyMethodOverride(OwinRequest request)
27 | {
28 | request.Method = GetMethodOverride(request);
29 | return request;
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/src/main/Owin.AutoStartup/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Reflection;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("Owin.AutoStartup")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCulture("")]
12 |
13 | // Setting ComVisible to false makes the types in this assembly not visible
14 | // to COM components. If you need to access a type in this assembly from
15 | // COM, set the ComVisible attribute to true on that type.
16 | [assembly: ComVisible(false)]
17 |
18 | // The following GUID is for the ID of the typelib if this project is exposed to COM
19 | [assembly: Guid("84a6388d-059a-454c-b2c8-4a06bff00d23")]
20 |
21 | [assembly: AssemblyVersion("0.7")]
22 | [assembly: AssemblyFileVersion("0.7")]
23 | [assembly: AssemblyInformationalVersion("0.7-alpha")]
24 | [assembly: CLSCompliant(true)]
25 |
--------------------------------------------------------------------------------
/src/main/Owin.Types/OwinResponse.cs:
--------------------------------------------------------------------------------
1 | // Licensed to Monkey Square, Inc. under one or more contributor
2 | // license agreements. See the NOTICE file distributed with
3 | // this work or additional information regarding copyright
4 | // ownership. Monkey Square, Inc. licenses this file to you
5 | // under the Apache License, Version 2.0 (the "License"); you
6 | // may not use this file except in compliance with the License.
7 | // You may obtain a copy of the License at
8 | //
9 | // http://www.apache.org/licenses/LICENSE-2.0
10 | //
11 | // Unless required by applicable law or agreed to in writing,
12 | // software distributed under the License is distributed on an
13 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | // KIND, either express or implied. See the License for the
15 | // specific language governing permissions and limitations
16 | // under the License.
17 | namespace Owin.Types
18 | {
19 | public partial struct OwinResponse
20 | {
21 | public OwinResponse(OwinRequest request)
22 | {
23 | _dictionary = request.Dictionary;
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/main/Owin.Types/Helpers/OwinHelpers.Uri.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Owin.Types.Helpers
4 | {
5 | public static partial class OwinHelpers
6 | {
7 | public static string GetHost(OwinRequest request)
8 | {
9 | var headers = request.Headers;
10 |
11 | var host = GetHeader(headers, "Host");
12 | if (!string.IsNullOrWhiteSpace(host))
13 | {
14 | return host;
15 | }
16 |
17 | var localIpAddress = request.LocalIpAddress ?? "localhost";
18 | var localPort = request.LocalPort;
19 | return string.IsNullOrWhiteSpace(localPort) ? localIpAddress : (localIpAddress + ":" + localPort);
20 | }
21 |
22 | public static Uri GetUri(OwinRequest request)
23 | {
24 | var queryString = request.QueryString;
25 |
26 | return string.IsNullOrWhiteSpace(queryString)
27 | ? new Uri(request.Scheme + "://" + GetHost(request) + request.PathBase + request.Path)
28 | : new Uri(request.Scheme + "://" + GetHost(request) + request.PathBase + request.Path + "?" + queryString);
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/src/main/Owin.Types/OwinWebSocketParameters.Spec-WebSocket.cs:
--------------------------------------------------------------------------------
1 | // Licensed to Monkey Square, Inc. under one or more contributor
2 | // license agreements. See the NOTICE file distributed with
3 | // this work or additional information regarding copyright
4 | // ownership. Monkey Square, Inc. licenses this file to you
5 | // under the Apache License, Version 2.0 (the "License"); you
6 | // may not use this file except in compliance with the License.
7 | // You may obtain a copy of the License at
8 | //
9 | // http://www.apache.org/licenses/LICENSE-2.0
10 | //
11 | // Unless required by applicable law or agreed to in writing,
12 | // software distributed under the License is distributed on an
13 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | // KIND, either express or implied. See the License for the
15 | // specific language governing permissions and limitations
16 | // under the License.
17 | namespace Owin.Types
18 | {
19 | public partial struct OwinWebSocketParameters
20 | {
21 | public string SubProtocol
22 | {
23 | get { return Get(OwinConstants.WebSocket.SubProtocol); }
24 | set { Set(OwinConstants.WebSocket.SubProtocol, value); }
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/main/Owin.Types/OwinOpaqueParameters.cs:
--------------------------------------------------------------------------------
1 | // Licensed to Monkey Square, Inc. under one or more contributor
2 | // license agreements. See the NOTICE file distributed with
3 | // this work or additional information regarding copyright
4 | // ownership. Monkey Square, Inc. licenses this file to you
5 | // under the Apache License, Version 2.0 (the "License"); you
6 | // may not use this file except in compliance with the License.
7 | // You may obtain a copy of the License at
8 | //
9 | // http://www.apache.org/licenses/LICENSE-2.0
10 | //
11 | // Unless required by applicable law or agreed to in writing,
12 | // software distributed under the License is distributed on an
13 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | // KIND, either express or implied. See the License for the
15 | // specific language governing permissions and limitations
16 | // under the License.
17 |
18 | using System;
19 | using System.Collections.Concurrent;
20 |
21 | namespace Owin.Types
22 | {
23 | public partial struct OwinOpaqueParameters
24 | {
25 | public static OwinOpaqueParameters Create()
26 | {
27 | return new OwinOpaqueParameters(new ConcurrentDictionary(StringComparer.Ordinal));
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/src/main/Owin.Startup/GlobalSuppressions.cs:
--------------------------------------------------------------------------------
1 | // Licensed to Monkey Square, Inc. under one or more contributor
2 | // license agreements. See the NOTICE file distributed with
3 | // this work or additional information regarding copyright
4 | // ownership. Monkey Square, Inc. licenses this file to you
5 | // under the Apache License, Version 2.0 (the "License"); you
6 | // may not use this file except in compliance with the License.
7 | // You may obtain a copy of the License at
8 | //
9 | // http://www.apache.org/licenses/LICENSE-2.0
10 | //
11 | // Unless required by applicable law or agreed to in writing,
12 | // software distributed under the License is distributed on an
13 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | // KIND, either express or implied. See the License for the
15 | // specific language governing permissions and limitations
16 | // under the License.
17 | [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Owin", Justification = "Project name")]
18 | [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Owin", Scope = "namespace", Target = "Owin", Justification = "Project name")]
19 |
--------------------------------------------------------------------------------
/src/main/Owin.Builder/GlobalSuppressions.cs:
--------------------------------------------------------------------------------
1 | // Licensed to Monkey Square, Inc. under one or more contributor
2 | // license agreements. See the NOTICE file distributed with
3 | // this work or additional information regarding copyright
4 | // ownership. Monkey Square, Inc. licenses this file to you
5 | // under the Apache License, Version 2.0 (the "License"); you
6 | // may not use this file except in compliance with the License.
7 | // You may obtain a copy of the License at
8 | //
9 | // http://www.apache.org/licenses/LICENSE-2.0
10 | //
11 | // Unless required by applicable law or agreed to in writing,
12 | // software distributed under the License is distributed on an
13 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | // KIND, either express or implied. See the License for the
15 | // specific language governing permissions and limitations
16 | // under the License.
17 | [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Owin", Justification = "Project name")]
18 | [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Owin", Scope = "namespace", Target = "Owin.Builder", Justification = "Project name")]
19 |
--------------------------------------------------------------------------------
/src/main/Owin.Types/Extensions/OwinRequestExtensions.Forwarded..cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Owin.Types.Helpers;
3 |
4 | namespace Owin.Types.Extensions
5 | {
6 | public static partial class OwinRequestExtensions
7 | {
8 | public static string GetForwardedScheme(this OwinRequest request)
9 | {
10 | return OwinHelpers.GetForwardedScheme(request);
11 | }
12 |
13 | public static string GetForwardedHost(this OwinRequest request)
14 | {
15 | return OwinHelpers.GetForwardedHost(request);
16 | }
17 |
18 | public static Uri GetForwardedUri(this OwinRequest request)
19 | {
20 | return OwinHelpers.GetForwardedUri(request);
21 | }
22 |
23 | public static OwinRequest ApplyForwardedScheme(this OwinRequest request)
24 | {
25 | return OwinHelpers.ApplyForwardedScheme(request);
26 | }
27 |
28 | public static OwinRequest ApplyForwardedHost(this OwinRequest request)
29 | {
30 | return OwinHelpers.ApplyForwardedHost(request);
31 | }
32 |
33 | public static OwinRequest ApplyForwardedUri(this OwinRequest request)
34 | {
35 | return OwinHelpers.ApplyForwardedUri(request);
36 | }
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/src/test/Owin.Types.Tests/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Reflection;
3 | using System.Runtime.CompilerServices;
4 | using System.Runtime.InteropServices;
5 |
6 | // General Information about an assembly is controlled through the following
7 | // set of attributes. Change these attribute values to modify the information
8 | // associated with an assembly.
9 | [assembly: AssemblyTitle("Owin.Types.Tests")]
10 | [assembly: AssemblyDescription("")]
11 | [assembly: AssemblyConfiguration("")]
12 | [assembly: AssemblyCompany("")]
13 | [assembly: AssemblyProduct("Owin.Types.Tests")]
14 | [assembly: AssemblyCopyright("Copyright © 2013")]
15 | [assembly: AssemblyTrademark("")]
16 | [assembly: AssemblyCulture("")]
17 |
18 | // Setting ComVisible to false makes the types in this assembly not visible
19 | // to COM components. If you need to access a type in this assembly from
20 | // COM, set the ComVisible attribute to true on that type.
21 | [assembly: ComVisible(false)]
22 |
23 | // The following GUID is for the ID of the typelib if this project is exposed to COM
24 | [assembly: Guid("be3fa57e-add2-49cd-8ab9-8bbd4aaa2b48")]
25 |
26 | [assembly: AssemblyVersion("0.7")]
27 | [assembly: AssemblyFileVersion("0.7")]
28 | [assembly: AssemblyInformationalVersion("0.7-alpha")]
29 | [assembly: CLSCompliant(true)]
30 |
--------------------------------------------------------------------------------
/src/test/StartupConvention1/Web.Debug.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
17 |
18 |
29 |
30 |
--------------------------------------------------------------------------------
/src/test/StartupConvention2/Web.Debug.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
17 |
18 |
29 |
30 |
--------------------------------------------------------------------------------
/src/test/StartupConvention1/Web.Release.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
17 |
18 |
19 |
30 |
31 |
--------------------------------------------------------------------------------
/src/test/StartupConvention2/Web.Release.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
17 |
18 |
19 |
30 |
31 |
--------------------------------------------------------------------------------
/src/main/Owin.Loader/NullLoader.cs:
--------------------------------------------------------------------------------
1 | // Licensed to Monkey Square, Inc. under one or more contributor
2 | // license agreements. See the NOTICE file distributed with
3 | // this work or additional information regarding copyright
4 | // ownership. Monkey Square, Inc. licenses this file to you
5 | // under the Apache License, Version 2.0 (the "License"); you
6 | // may not use this file except in compliance with the License.
7 | // You may obtain a copy of the License at
8 | //
9 | // http://www.apache.org/licenses/LICENSE-2.0
10 | //
11 | // Unless required by applicable law or agreed to in writing,
12 | // software distributed under the License is distributed on an
13 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | // KIND, either express or implied. See the License for the
15 | // specific language governing permissions and limitations
16 | // under the License.
17 |
18 | using System;
19 | using System.Diagnostics.CodeAnalysis;
20 |
21 | namespace Owin.Loader
22 | {
23 | public class NullLoader
24 | {
25 | private static readonly NullLoader Singleton = new NullLoader();
26 |
27 | [SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Justification = "By design")]
28 | public static Func> Instance
29 | {
30 | get { return Singleton.Load; }
31 | }
32 |
33 | public Action Load(string startup)
34 | {
35 | return null;
36 | }
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/src/main/Owin.Types/OwinWebSocketParameters.cs:
--------------------------------------------------------------------------------
1 | // Licensed to Monkey Square, Inc. under one or more contributor
2 | // license agreements. See the NOTICE file distributed with
3 | // this work or additional information regarding copyright
4 | // ownership. Monkey Square, Inc. licenses this file to you
5 | // under the Apache License, Version 2.0 (the "License"); you
6 | // may not use this file except in compliance with the License.
7 | // You may obtain a copy of the License at
8 | //
9 | // http://www.apache.org/licenses/LICENSE-2.0
10 | //
11 | // Unless required by applicable law or agreed to in writing,
12 | // software distributed under the License is distributed on an
13 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | // KIND, either express or implied. See the License for the
15 | // specific language governing permissions and limitations
16 | // under the License.
17 |
18 | using System;
19 | using System.Collections.Concurrent;
20 |
21 | namespace Owin.Types
22 | {
23 | public partial struct OwinWebSocketParameters
24 | {
25 | public static OwinWebSocketParameters Create()
26 | {
27 | return new OwinWebSocketParameters(new ConcurrentDictionary(StringComparer.Ordinal));
28 | }
29 |
30 | public static OwinWebSocketParameters Create(string subProtocol)
31 | {
32 | return new OwinWebSocketParameters(new ConcurrentDictionary(StringComparer.Ordinal))
33 | {
34 | SubProtocol = subProtocol
35 | };
36 | }
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/src/test/Owin.Types.Tests/OwinResponseSendFileTests.cs:
--------------------------------------------------------------------------------
1 | using System.Threading;
2 | using Shouldly;
3 | using Xunit;
4 |
5 | namespace Owin.Types.Tests
6 | {
7 | public class OwinResponseSendFileTests
8 | {
9 | [Fact]
10 | public void SendAsyncKeyDeterminesIfYouCanCallSendFileAsync()
11 | {
12 | var res = new OwinResponse(OwinRequest.Create());
13 | res.CanSendFile.ShouldBe(false);
14 | res.SendFileAsyncDelegate = (a, b, c, d) => null;
15 | res.CanSendFile.ShouldBe(true);
16 | }
17 |
18 | [Fact]
19 | public void CallingMethodInvokesDelegate()
20 | {
21 | var res = new OwinResponse(OwinRequest.Create());
22 | res.CanSendFile.ShouldBe(false);
23 |
24 | string aa = null;
25 | long bb = 0;
26 | long? cc = null;
27 | CancellationToken dd = CancellationToken.None;
28 |
29 | var cts = new CancellationTokenSource();
30 |
31 | res.SendFileAsyncDelegate = (a, b, c, d) =>
32 | {
33 | aa = a;
34 | bb = b;
35 | cc = c;
36 | dd = d;
37 | return null;
38 | };
39 | res.SendFileAsync("one", 2, 3, cts.Token);
40 | aa.ShouldBe("one");
41 | bb.ShouldBe(2);
42 | cc.ShouldBe(3);
43 | dd.ShouldBe(cts.Token);
44 |
45 | res.SendFileAsync("four");
46 | aa.ShouldBe("four");
47 | bb.ShouldBe(0);
48 | cc.ShouldBe(null);
49 | dd.ShouldBe(CancellationToken.None);
50 | }
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/src/main/Owin.Types/OwinOpaque.Spec-Opaque.cs:
--------------------------------------------------------------------------------
1 | // Licensed to Monkey Square, Inc. under one or more contributor
2 | // license agreements. See the NOTICE file distributed with
3 | // this work or additional information regarding copyright
4 | // ownership. Monkey Square, Inc. licenses this file to you
5 | // under the Apache License, Version 2.0 (the "License"); you
6 | // may not use this file except in compliance with the License.
7 | // You may obtain a copy of the License at
8 | //
9 | // http://www.apache.org/licenses/LICENSE-2.0
10 | //
11 | // Unless required by applicable law or agreed to in writing,
12 | // software distributed under the License is distributed on an
13 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | // KIND, either express or implied. See the License for the
15 | // specific language governing permissions and limitations
16 | // under the License.
17 |
18 | using System.IO;
19 | using System.Threading;
20 |
21 | namespace Owin.Types
22 | {
23 | public partial struct OwinOpaque
24 | {
25 | public string Version
26 | {
27 | get { return Get(OwinConstants.Opaque.Version); }
28 | set { Set(OwinConstants.Opaque.Version, value); }
29 | }
30 |
31 | public CancellationToken CallCancelled
32 | {
33 | get { return Get(OwinConstants.Opaque.CallCancelled); }
34 | set { Set(OwinConstants.Opaque.CallCancelled, value); }
35 | }
36 |
37 | public Stream Stream
38 | {
39 | get { return Get(OwinConstants.Opaque.Stream); }
40 | set { Set(OwinConstants.Opaque.Stream, value); }
41 | }
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/src/main/Owin.Builder/NotFound.cs:
--------------------------------------------------------------------------------
1 | // Licensed to Monkey Square, Inc. under one or more contributor
2 | // license agreements. See the NOTICE file distributed with
3 | // this work or additional information regarding copyright
4 | // ownership. Monkey Square, Inc. licenses this file to you
5 | // under the Apache License, Version 2.0 (the "License"); you
6 | // may not use this file except in compliance with the License.
7 | // You may obtain a copy of the License at
8 | //
9 | // http://www.apache.org/licenses/LICENSE-2.0
10 | //
11 | // Unless required by applicable law or agreed to in writing,
12 | // software distributed under the License is distributed on an
13 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | // KIND, either express or implied. See the License for the
15 | // specific language governing permissions and limitations
16 | // under the License.
17 |
18 | using System.Collections.Generic;
19 | using System.Threading.Tasks;
20 |
21 | namespace Owin.Builder
22 | {
23 | ///
24 | /// Simple object used by AppBuilder as seed OWIN callable if the
25 | /// builder.Properties["builder.DefaultApp"] is not set
26 | ///
27 | internal class NotFound
28 | {
29 | private static readonly Task Completed = CreateCompletedTask();
30 |
31 | private static Task CreateCompletedTask()
32 | {
33 | var tcs = new TaskCompletionSource