Updating abstractions
This commit is contained in:
parent
f7a4db4ae1
commit
d6cd02d121
|
|
@ -26,6 +26,7 @@ EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.AspNet.Abstractions.Owin.net45", "src\Microsoft.AspNet.Abstractions.Owin\Microsoft.AspNet.Abstractions.Owin.net45.csproj", "{E6B7056F-547E-4B96-9E58-858DDDAE75D3}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.AspNet.Abstractions.Owin.net45", "src\Microsoft.AspNet.Abstractions.Owin\Microsoft.AspNet.Abstractions.Owin.net45.csproj", "{E6B7056F-547E-4B96-9E58-858DDDAE75D3}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.AspNet.Abstractions.Owin.k10", "src\Microsoft.AspNet.Abstractions.Owin\Microsoft.AspNet.Abstractions.Owin.k10.csproj", "{C5C104A4-EE38-4D77-AC77-DF599FD5443A}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.AspNet.Abstractions.Owin.k10", "src\Microsoft.AspNet.Abstractions.Owin\Microsoft.AspNet.Abstractions.Owin.k10.csproj", "{C5C104A4-EE38-4D77-AC77-DF599FD5443A}"
|
||||||
|
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,15 @@
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace Microsoft.AspNet.Abstractions
|
namespace Microsoft.AspNet.Abstractions
|
||||||
{
|
{
|
||||||
public abstract class HttpContext : IDisposable
|
public abstract class HttpContext : IDisposable
|
||||||
{
|
{
|
||||||
// TODO - review IOwinContext for properties
|
|
||||||
|
|
||||||
public abstract HttpRequest Request { get; }
|
public abstract HttpRequest Request { get; }
|
||||||
|
|
||||||
public abstract HttpResponse Response { get; }
|
public abstract HttpResponse Response { get; }
|
||||||
|
|
||||||
|
public abstract IDictionary<object, object> Items { get; }
|
||||||
|
|
||||||
public abstract void Dispose();
|
public abstract void Dispose();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ namespace Microsoft.AspNet.PipelineCore
|
||||||
}
|
}
|
||||||
|
|
||||||
public override HttpRequest Request { get { return _request; } }
|
public override HttpRequest Request { get { return _request; } }
|
||||||
|
|
||||||
public override HttpResponse Response { get { return _response; } }
|
public override HttpResponse Response { get { return _response; } }
|
||||||
|
|
||||||
public int Revision { get { return _environment.Revision; } }
|
public int Revision { get { return _environment.Revision; } }
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
using Microsoft.AspNet.Abstractions;
|
using Microsoft.AspNet.Abstractions;
|
||||||
|
using Microsoft.AspNet.PipelineCore.Collections;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
@ -514,21 +515,32 @@ namespace Microsoft.AspNet.PipelineCore.Infrastructure
|
||||||
|
|
||||||
private static readonly char[] SemicolonAndComma = new[] { ';', ',' };
|
private static readonly char[] SemicolonAndComma = new[] { ';', ',' };
|
||||||
|
|
||||||
|
internal static T GetItem<T>(HttpRequest request, string key)
|
||||||
|
{
|
||||||
|
object value;
|
||||||
|
return request.HttpContext.Items.TryGetValue(key, out value) ? (T)value : default(T);
|
||||||
|
}
|
||||||
|
|
||||||
|
internal static void SetItem<T>(HttpRequest request, string key, T value)
|
||||||
|
{
|
||||||
|
request.HttpContext.Items[key] = value;
|
||||||
|
}
|
||||||
|
|
||||||
internal static IDictionary<string, string> GetCookies(HttpRequest request)
|
internal static IDictionary<string, string> GetCookies(HttpRequest request)
|
||||||
{
|
{
|
||||||
var cookies = request.Get<IDictionary<string, string>>("Microsoft.Owin.Cookies#dictionary");
|
var cookies = GetItem<IDictionary<string, string>>(request, "Microsoft.Owin.Cookies#dictionary");
|
||||||
if (cookies == null)
|
if (cookies == null)
|
||||||
{
|
{
|
||||||
cookies = new Dictionary<string, string>(StringComparer.Ordinal);
|
cookies = new Dictionary<string, string>(StringComparer.Ordinal);
|
||||||
request.Set("Microsoft.Owin.Cookies#dictionary", cookies);
|
SetItem(request, "Microsoft.Owin.Cookies#dictionary", cookies);
|
||||||
}
|
}
|
||||||
|
|
||||||
string text = GetHeader(request.Headers, "Cookie");
|
string text = GetHeader(request.Headers, "Cookie");
|
||||||
if (request.Get<string>("Microsoft.Owin.Cookies#text") != text)
|
if (GetItem<string>(request, "Microsoft.Owin.Cookies#text") != text)
|
||||||
{
|
{
|
||||||
cookies.Clear();
|
cookies.Clear();
|
||||||
ParseDelimited(text, SemicolonAndComma, AddCookieCallback, cookies);
|
ParseDelimited(text, SemicolonAndComma, AddCookieCallback, cookies);
|
||||||
request.Set("Microsoft.Owin.Cookies#text", text);
|
SetItem(request, "Microsoft.Owin.Cookies#text", text);
|
||||||
}
|
}
|
||||||
return cookies;
|
return cookies;
|
||||||
}
|
}
|
||||||
|
|
@ -570,14 +582,9 @@ namespace Microsoft.AspNet.PipelineCore.Infrastructure
|
||||||
scanIndex = delimiterIndex + 1;
|
scanIndex = delimiterIndex + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static string GetJoinedValue(IDictionary<string, string[]> Store, string key)
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static partial class OwinHelpers
|
internal static partial class ParsingHelpers
|
||||||
{
|
{
|
||||||
public static string GetHeader(IDictionary<string, string[]> headers, string key)
|
public static string GetHeader(IDictionary<string, string[]> headers, string key)
|
||||||
{
|
{
|
||||||
|
|
@ -768,7 +775,7 @@ namespace Microsoft.AspNet.PipelineCore.Infrastructure
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static partial class OwinHelpers
|
internal static partial class ParsingHelpers
|
||||||
{
|
{
|
||||||
private static readonly Action<string, string, object> AppendItemCallback = (name, value, state) =>
|
private static readonly Action<string, string, object> AppendItemCallback = (name, value, state) =>
|
||||||
{
|
{
|
||||||
|
|
@ -789,15 +796,15 @@ namespace Microsoft.AspNet.PipelineCore.Infrastructure
|
||||||
|
|
||||||
internal static IDictionary<string, string[]> GetQuery(HttpRequest request)
|
internal static IDictionary<string, string[]> GetQuery(HttpRequest request)
|
||||||
{
|
{
|
||||||
var query = request.Get<IDictionary<string, string[]>>("Microsoft.Owin.Query#dictionary");
|
var query = GetItem<IDictionary<string, string[]>>(request, "Microsoft.Owin.Query#dictionary");
|
||||||
if (query == null)
|
if (query == null)
|
||||||
{
|
{
|
||||||
query = new Dictionary<string, string[]>(StringComparer.OrdinalIgnoreCase);
|
query = new Dictionary<string, string[]>(StringComparer.OrdinalIgnoreCase);
|
||||||
request.Set("Microsoft.Owin.Query#dictionary", query);
|
SetItem(request, "Microsoft.Owin.Query#dictionary", query);
|
||||||
}
|
}
|
||||||
|
|
||||||
string text = request.QueryString.Value;
|
string text = request.QueryString.Value;
|
||||||
if (request.Get<string>("Microsoft.Owin.Query#text") != text)
|
if (GetItem<string>(request, "Microsoft.Owin.Query#text") != text)
|
||||||
{
|
{
|
||||||
query.Clear();
|
query.Clear();
|
||||||
var accumulator = new Dictionary<string, List<string>>(StringComparer.OrdinalIgnoreCase);
|
var accumulator = new Dictionary<string, List<string>>(StringComparer.OrdinalIgnoreCase);
|
||||||
|
|
@ -806,7 +813,7 @@ namespace Microsoft.AspNet.PipelineCore.Infrastructure
|
||||||
{
|
{
|
||||||
query.Add(kv.Key, kv.Value.ToArray());
|
query.Add(kv.Key, kv.Value.ToArray());
|
||||||
}
|
}
|
||||||
request.Set("Microsoft.Owin.Query#text", text);
|
SetItem(request, "Microsoft.Owin.Query#text", text);
|
||||||
}
|
}
|
||||||
return query;
|
return query;
|
||||||
}
|
}
|
||||||
|
|
@ -842,7 +849,7 @@ namespace Microsoft.AspNet.PipelineCore.Infrastructure
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static partial class OwinHelpers
|
internal static partial class ParsingHelpers
|
||||||
{
|
{
|
||||||
internal static string GetHost(HttpRequest request)
|
internal static string GetHost(HttpRequest request)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,80 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||||
|
<PropertyGroup>
|
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
|
<ProjectGuid>{68A538BA-D542-49CB-9615-B4F5A4E78C87}</ProjectGuid>
|
||||||
|
<OutputType>Library</OutputType>
|
||||||
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
|
<RootNamespace>Microsoft.AspNet.PipelineCore</RootNamespace>
|
||||||
|
<AssemblyName>Microsoft.AspNet.PipelineCore</AssemblyName>
|
||||||
|
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||||
|
<FileAlignment>512</FileAlignment>
|
||||||
|
<BaseIntermediateOutputPath>obj/net45</BaseIntermediateOutputPath>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<Optimize>false</Optimize>
|
||||||
|
<OutputPath>bin\Debug\net45</OutputPath>
|
||||||
|
<DefineConstants>DEBUG;TRACE;NET45</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<OutputPath>bin\Release\net45</OutputPath>
|
||||||
|
<DefineConstants>TRACE;NET45</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="mscorlib" />
|
||||||
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.Core" />
|
||||||
|
<Reference Include="Microsoft.CSharp" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="Builder.cs" />
|
||||||
|
<Compile Include="Collections\FormCollection.cs" />
|
||||||
|
<Compile Include="Collections\HeaderDictionary.cs" />
|
||||||
|
<Compile Include="Collections\ReadableStringCollection.cs" />
|
||||||
|
<Compile Include="Collections\RequestCookieCollection.cs" />
|
||||||
|
<Compile Include="Collections\ResponseCookieCollection.cs" />
|
||||||
|
<Compile Include="DefaultHttpContext.cs" />
|
||||||
|
<Compile Include="DefaultHttpRequest.cs" />
|
||||||
|
<Compile Include="DefaultHttpResponse.cs" />
|
||||||
|
<Compile Include="Infrastructure\Constants.cs" />
|
||||||
|
<Compile Include="Infrastructure\ParsingHelpers.cs" />
|
||||||
|
<Compile Include="Owin\OwinConstants.cs" />
|
||||||
|
<Compile Include="Owin\OwinHttpEnvironment.cs" />
|
||||||
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
<Content Include="project.json" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\..\src\Microsoft.AspNet.FeatureModel\Microsoft.AspNet.FeatureModel.net45.csproj">
|
||||||
|
<Project>{95AEE59D-BF51-47CB-A957-C03D909CC148}</Project>
|
||||||
|
<Name>Microsoft.AspNet.FeatureModel</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\..\src\Microsoft.AspNet.Abstractions\Microsoft.AspNet.Abstractions.net45.csproj">
|
||||||
|
<Project>{D36288AF-8A0E-48DD-8AF8-15B72F91C70A}</Project>
|
||||||
|
<Name>Microsoft.AspNet.Abstractions</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\..\src\Microsoft.AspNet.HttpFeature\Microsoft.AspNet.HttpFeature.net45.csproj">
|
||||||
|
<Project>{A6DEB0D3-982E-4A07-8EE7-39269F192AF7}</Project>
|
||||||
|
<Name>Microsoft.AspNet.HttpFeature</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
|
<Target Name="BeforeBuild">
|
||||||
|
</Target>
|
||||||
|
<Target Name="AfterBuild">
|
||||||
|
</Target>
|
||||||
|
-->
|
||||||
|
</Project>
|
||||||
Loading…
Reference in New Issue