Rename all feature interfaces to I*Feature.
This commit is contained in:
parent
f11e62d0ef
commit
7fd80850ee
|
|
@ -21,7 +21,7 @@ using Microsoft.Net.Runtime;
|
||||||
namespace Microsoft.AspNet.HttpFeature
|
namespace Microsoft.AspNet.HttpFeature
|
||||||
{
|
{
|
||||||
[AssemblyNeutral]
|
[AssemblyNeutral]
|
||||||
public interface IHttpApplicationInformation
|
public interface IHttpApplicationFeature
|
||||||
{
|
{
|
||||||
string AppName { get; set; }
|
string AppName { get; set; }
|
||||||
string AppMode { get; set; }
|
string AppMode { get; set; }
|
||||||
|
|
@ -20,7 +20,7 @@ using Microsoft.Net.Runtime;
|
||||||
namespace Microsoft.AspNet.HttpFeature
|
namespace Microsoft.AspNet.HttpFeature
|
||||||
{
|
{
|
||||||
[AssemblyNeutral]
|
[AssemblyNeutral]
|
||||||
public interface IHttpBuffering
|
public interface IHttpBufferingFeature
|
||||||
{
|
{
|
||||||
void DisableRequestBuffering();
|
void DisableRequestBuffering();
|
||||||
void DisableResponseBuffering();
|
void DisableResponseBuffering();
|
||||||
|
|
@ -21,7 +21,7 @@ using Microsoft.Net.Runtime;
|
||||||
namespace Microsoft.AspNet.HttpFeature
|
namespace Microsoft.AspNet.HttpFeature
|
||||||
{
|
{
|
||||||
[AssemblyNeutral]
|
[AssemblyNeutral]
|
||||||
public interface IHttpConnection
|
public interface IHttpConnectionFeature
|
||||||
{
|
{
|
||||||
IPAddress RemoteIpAddress { get; set; }
|
IPAddress RemoteIpAddress { get; set; }
|
||||||
IPAddress LocalIpAddress { get; set; }
|
IPAddress LocalIpAddress { get; set; }
|
||||||
|
|
@ -23,7 +23,7 @@ using Microsoft.Net.Runtime;
|
||||||
namespace Microsoft.AspNet.HttpFeature
|
namespace Microsoft.AspNet.HttpFeature
|
||||||
{
|
{
|
||||||
[AssemblyNeutral]
|
[AssemblyNeutral]
|
||||||
public interface IHttpRequestInformation
|
public interface IHttpRequestFeature
|
||||||
{
|
{
|
||||||
string Protocol { get; set; }
|
string Protocol { get; set; }
|
||||||
string Scheme { get; set; }
|
string Scheme { get; set; }
|
||||||
|
|
@ -33,11 +33,5 @@ namespace Microsoft.AspNet.HttpFeature
|
||||||
string QueryString { get; set; }
|
string QueryString { get; set; }
|
||||||
IDictionary<string, string[]> Headers { get; set; }
|
IDictionary<string, string[]> Headers { get; set; }
|
||||||
Stream Body { get; set; }
|
Stream Body { get; set; }
|
||||||
// FURI: Uri Uri { get; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public interface ICanHasSession
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -21,7 +21,7 @@ using Microsoft.Net.Runtime;
|
||||||
namespace Microsoft.AspNet.HttpFeature
|
namespace Microsoft.AspNet.HttpFeature
|
||||||
{
|
{
|
||||||
[AssemblyNeutral]
|
[AssemblyNeutral]
|
||||||
public interface IHttpRequestLifetime
|
public interface IHttpRequestLifetimeFeature
|
||||||
{
|
{
|
||||||
CancellationToken OnRequestAborted { get; }
|
CancellationToken OnRequestAborted { get; }
|
||||||
void Abort();
|
void Abort();
|
||||||
|
|
@ -23,7 +23,7 @@ using Microsoft.Net.Runtime;
|
||||||
namespace Microsoft.AspNet.HttpFeature
|
namespace Microsoft.AspNet.HttpFeature
|
||||||
{
|
{
|
||||||
[AssemblyNeutral]
|
[AssemblyNeutral]
|
||||||
public interface IHttpResponseInformation
|
public interface IHttpResponseFeature
|
||||||
{
|
{
|
||||||
int StatusCode { get; set; }
|
int StatusCode { get; set; }
|
||||||
string ReasonPhrase { get; set; }
|
string ReasonPhrase { get; set; }
|
||||||
|
|
@ -22,7 +22,7 @@ using Microsoft.Net.Runtime;
|
||||||
namespace Microsoft.AspNet.HttpFeature
|
namespace Microsoft.AspNet.HttpFeature
|
||||||
{
|
{
|
||||||
[AssemblyNeutral]
|
[AssemblyNeutral]
|
||||||
public interface IHttpSendFile
|
public interface IHttpSendFileFeature
|
||||||
{
|
{
|
||||||
Task SendFileAsync(string path, long offset, long? length, CancellationToken cancellation);
|
Task SendFileAsync(string path, long offset, long? length, CancellationToken cancellation);
|
||||||
}
|
}
|
||||||
|
|
@ -22,7 +22,7 @@ using Microsoft.Net.Runtime;
|
||||||
namespace Microsoft.AspNet.HttpFeature
|
namespace Microsoft.AspNet.HttpFeature
|
||||||
{
|
{
|
||||||
[AssemblyNeutral]
|
[AssemblyNeutral]
|
||||||
public interface IHttpTransportLayerSecurity
|
public interface IHttpTransportLayerSecurityFeature
|
||||||
{
|
{
|
||||||
X509Certificate ClientCertificate { get; set; }
|
X509Certificate ClientCertificate { get; set; }
|
||||||
Task LoadAsync();
|
Task LoadAsync();
|
||||||
|
|
@ -23,7 +23,7 @@ using Microsoft.Net.Runtime;
|
||||||
namespace Microsoft.AspNet.HttpFeature
|
namespace Microsoft.AspNet.HttpFeature
|
||||||
{
|
{
|
||||||
[AssemblyNeutral]
|
[AssemblyNeutral]
|
||||||
public interface IHttpWebSocketAccept
|
public interface IHttpWebSocketFeature
|
||||||
{
|
{
|
||||||
bool IsWebSocketRequest { get; set; }
|
bool IsWebSocketRequest { get; set; }
|
||||||
Task<WebSocket> AcceptAsync();
|
Task<WebSocket> AcceptAsync();
|
||||||
|
|
@ -20,20 +20,21 @@
|
||||||
<Content Include="Project.json" />
|
<Content Include="Project.json" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="IHttpApplicationInformation.cs" />
|
<Compile Include="AssemblyNeutralAttribute.cs" />
|
||||||
<Compile Include="IHttpBuffering.cs" />
|
<Compile Include="IHttpApplicationFeature.cs" />
|
||||||
<Compile Include="IHttpConnection.cs" />
|
<Compile Include="IHttpBufferingFeature.cs" />
|
||||||
<Compile Include="IHttpRequestInformation.cs" />
|
<Compile Include="IHttpConnectionFeature.cs" />
|
||||||
<Compile Include="IHttpRequestLifetime.cs" />
|
<Compile Include="IHttpRequestFeature.cs" />
|
||||||
<Compile Include="IHttpResponseInformation.cs" />
|
<Compile Include="IHttpRequestLifetimeFeature.cs" />
|
||||||
<Compile Include="IHttpSendFile.cs" />
|
<Compile Include="IHttpResponseFeature.cs" />
|
||||||
<Compile Include="IHttpTransportLayerSecurity.cs" />
|
<Compile Include="IHttpSendFileFeature.cs" />
|
||||||
<Compile Include="IHttpWebSocketAccept.cs" />
|
<Compile Include="IHttpTransportLayerSecurityFeature.cs" />
|
||||||
|
<Compile Include="IHttpWebSocketFeature.cs" />
|
||||||
<Compile Include="Security\IAuthenticateContext.cs" />
|
<Compile Include="Security\IAuthenticateContext.cs" />
|
||||||
<Compile Include="Security\IAuthenticationHandler.cs" />
|
<Compile Include="Security\IAuthenticationHandler.cs" />
|
||||||
<Compile Include="Security\IAuthTypeContext.cs" />
|
<Compile Include="Security\IAuthTypeContext.cs" />
|
||||||
<Compile Include="Security\IChallengeContext.cs" />
|
<Compile Include="Security\IChallengeContext.cs" />
|
||||||
<Compile Include="Security\IHttpAuthentication.cs" />
|
<Compile Include="Security\IHttpAuthenticationFeature.cs" />
|
||||||
<Compile Include="Security\ISignInContext.cs" />
|
<Compile Include="Security\ISignInContext.cs" />
|
||||||
<Compile Include="Security\ISignOutContext .cs" />
|
<Compile Include="Security\ISignOutContext .cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ using Microsoft.Net.Runtime;
|
||||||
namespace Microsoft.AspNet.HttpFeature.Security
|
namespace Microsoft.AspNet.HttpFeature.Security
|
||||||
{
|
{
|
||||||
[AssemblyNeutral]
|
[AssemblyNeutral]
|
||||||
public interface IHttpAuthentication
|
public interface IHttpAuthenticationFeature
|
||||||
{
|
{
|
||||||
ClaimsPrincipal User { get; set; }
|
ClaimsPrincipal User { get; set; }
|
||||||
IAuthenticationHandler Handler { get; set; }
|
IAuthenticationHandler Handler { get; set; }
|
||||||
|
|
@ -19,7 +19,7 @@ using System.Collections.Generic;
|
||||||
|
|
||||||
namespace Microsoft.AspNet.Owin
|
namespace Microsoft.AspNet.Owin
|
||||||
{
|
{
|
||||||
public interface ICanHasOwinEnvironment
|
public interface IOwinEnvironmentFeature
|
||||||
{
|
{
|
||||||
IDictionary<string, object> Environment { get; set; }
|
IDictionary<string, object> Environment { get; set; }
|
||||||
}
|
}
|
||||||
|
|
@ -20,7 +20,7 @@
|
||||||
<Content Include="Project.json" />
|
<Content Include="Project.json" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="ICanHasOwinEnvironment.cs" />
|
<Compile Include="IOwinEnvironmentFeature.cs" />
|
||||||
<Compile Include="OwinConstants.cs" />
|
<Compile Include="OwinConstants.cs" />
|
||||||
<Compile Include="OwinEnvironment.cs" />
|
<Compile Include="OwinEnvironment.cs" />
|
||||||
<Compile Include="OwinExtensions.cs" />
|
<Compile Include="OwinExtensions.cs" />
|
||||||
|
|
|
||||||
|
|
@ -42,41 +42,41 @@ namespace Microsoft.AspNet.Owin
|
||||||
_context = context;
|
_context = context;
|
||||||
_entries = new Dictionary<string, FeatureMap>()
|
_entries = new Dictionary<string, FeatureMap>()
|
||||||
{
|
{
|
||||||
{ OwinConstants.RequestProtocol, new FeatureMap<IHttpRequestInformation>(feature => feature.Protocol, (feature, value) => feature.Protocol = Convert.ToString(value)) },
|
{ OwinConstants.RequestProtocol, new FeatureMap<IHttpRequestFeature>(feature => feature.Protocol, (feature, value) => feature.Protocol = Convert.ToString(value)) },
|
||||||
{ OwinConstants.RequestScheme, new FeatureMap<IHttpRequestInformation>(feature => feature.Scheme, (feature, value) => feature.Scheme = Convert.ToString(value)) },
|
{ OwinConstants.RequestScheme, new FeatureMap<IHttpRequestFeature>(feature => feature.Scheme, (feature, value) => feature.Scheme = Convert.ToString(value)) },
|
||||||
{ OwinConstants.RequestMethod, new FeatureMap<IHttpRequestInformation>(feature => feature.Method, (feature, value) => feature.Method = Convert.ToString(value)) },
|
{ OwinConstants.RequestMethod, new FeatureMap<IHttpRequestFeature>(feature => feature.Method, (feature, value) => feature.Method = Convert.ToString(value)) },
|
||||||
{ OwinConstants.RequestPathBase, new FeatureMap<IHttpRequestInformation>(feature => feature.PathBase, (feature, value) => feature.PathBase = Convert.ToString(value)) },
|
{ OwinConstants.RequestPathBase, new FeatureMap<IHttpRequestFeature>(feature => feature.PathBase, (feature, value) => feature.PathBase = Convert.ToString(value)) },
|
||||||
{ OwinConstants.RequestPath, new FeatureMap<IHttpRequestInformation>(feature => feature.Path, (feature, value) => feature.Path = Convert.ToString(value)) },
|
{ OwinConstants.RequestPath, new FeatureMap<IHttpRequestFeature>(feature => feature.Path, (feature, value) => feature.Path = Convert.ToString(value)) },
|
||||||
{ OwinConstants.RequestQueryString, new FeatureMap<IHttpRequestInformation>(feature => feature.QueryString, (feature, value) => feature.QueryString = Convert.ToString(value)) },
|
{ OwinConstants.RequestQueryString, new FeatureMap<IHttpRequestFeature>(feature => feature.QueryString, (feature, value) => feature.QueryString = Convert.ToString(value)) },
|
||||||
{ OwinConstants.RequestHeaders, new FeatureMap<IHttpRequestInformation>(feature => feature.Headers, (feature, value) => feature.Headers = (IDictionary<string, string[]>)value) },
|
{ OwinConstants.RequestHeaders, new FeatureMap<IHttpRequestFeature>(feature => feature.Headers, (feature, value) => feature.Headers = (IDictionary<string, string[]>)value) },
|
||||||
{ OwinConstants.RequestBody, new FeatureMap<IHttpRequestInformation>(feature => feature.Body, (feature, value) => feature.Body = (Stream)value) },
|
{ OwinConstants.RequestBody, new FeatureMap<IHttpRequestFeature>(feature => feature.Body, (feature, value) => feature.Body = (Stream)value) },
|
||||||
|
|
||||||
{ OwinConstants.ResponseStatusCode, new FeatureMap<IHttpResponseInformation>(feature => feature.StatusCode, (feature, value) => feature.StatusCode = Convert.ToInt32(value)) },
|
{ OwinConstants.ResponseStatusCode, new FeatureMap<IHttpResponseFeature>(feature => feature.StatusCode, (feature, value) => feature.StatusCode = Convert.ToInt32(value)) },
|
||||||
{ OwinConstants.ResponseReasonPhrase, new FeatureMap<IHttpResponseInformation>(feature => feature.ReasonPhrase, (feature, value) => feature.ReasonPhrase = Convert.ToString(value)) },
|
{ OwinConstants.ResponseReasonPhrase, new FeatureMap<IHttpResponseFeature>(feature => feature.ReasonPhrase, (feature, value) => feature.ReasonPhrase = Convert.ToString(value)) },
|
||||||
{ OwinConstants.ResponseHeaders, new FeatureMap<IHttpResponseInformation>(feature => feature.Headers, (feature, value) => feature.Headers = (IDictionary<string, string[]>)value) },
|
{ OwinConstants.ResponseHeaders, new FeatureMap<IHttpResponseFeature>(feature => feature.Headers, (feature, value) => feature.Headers = (IDictionary<string, string[]>)value) },
|
||||||
{ OwinConstants.ResponseBody, new FeatureMap<IHttpResponseInformation>(feature => feature.Body, (feature, value) => feature.Body = (Stream)value) },
|
{ OwinConstants.ResponseBody, new FeatureMap<IHttpResponseFeature>(feature => feature.Body, (feature, value) => feature.Body = (Stream)value) },
|
||||||
{ OwinConstants.CommonKeys.OnSendingHeaders, new FeatureMap<IHttpResponseInformation>(feature => new Action<Action<object>, object>(feature.OnSendingHeaders)) },
|
{ OwinConstants.CommonKeys.OnSendingHeaders, new FeatureMap<IHttpResponseFeature>(feature => new Action<Action<object>, object>(feature.OnSendingHeaders)) },
|
||||||
|
|
||||||
{ OwinConstants.CommonKeys.LocalPort, new FeatureMap<IHttpConnection>(feature => feature.LocalPort.ToString(CultureInfo.InvariantCulture),
|
{ OwinConstants.CommonKeys.LocalPort, new FeatureMap<IHttpConnectionFeature>(feature => feature.LocalPort.ToString(CultureInfo.InvariantCulture),
|
||||||
(feature, value) => feature.LocalPort = Convert.ToInt32(value, CultureInfo.InvariantCulture)) },
|
(feature, value) => feature.LocalPort = Convert.ToInt32(value, CultureInfo.InvariantCulture)) },
|
||||||
{ OwinConstants.CommonKeys.RemotePort, new FeatureMap<IHttpConnection>(feature => feature.RemotePort.ToString(CultureInfo.InvariantCulture),
|
{ OwinConstants.CommonKeys.RemotePort, new FeatureMap<IHttpConnectionFeature>(feature => feature.RemotePort.ToString(CultureInfo.InvariantCulture),
|
||||||
(feature, value) => feature.RemotePort = Convert.ToInt32(value, CultureInfo.InvariantCulture)) },
|
(feature, value) => feature.RemotePort = Convert.ToInt32(value, CultureInfo.InvariantCulture)) },
|
||||||
|
|
||||||
{ OwinConstants.CommonKeys.LocalIpAddress, new FeatureMap<IHttpConnection>(feature => feature.LocalIpAddress.ToString(),
|
{ OwinConstants.CommonKeys.LocalIpAddress, new FeatureMap<IHttpConnectionFeature>(feature => feature.LocalIpAddress.ToString(),
|
||||||
(feature, value) => feature.LocalIpAddress = IPAddress.Parse(Convert.ToString(value))) },
|
(feature, value) => feature.LocalIpAddress = IPAddress.Parse(Convert.ToString(value))) },
|
||||||
{ OwinConstants.CommonKeys.RemoteIpAddress, new FeatureMap<IHttpConnection>(feature => feature.RemoteIpAddress.ToString(),
|
{ OwinConstants.CommonKeys.RemoteIpAddress, new FeatureMap<IHttpConnectionFeature>(feature => feature.RemoteIpAddress.ToString(),
|
||||||
(feature, value) => feature.RemoteIpAddress = IPAddress.Parse(Convert.ToString(value))) },
|
(feature, value) => feature.RemoteIpAddress = IPAddress.Parse(Convert.ToString(value))) },
|
||||||
|
|
||||||
{ OwinConstants.CommonKeys.IsLocal, new FeatureMap<IHttpConnection>(feature => feature.IsLocal, (feature, value) => feature.IsLocal = Convert.ToBoolean(value)) },
|
{ OwinConstants.CommonKeys.IsLocal, new FeatureMap<IHttpConnectionFeature>(feature => feature.IsLocal, (feature, value) => feature.IsLocal = Convert.ToBoolean(value)) },
|
||||||
|
|
||||||
{ OwinConstants.SendFiles.SendAsync, new FeatureMap<IHttpSendFile>(feature => new SendFileFunc(feature.SendFileAsync)) },
|
{ OwinConstants.SendFiles.SendAsync, new FeatureMap<IHttpSendFileFeature>(feature => new SendFileFunc(feature.SendFileAsync)) },
|
||||||
};
|
};
|
||||||
|
|
||||||
if (context.Request.IsSecure)
|
if (context.Request.IsSecure)
|
||||||
{
|
{
|
||||||
_entries.Add(OwinConstants.CommonKeys.ClientCertificate, new FeatureMap<IHttpTransportLayerSecurity>(feature => feature.ClientCertificate,
|
_entries.Add(OwinConstants.CommonKeys.ClientCertificate, new FeatureMap<IHttpTransportLayerSecurityFeature>(feature => feature.ClientCertificate,
|
||||||
(feature, value) => feature.ClientCertificate = (X509Certificate)value));
|
(feature, value) => feature.ClientCertificate = (X509Certificate)value));
|
||||||
_entries.Add(OwinConstants.CommonKeys.LoadClientCertAsync, new FeatureMap<IHttpTransportLayerSecurity>(feature => new Func<Task>(feature.LoadAsync)));
|
_entries.Add(OwinConstants.CommonKeys.LoadClientCertAsync, new FeatureMap<IHttpTransportLayerSecurityFeature>(feature => new Func<Task>(feature.LoadAsync)));
|
||||||
}
|
}
|
||||||
|
|
||||||
_context.Items[typeof(HttpContext).FullName] = _context; // Store for lookup when we transition back out of OWIN
|
_context.Items[typeof(HttpContext).FullName] = _context; // Store for lookup when we transition back out of OWIN
|
||||||
|
|
|
||||||
|
|
@ -83,7 +83,7 @@ namespace Microsoft.AspNet
|
||||||
{
|
{
|
||||||
var app = middleware(httpContext =>
|
var app = middleware(httpContext =>
|
||||||
{
|
{
|
||||||
return next(httpContext.GetFeature<ICanHasOwinEnvironment>().Environment);
|
return next(httpContext.GetFeature<IOwinEnvironmentFeature>().Environment);
|
||||||
});
|
});
|
||||||
|
|
||||||
return env =>
|
return env =>
|
||||||
|
|
|
||||||
|
|
@ -34,12 +34,12 @@ namespace Microsoft.AspNet.Owin
|
||||||
|
|
||||||
public class OwinFeatureCollection :
|
public class OwinFeatureCollection :
|
||||||
IFeatureCollection,
|
IFeatureCollection,
|
||||||
IHttpRequestInformation,
|
IHttpRequestFeature,
|
||||||
IHttpResponseInformation,
|
IHttpResponseFeature,
|
||||||
IHttpConnection,
|
IHttpConnectionFeature,
|
||||||
IHttpSendFile,
|
IHttpSendFileFeature,
|
||||||
IHttpTransportLayerSecurity,
|
IHttpTransportLayerSecurityFeature,
|
||||||
ICanHasOwinEnvironment
|
IOwinEnvironmentFeature
|
||||||
{
|
{
|
||||||
public IDictionary<string, object> Environment { get; set; }
|
public IDictionary<string, object> Environment { get; set; }
|
||||||
|
|
||||||
|
|
@ -63,79 +63,79 @@ namespace Microsoft.AspNet.Owin
|
||||||
Environment[key] = value;
|
Environment[key] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
string IHttpRequestInformation.Protocol
|
string IHttpRequestFeature.Protocol
|
||||||
{
|
{
|
||||||
get { return Prop<string>(OwinConstants.RequestProtocol); }
|
get { return Prop<string>(OwinConstants.RequestProtocol); }
|
||||||
set { Prop(OwinConstants.RequestProtocol, value); }
|
set { Prop(OwinConstants.RequestProtocol, value); }
|
||||||
}
|
}
|
||||||
|
|
||||||
string IHttpRequestInformation.Scheme
|
string IHttpRequestFeature.Scheme
|
||||||
{
|
{
|
||||||
get { return Prop<string>(OwinConstants.RequestScheme); }
|
get { return Prop<string>(OwinConstants.RequestScheme); }
|
||||||
set { Prop(OwinConstants.RequestScheme, value); }
|
set { Prop(OwinConstants.RequestScheme, value); }
|
||||||
}
|
}
|
||||||
|
|
||||||
string IHttpRequestInformation.Method
|
string IHttpRequestFeature.Method
|
||||||
{
|
{
|
||||||
get { return Prop<string>(OwinConstants.RequestMethod); }
|
get { return Prop<string>(OwinConstants.RequestMethod); }
|
||||||
set { Prop(OwinConstants.RequestMethod, value); }
|
set { Prop(OwinConstants.RequestMethod, value); }
|
||||||
}
|
}
|
||||||
|
|
||||||
string IHttpRequestInformation.PathBase
|
string IHttpRequestFeature.PathBase
|
||||||
{
|
{
|
||||||
get { return Prop<string>(OwinConstants.RequestPathBase); }
|
get { return Prop<string>(OwinConstants.RequestPathBase); }
|
||||||
set { Prop(OwinConstants.RequestPathBase, value); }
|
set { Prop(OwinConstants.RequestPathBase, value); }
|
||||||
}
|
}
|
||||||
|
|
||||||
string IHttpRequestInformation.Path
|
string IHttpRequestFeature.Path
|
||||||
{
|
{
|
||||||
get { return Prop<string>(OwinConstants.RequestPath); }
|
get { return Prop<string>(OwinConstants.RequestPath); }
|
||||||
set { Prop(OwinConstants.RequestPath, value); }
|
set { Prop(OwinConstants.RequestPath, value); }
|
||||||
}
|
}
|
||||||
|
|
||||||
string IHttpRequestInformation.QueryString
|
string IHttpRequestFeature.QueryString
|
||||||
{
|
{
|
||||||
get { return Prop<string>(OwinConstants.RequestQueryString); }
|
get { return Prop<string>(OwinConstants.RequestQueryString); }
|
||||||
set { Prop(OwinConstants.RequestQueryString, value); }
|
set { Prop(OwinConstants.RequestQueryString, value); }
|
||||||
}
|
}
|
||||||
|
|
||||||
IDictionary<string, string[]> IHttpRequestInformation.Headers
|
IDictionary<string, string[]> IHttpRequestFeature.Headers
|
||||||
{
|
{
|
||||||
get { return Prop<IDictionary<string, string[]>>(OwinConstants.RequestHeaders); }
|
get { return Prop<IDictionary<string, string[]>>(OwinConstants.RequestHeaders); }
|
||||||
set { Prop(OwinConstants.RequestHeaders, value); }
|
set { Prop(OwinConstants.RequestHeaders, value); }
|
||||||
}
|
}
|
||||||
|
|
||||||
Stream IHttpRequestInformation.Body
|
Stream IHttpRequestFeature.Body
|
||||||
{
|
{
|
||||||
get { return Prop<Stream>(OwinConstants.RequestBody); }
|
get { return Prop<Stream>(OwinConstants.RequestBody); }
|
||||||
set { Prop(OwinConstants.RequestBody, value); }
|
set { Prop(OwinConstants.RequestBody, value); }
|
||||||
}
|
}
|
||||||
|
|
||||||
int IHttpResponseInformation.StatusCode
|
int IHttpResponseFeature.StatusCode
|
||||||
{
|
{
|
||||||
get { return Prop<int>(OwinConstants.ResponseStatusCode); }
|
get { return Prop<int>(OwinConstants.ResponseStatusCode); }
|
||||||
set { Prop(OwinConstants.ResponseStatusCode, value); }
|
set { Prop(OwinConstants.ResponseStatusCode, value); }
|
||||||
}
|
}
|
||||||
|
|
||||||
string IHttpResponseInformation.ReasonPhrase
|
string IHttpResponseFeature.ReasonPhrase
|
||||||
{
|
{
|
||||||
get { return Prop<string>(OwinConstants.ResponseReasonPhrase); }
|
get { return Prop<string>(OwinConstants.ResponseReasonPhrase); }
|
||||||
set { Prop(OwinConstants.ResponseReasonPhrase, value); }
|
set { Prop(OwinConstants.ResponseReasonPhrase, value); }
|
||||||
}
|
}
|
||||||
|
|
||||||
IDictionary<string, string[]> IHttpResponseInformation.Headers
|
IDictionary<string, string[]> IHttpResponseFeature.Headers
|
||||||
{
|
{
|
||||||
get { return Prop<IDictionary<string, string[]>>(OwinConstants.ResponseHeaders); }
|
get { return Prop<IDictionary<string, string[]>>(OwinConstants.ResponseHeaders); }
|
||||||
set { Prop(OwinConstants.ResponseHeaders, value); }
|
set { Prop(OwinConstants.ResponseHeaders, value); }
|
||||||
}
|
}
|
||||||
|
|
||||||
Stream IHttpResponseInformation.Body
|
Stream IHttpResponseFeature.Body
|
||||||
{
|
{
|
||||||
get { return Prop<Stream>(OwinConstants.ResponseBody); }
|
get { return Prop<Stream>(OwinConstants.ResponseBody); }
|
||||||
set { Prop(OwinConstants.ResponseBody, value); }
|
set { Prop(OwinConstants.ResponseBody, value); }
|
||||||
}
|
}
|
||||||
|
|
||||||
void IHttpResponseInformation.OnSendingHeaders(Action<object> callback, object state)
|
void IHttpResponseFeature.OnSendingHeaders(Action<object> callback, object state)
|
||||||
{
|
{
|
||||||
var register = Prop<Action<Action<object>, object>>(OwinConstants.CommonKeys.OnSendingHeaders);
|
var register = Prop<Action<Action<object>, object>>(OwinConstants.CommonKeys.OnSendingHeaders);
|
||||||
if (register == null)
|
if (register == null)
|
||||||
|
|
@ -145,31 +145,31 @@ namespace Microsoft.AspNet.Owin
|
||||||
register(callback, state);
|
register(callback, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
IPAddress IHttpConnection.RemoteIpAddress
|
IPAddress IHttpConnectionFeature.RemoteIpAddress
|
||||||
{
|
{
|
||||||
get { return IPAddress.Parse(Prop<string>(OwinConstants.CommonKeys.RemoteIpAddress)); }
|
get { return IPAddress.Parse(Prop<string>(OwinConstants.CommonKeys.RemoteIpAddress)); }
|
||||||
set { Prop(OwinConstants.CommonKeys.RemoteIpAddress, value.ToString()); }
|
set { Prop(OwinConstants.CommonKeys.RemoteIpAddress, value.ToString()); }
|
||||||
}
|
}
|
||||||
|
|
||||||
IPAddress IHttpConnection.LocalIpAddress
|
IPAddress IHttpConnectionFeature.LocalIpAddress
|
||||||
{
|
{
|
||||||
get { return IPAddress.Parse(Prop<string>(OwinConstants.CommonKeys.LocalIpAddress)); }
|
get { return IPAddress.Parse(Prop<string>(OwinConstants.CommonKeys.LocalIpAddress)); }
|
||||||
set { Prop(OwinConstants.CommonKeys.LocalIpAddress, value.ToString()); }
|
set { Prop(OwinConstants.CommonKeys.LocalIpAddress, value.ToString()); }
|
||||||
}
|
}
|
||||||
|
|
||||||
int IHttpConnection.RemotePort
|
int IHttpConnectionFeature.RemotePort
|
||||||
{
|
{
|
||||||
get { return int.Parse(Prop<string>(OwinConstants.CommonKeys.RemotePort)); }
|
get { return int.Parse(Prop<string>(OwinConstants.CommonKeys.RemotePort)); }
|
||||||
set { Prop(OwinConstants.CommonKeys.RemotePort, value.ToString(CultureInfo.InvariantCulture)); }
|
set { Prop(OwinConstants.CommonKeys.RemotePort, value.ToString(CultureInfo.InvariantCulture)); }
|
||||||
}
|
}
|
||||||
|
|
||||||
int IHttpConnection.LocalPort
|
int IHttpConnectionFeature.LocalPort
|
||||||
{
|
{
|
||||||
get { return int.Parse(Prop<string>(OwinConstants.CommonKeys.LocalPort)); }
|
get { return int.Parse(Prop<string>(OwinConstants.CommonKeys.LocalPort)); }
|
||||||
set { Prop(OwinConstants.CommonKeys.LocalPort, value.ToString(CultureInfo.InvariantCulture)); }
|
set { Prop(OwinConstants.CommonKeys.LocalPort, value.ToString(CultureInfo.InvariantCulture)); }
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IHttpConnection.IsLocal
|
bool IHttpConnectionFeature.IsLocal
|
||||||
{
|
{
|
||||||
get { return Prop<bool>(OwinConstants.CommonKeys.IsLocal); }
|
get { return Prop<bool>(OwinConstants.CommonKeys.IsLocal); }
|
||||||
set { Prop(OwinConstants.CommonKeys.LocalPort, value); }
|
set { Prop(OwinConstants.CommonKeys.LocalPort, value); }
|
||||||
|
|
@ -184,7 +184,7 @@ namespace Microsoft.AspNet.Owin
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Task IHttpSendFile.SendFileAsync(string path, long offset, long? length, CancellationToken cancellation)
|
Task IHttpSendFileFeature.SendFileAsync(string path, long offset, long? length, CancellationToken cancellation)
|
||||||
{
|
{
|
||||||
object obj;
|
object obj;
|
||||||
if (Environment.TryGetValue(OwinConstants.SendFiles.SendAsync, out obj))
|
if (Environment.TryGetValue(OwinConstants.SendFiles.SendAsync, out obj))
|
||||||
|
|
@ -200,7 +200,7 @@ namespace Microsoft.AspNet.Owin
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
object obj;
|
object obj;
|
||||||
if (string.Equals("https", ((IHttpRequestInformation)this).Scheme, StringComparison.OrdinalIgnoreCase)
|
if (string.Equals("https", ((IHttpRequestFeature)this).Scheme, StringComparison.OrdinalIgnoreCase)
|
||||||
&& (Environment.TryGetValue(OwinConstants.CommonKeys.LoadClientCertAsync, out obj)
|
&& (Environment.TryGetValue(OwinConstants.CommonKeys.LoadClientCertAsync, out obj)
|
||||||
|| Environment.TryGetValue(OwinConstants.CommonKeys.ClientCertificate, out obj))
|
|| Environment.TryGetValue(OwinConstants.CommonKeys.ClientCertificate, out obj))
|
||||||
&& obj != null)
|
&& obj != null)
|
||||||
|
|
@ -211,13 +211,13 @@ namespace Microsoft.AspNet.Owin
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
X509Certificate IHttpTransportLayerSecurity.ClientCertificate
|
X509Certificate IHttpTransportLayerSecurityFeature.ClientCertificate
|
||||||
{
|
{
|
||||||
get { return Prop<X509Certificate>(OwinConstants.CommonKeys.ClientCertificate); }
|
get { return Prop<X509Certificate>(OwinConstants.CommonKeys.ClientCertificate); }
|
||||||
set { Prop(OwinConstants.CommonKeys.ClientCertificate, value); }
|
set { Prop(OwinConstants.CommonKeys.ClientCertificate, value); }
|
||||||
}
|
}
|
||||||
|
|
||||||
Task IHttpTransportLayerSecurity.LoadAsync()
|
Task IHttpTransportLayerSecurityFeature.LoadAsync()
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
@ -238,11 +238,11 @@ namespace Microsoft.AspNet.Owin
|
||||||
if (key.GetTypeInfo().IsAssignableFrom(this.GetType().GetTypeInfo()))
|
if (key.GetTypeInfo().IsAssignableFrom(this.GetType().GetTypeInfo()))
|
||||||
{
|
{
|
||||||
// Check for conditional features
|
// Check for conditional features
|
||||||
if (key == typeof(IHttpSendFile))
|
if (key == typeof(IHttpSendFileFeature))
|
||||||
{
|
{
|
||||||
return SupportsSendFile;
|
return SupportsSendFile;
|
||||||
}
|
}
|
||||||
else if (key == typeof(IHttpTransportLayerSecurity))
|
else if (key == typeof(IHttpTransportLayerSecurityFeature))
|
||||||
{
|
{
|
||||||
return SupportsClientCerts;
|
return SupportsClientCerts;
|
||||||
}
|
}
|
||||||
|
|
@ -259,18 +259,18 @@ namespace Microsoft.AspNet.Owin
|
||||||
{
|
{
|
||||||
var keys = new List<Type>()
|
var keys = new List<Type>()
|
||||||
{
|
{
|
||||||
typeof(IHttpRequestInformation),
|
typeof(IHttpRequestFeature),
|
||||||
typeof(IHttpResponseInformation),
|
typeof(IHttpResponseFeature),
|
||||||
typeof(IHttpConnection),
|
typeof(IHttpConnectionFeature),
|
||||||
typeof(ICanHasOwinEnvironment),
|
typeof(IOwinEnvironmentFeature),
|
||||||
};
|
};
|
||||||
if (SupportsSendFile)
|
if (SupportsSendFile)
|
||||||
{
|
{
|
||||||
keys.Add(typeof(IHttpSendFile));
|
keys.Add(typeof(IHttpSendFileFeature));
|
||||||
}
|
}
|
||||||
if (SupportsClientCerts)
|
if (SupportsClientCerts)
|
||||||
{
|
{
|
||||||
keys.Add(typeof(IHttpTransportLayerSecurity));
|
keys.Add(typeof(IHttpTransportLayerSecurityFeature));
|
||||||
}
|
}
|
||||||
return keys;
|
return keys;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -36,10 +36,10 @@ namespace Microsoft.AspNet.PipelineCore
|
||||||
private readonly HttpRequest _request;
|
private readonly HttpRequest _request;
|
||||||
private readonly HttpResponse _response;
|
private readonly HttpResponse _response;
|
||||||
|
|
||||||
private FeatureReference<ICanHasItems> _canHasItems;
|
private FeatureReference<IItemsFeature> _items;
|
||||||
private FeatureReference<ICanHasServiceProviders> _canHasServiceProviders;
|
private FeatureReference<IServiceProvidersFeature> _serviceProviders;
|
||||||
private FeatureReference<IHttpAuthentication> _authentication;
|
private FeatureReference<IHttpAuthenticationFeature> _authentication;
|
||||||
private FeatureReference<IHttpRequestLifetime> _lifetime;
|
private FeatureReference<IHttpRequestLifetimeFeature> _lifetime;
|
||||||
private IFeatureCollection _features;
|
private IFeatureCollection _features;
|
||||||
|
|
||||||
public DefaultHttpContext(IFeatureCollection features)
|
public DefaultHttpContext(IFeatureCollection features)
|
||||||
|
|
@ -48,27 +48,27 @@ namespace Microsoft.AspNet.PipelineCore
|
||||||
_request = new DefaultHttpRequest(this, features);
|
_request = new DefaultHttpRequest(this, features);
|
||||||
_response = new DefaultHttpResponse(this, features);
|
_response = new DefaultHttpResponse(this, features);
|
||||||
|
|
||||||
_canHasItems = FeatureReference<ICanHasItems>.Default;
|
_items = FeatureReference<IItemsFeature>.Default;
|
||||||
_canHasServiceProviders = FeatureReference<ICanHasServiceProviders>.Default;
|
_serviceProviders = FeatureReference<IServiceProvidersFeature>.Default;
|
||||||
_authentication = FeatureReference<IHttpAuthentication>.Default;
|
_authentication = FeatureReference<IHttpAuthenticationFeature>.Default;
|
||||||
}
|
}
|
||||||
|
|
||||||
ICanHasItems CanHasItems
|
IItemsFeature ItemsFeature
|
||||||
{
|
{
|
||||||
get { return _canHasItems.Fetch(_features) ?? _canHasItems.Update(_features, new DefaultCanHasItems()); }
|
get { return _items.Fetch(_features) ?? _items.Update(_features, new ItemsFeature()); }
|
||||||
}
|
}
|
||||||
|
|
||||||
ICanHasServiceProviders CanHasServiceProviders
|
IServiceProvidersFeature ServiceProvidersFeature
|
||||||
{
|
{
|
||||||
get { return _canHasServiceProviders.Fetch(_features) ?? _canHasServiceProviders.Update(_features, new DefaultCanHasServiceProviders()); }
|
get { return _serviceProviders.Fetch(_features) ?? _serviceProviders.Update(_features, new ServiceProvidersFeature()); }
|
||||||
}
|
}
|
||||||
|
|
||||||
private IHttpAuthentication HttpAuthentication
|
private IHttpAuthenticationFeature HttpAuthenticationFeature
|
||||||
{
|
{
|
||||||
get { return _authentication.Fetch(_features) ?? _authentication.Update(_features, new DefaultHttpAuthentication()); }
|
get { return _authentication.Fetch(_features) ?? _authentication.Update(_features, new HttpAuthenticationFeature()); }
|
||||||
}
|
}
|
||||||
|
|
||||||
private IHttpRequestLifetime Lifetime
|
private IHttpRequestLifetimeFeature LifetimeFeature
|
||||||
{
|
{
|
||||||
get { return _lifetime.Fetch(_features); }
|
get { return _lifetime.Fetch(_features); }
|
||||||
}
|
}
|
||||||
|
|
@ -81,32 +81,32 @@ namespace Microsoft.AspNet.PipelineCore
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
var user = HttpAuthentication.User;
|
var user = HttpAuthenticationFeature.User;
|
||||||
if (user == null)
|
if (user == null)
|
||||||
{
|
{
|
||||||
user = new ClaimsPrincipal(new ClaimsIdentity());
|
user = new ClaimsPrincipal(new ClaimsIdentity());
|
||||||
HttpAuthentication.User = user;
|
HttpAuthenticationFeature.User = user;
|
||||||
}
|
}
|
||||||
return user;
|
return user;
|
||||||
}
|
}
|
||||||
set { HttpAuthentication.User = value; }
|
set { HttpAuthenticationFeature.User = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override IDictionary<object, object> Items
|
public override IDictionary<object, object> Items
|
||||||
{
|
{
|
||||||
get { return CanHasItems.Items; }
|
get { return ItemsFeature.Items; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override IServiceProvider ApplicationServices
|
public override IServiceProvider ApplicationServices
|
||||||
{
|
{
|
||||||
get { return CanHasServiceProviders.ApplicationServices; }
|
get { return ServiceProvidersFeature.ApplicationServices; }
|
||||||
set { CanHasServiceProviders.ApplicationServices = value; }
|
set { ServiceProvidersFeature.ApplicationServices = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override IServiceProvider RequestServices
|
public override IServiceProvider RequestServices
|
||||||
{
|
{
|
||||||
get { return CanHasServiceProviders.RequestServices; }
|
get { return ServiceProvidersFeature.RequestServices; }
|
||||||
set { CanHasServiceProviders.RequestServices = value; }
|
set { ServiceProvidersFeature.RequestServices = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public int Revision { get { return _features.Revision; } }
|
public int Revision { get { return _features.Revision; } }
|
||||||
|
|
@ -115,7 +115,7 @@ namespace Microsoft.AspNet.PipelineCore
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
var lifetime = Lifetime;
|
var lifetime = LifetimeFeature;
|
||||||
if (lifetime != null)
|
if (lifetime != null)
|
||||||
{
|
{
|
||||||
return lifetime.OnRequestAborted;
|
return lifetime.OnRequestAborted;
|
||||||
|
|
@ -126,7 +126,7 @@ namespace Microsoft.AspNet.PipelineCore
|
||||||
|
|
||||||
public override void Abort()
|
public override void Abort()
|
||||||
{
|
{
|
||||||
var lifetime = Lifetime;
|
var lifetime = LifetimeFeature;
|
||||||
if (lifetime != null)
|
if (lifetime != null)
|
||||||
{
|
{
|
||||||
lifetime.Abort();
|
lifetime.Abort();
|
||||||
|
|
@ -152,7 +152,7 @@ namespace Microsoft.AspNet.PipelineCore
|
||||||
|
|
||||||
public override IEnumerable<AuthenticationDescription> GetAuthenticationTypes()
|
public override IEnumerable<AuthenticationDescription> GetAuthenticationTypes()
|
||||||
{
|
{
|
||||||
var handler = HttpAuthentication.Handler;
|
var handler = HttpAuthenticationFeature.Handler;
|
||||||
if (handler == null)
|
if (handler == null)
|
||||||
{
|
{
|
||||||
return new AuthenticationDescription[0];
|
return new AuthenticationDescription[0];
|
||||||
|
|
@ -169,7 +169,7 @@ namespace Microsoft.AspNet.PipelineCore
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException();
|
throw new ArgumentNullException();
|
||||||
}
|
}
|
||||||
var handler = HttpAuthentication.Handler;
|
var handler = HttpAuthenticationFeature.Handler;
|
||||||
|
|
||||||
var authenticateContext = new AuthenticateContext(authenticationTypes);
|
var authenticateContext = new AuthenticateContext(authenticationTypes);
|
||||||
if (handler != null)
|
if (handler != null)
|
||||||
|
|
@ -193,7 +193,7 @@ namespace Microsoft.AspNet.PipelineCore
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException();
|
throw new ArgumentNullException();
|
||||||
}
|
}
|
||||||
var handler = HttpAuthentication.Handler;
|
var handler = HttpAuthenticationFeature.Handler;
|
||||||
|
|
||||||
var authenticateContext = new AuthenticateContext(authenticationTypes);
|
var authenticateContext = new AuthenticateContext(authenticationTypes);
|
||||||
if (handler != null)
|
if (handler != null)
|
||||||
|
|
|
||||||
|
|
@ -34,12 +34,12 @@ namespace Microsoft.AspNet.PipelineCore
|
||||||
private readonly DefaultHttpContext _context;
|
private readonly DefaultHttpContext _context;
|
||||||
private readonly IFeatureCollection _features;
|
private readonly IFeatureCollection _features;
|
||||||
|
|
||||||
private FeatureReference<IHttpRequestInformation> _request = FeatureReference<IHttpRequestInformation>.Default;
|
private FeatureReference<IHttpRequestFeature> _request = FeatureReference<IHttpRequestFeature>.Default;
|
||||||
private FeatureReference<IHttpConnection> _connection = FeatureReference<IHttpConnection>.Default;
|
private FeatureReference<IHttpConnectionFeature> _connection = FeatureReference<IHttpConnectionFeature>.Default;
|
||||||
private FeatureReference<IHttpTransportLayerSecurity> _transportLayerSecurity = FeatureReference<IHttpTransportLayerSecurity>.Default;
|
private FeatureReference<IHttpTransportLayerSecurityFeature> _transportLayerSecurity = FeatureReference<IHttpTransportLayerSecurityFeature>.Default;
|
||||||
private FeatureReference<ICanHasQuery> _canHasQuery = FeatureReference<ICanHasQuery>.Default;
|
private FeatureReference<IQueryFeature> _query = FeatureReference<IQueryFeature>.Default;
|
||||||
private FeatureReference<ICanHasForm> _canHasForm = FeatureReference<ICanHasForm>.Default;
|
private FeatureReference<IFormFeature> _form = FeatureReference<IFormFeature>.Default;
|
||||||
private FeatureReference<ICanHasRequestCookies> _canHasCookies = FeatureReference<ICanHasRequestCookies>.Default;
|
private FeatureReference<IRequestCookiesFeature> _cookies = FeatureReference<IRequestCookiesFeature>.Default;
|
||||||
|
|
||||||
public DefaultHttpRequest(DefaultHttpContext context, IFeatureCollection features)
|
public DefaultHttpRequest(DefaultHttpContext context, IFeatureCollection features)
|
||||||
{
|
{
|
||||||
|
|
@ -47,54 +47,54 @@ namespace Microsoft.AspNet.PipelineCore
|
||||||
_features = features;
|
_features = features;
|
||||||
}
|
}
|
||||||
|
|
||||||
private IHttpRequestInformation HttpRequestInformation
|
private IHttpRequestFeature HttpRequestFeature
|
||||||
{
|
{
|
||||||
get { return _request.Fetch(_features); }
|
get { return _request.Fetch(_features); }
|
||||||
}
|
}
|
||||||
|
|
||||||
private IHttpConnection HttpConnection
|
private IHttpConnectionFeature HttpConnectionFeature
|
||||||
{
|
{
|
||||||
get { return _connection.Fetch(_features); }
|
get { return _connection.Fetch(_features); }
|
||||||
}
|
}
|
||||||
|
|
||||||
private IHttpTransportLayerSecurity HttpTransportLayerSecurity
|
private IHttpTransportLayerSecurityFeature HttpTransportLayerSecurityFeature
|
||||||
{
|
{
|
||||||
get { return _transportLayerSecurity.Fetch(_features); }
|
get { return _transportLayerSecurity.Fetch(_features); }
|
||||||
}
|
}
|
||||||
|
|
||||||
private ICanHasQuery CanHasQuery
|
private IQueryFeature QueryFeature
|
||||||
{
|
{
|
||||||
get { return _canHasQuery.Fetch(_features) ?? _canHasQuery.Update(_features, new DefaultCanHasQuery(_features)); }
|
get { return _query.Fetch(_features) ?? _query.Update(_features, new QueryFeature(_features)); }
|
||||||
}
|
}
|
||||||
|
|
||||||
private ICanHasForm CanHasForm
|
private IFormFeature FormFeature
|
||||||
{
|
{
|
||||||
get { return _canHasForm.Fetch(_features) ?? _canHasForm.Update(_features, new DefaultCanHasForm(_features)); }
|
get { return _form.Fetch(_features) ?? _form.Update(_features, new FormFeature(_features)); }
|
||||||
}
|
}
|
||||||
|
|
||||||
private ICanHasRequestCookies CanHasRequestCookies
|
private IRequestCookiesFeature RequestCookiesFeature
|
||||||
{
|
{
|
||||||
get { return _canHasCookies.Fetch(_features) ?? _canHasCookies.Update(_features, new DefaultCanHasRequestCookies(_features)); }
|
get { return _cookies.Fetch(_features) ?? _cookies.Update(_features, new RequestCookiesFeature(_features)); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override HttpContext HttpContext { get { return _context; } }
|
public override HttpContext HttpContext { get { return _context; } }
|
||||||
|
|
||||||
public override PathString PathBase
|
public override PathString PathBase
|
||||||
{
|
{
|
||||||
get { return new PathString(HttpRequestInformation.PathBase); }
|
get { return new PathString(HttpRequestFeature.PathBase); }
|
||||||
set { HttpRequestInformation.PathBase = value.Value; }
|
set { HttpRequestFeature.PathBase = value.Value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PathString Path
|
public override PathString Path
|
||||||
{
|
{
|
||||||
get { return new PathString(HttpRequestInformation.Path); }
|
get { return new PathString(HttpRequestFeature.Path); }
|
||||||
set { HttpRequestInformation.Path = value.Value; }
|
set { HttpRequestFeature.Path = value.Value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override QueryString QueryString
|
public override QueryString QueryString
|
||||||
{
|
{
|
||||||
get { return new QueryString(HttpRequestInformation.QueryString); }
|
get { return new QueryString(HttpRequestFeature.QueryString); }
|
||||||
set { HttpRequestInformation.QueryString = value.Value; }
|
set { HttpRequestFeature.QueryString = value.Value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override long? ContentLength
|
public override long? ContentLength
|
||||||
|
|
@ -111,20 +111,20 @@ namespace Microsoft.AspNet.PipelineCore
|
||||||
|
|
||||||
public override Stream Body
|
public override Stream Body
|
||||||
{
|
{
|
||||||
get { return HttpRequestInformation.Body; }
|
get { return HttpRequestFeature.Body; }
|
||||||
set { HttpRequestInformation.Body = value; }
|
set { HttpRequestFeature.Body = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string Method
|
public override string Method
|
||||||
{
|
{
|
||||||
get { return HttpRequestInformation.Method; }
|
get { return HttpRequestFeature.Method; }
|
||||||
set { HttpRequestInformation.Method = value; }
|
set { HttpRequestFeature.Method = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string Scheme
|
public override string Scheme
|
||||||
{
|
{
|
||||||
get { return HttpRequestInformation.Scheme; }
|
get { return HttpRequestFeature.Scheme; }
|
||||||
set { HttpRequestInformation.Scheme = value; }
|
set { HttpRequestFeature.Scheme = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool IsSecure
|
public override bool IsSecure
|
||||||
|
|
@ -140,28 +140,28 @@ namespace Microsoft.AspNet.PipelineCore
|
||||||
|
|
||||||
public override IReadableStringCollection Query
|
public override IReadableStringCollection Query
|
||||||
{
|
{
|
||||||
get { return CanHasQuery.Query; }
|
get { return QueryFeature.Query; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Task<IReadableStringCollection> GetFormAsync()
|
public override Task<IReadableStringCollection> GetFormAsync()
|
||||||
{
|
{
|
||||||
return CanHasForm.GetFormAsync();
|
return FormFeature.GetFormAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string Protocol
|
public override string Protocol
|
||||||
{
|
{
|
||||||
get { return HttpRequestInformation.Protocol; }
|
get { return HttpRequestFeature.Protocol; }
|
||||||
set { HttpRequestInformation.Protocol = value; }
|
set { HttpRequestFeature.Protocol = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override IHeaderDictionary Headers
|
public override IHeaderDictionary Headers
|
||||||
{
|
{
|
||||||
get { return new HeaderDictionary(HttpRequestInformation.Headers); }
|
get { return new HeaderDictionary(HttpRequestFeature.Headers); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override IReadableStringCollection Cookies
|
public override IReadableStringCollection Cookies
|
||||||
{
|
{
|
||||||
get { return CanHasRequestCookies.Cookies; }
|
get { return RequestCookiesFeature.Cookies; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override System.Threading.CancellationToken CallCanceled
|
public override System.Threading.CancellationToken CallCanceled
|
||||||
|
|
|
||||||
|
|
@ -38,9 +38,9 @@ namespace Microsoft.AspNet.PipelineCore
|
||||||
{
|
{
|
||||||
private readonly DefaultHttpContext _context;
|
private readonly DefaultHttpContext _context;
|
||||||
private readonly IFeatureCollection _features;
|
private readonly IFeatureCollection _features;
|
||||||
private FeatureReference<IHttpResponseInformation> _response = FeatureReference<IHttpResponseInformation>.Default;
|
private FeatureReference<IHttpResponseFeature> _response = FeatureReference<IHttpResponseFeature>.Default;
|
||||||
private FeatureReference<ICanHasResponseCookies> _canHasCookies = FeatureReference<ICanHasResponseCookies>.Default;
|
private FeatureReference<IResponseCookiesFeature> _cookies = FeatureReference<IResponseCookiesFeature>.Default;
|
||||||
private FeatureReference<IHttpAuthentication> _authentication = FeatureReference<IHttpAuthentication>.Default;
|
private FeatureReference<IHttpAuthenticationFeature> _authentication = FeatureReference<IHttpAuthenticationFeature>.Default;
|
||||||
|
|
||||||
public DefaultHttpResponse(DefaultHttpContext context, IFeatureCollection features)
|
public DefaultHttpResponse(DefaultHttpContext context, IFeatureCollection features)
|
||||||
{
|
{
|
||||||
|
|
@ -48,38 +48,38 @@ namespace Microsoft.AspNet.PipelineCore
|
||||||
_features = features;
|
_features = features;
|
||||||
}
|
}
|
||||||
|
|
||||||
private IHttpResponseInformation HttpResponseInformation
|
private IHttpResponseFeature HttpResponseFeature
|
||||||
{
|
{
|
||||||
get { return _response.Fetch(_features); }
|
get { return _response.Fetch(_features); }
|
||||||
}
|
}
|
||||||
|
|
||||||
private ICanHasResponseCookies CanHasResponseCookies
|
private IResponseCookiesFeature ResponseCookiesFeature
|
||||||
{
|
{
|
||||||
get { return _canHasCookies.Fetch(_features) ?? _canHasCookies.Update(_features, new DefaultCanHasResponseCookies(_features)); }
|
get { return _cookies.Fetch(_features) ?? _cookies.Update(_features, new ResponseCookiesFeature(_features)); }
|
||||||
}
|
}
|
||||||
|
|
||||||
private IHttpAuthentication HttpAuthentication
|
private IHttpAuthenticationFeature HttpAuthenticationFeature
|
||||||
{
|
{
|
||||||
get { return _authentication.Fetch(_features) ?? _authentication.Update(_features, new DefaultHttpAuthentication()); }
|
get { return _authentication.Fetch(_features) ?? _authentication.Update(_features, new HttpAuthenticationFeature()); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override HttpContext HttpContext { get { return _context; } }
|
public override HttpContext HttpContext { get { return _context; } }
|
||||||
|
|
||||||
public override int StatusCode
|
public override int StatusCode
|
||||||
{
|
{
|
||||||
get { return HttpResponseInformation.StatusCode; }
|
get { return HttpResponseFeature.StatusCode; }
|
||||||
set { HttpResponseInformation.StatusCode = value; }
|
set { HttpResponseFeature.StatusCode = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override IHeaderDictionary Headers
|
public override IHeaderDictionary Headers
|
||||||
{
|
{
|
||||||
get { return new HeaderDictionary(HttpResponseInformation.Headers); }
|
get { return new HeaderDictionary(HttpResponseFeature.Headers); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Stream Body
|
public override Stream Body
|
||||||
{
|
{
|
||||||
get { return HttpResponseInformation.Body; }
|
get { return HttpResponseFeature.Body; }
|
||||||
set { HttpResponseInformation.Body = value; }
|
set { HttpResponseFeature.Body = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override long? ContentLength
|
public override long? ContentLength
|
||||||
|
|
@ -105,34 +105,34 @@ namespace Microsoft.AspNet.PipelineCore
|
||||||
{
|
{
|
||||||
if (string.IsNullOrWhiteSpace(value))
|
if (string.IsNullOrWhiteSpace(value))
|
||||||
{
|
{
|
||||||
HttpResponseInformation.Headers.Remove(Constants.Headers.ContentType);
|
HttpResponseFeature.Headers.Remove(Constants.Headers.ContentType);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
HttpResponseInformation.Headers[Constants.Headers.ContentType] = new[] { value };
|
HttpResponseFeature.Headers[Constants.Headers.ContentType] = new[] { value };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override IResponseCookies Cookies
|
public override IResponseCookies Cookies
|
||||||
{
|
{
|
||||||
get { return CanHasResponseCookies.Cookies; }
|
get { return ResponseCookiesFeature.Cookies; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnSendingHeaders(Action<object> callback, object state)
|
public override void OnSendingHeaders(Action<object> callback, object state)
|
||||||
{
|
{
|
||||||
HttpResponseInformation.OnSendingHeaders(callback, state);
|
HttpResponseFeature.OnSendingHeaders(callback, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Redirect(string location, bool permanent)
|
public override void Redirect(string location, bool permanent)
|
||||||
{
|
{
|
||||||
if (permanent)
|
if (permanent)
|
||||||
{
|
{
|
||||||
HttpResponseInformation.StatusCode = 301;
|
HttpResponseFeature.StatusCode = 301;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
HttpResponseInformation.StatusCode = 302;
|
HttpResponseFeature.StatusCode = 302;
|
||||||
}
|
}
|
||||||
|
|
||||||
Headers.Set(Constants.Headers.Location, location);
|
Headers.Set(Constants.Headers.Location, location);
|
||||||
|
|
@ -150,8 +150,8 @@ namespace Microsoft.AspNet.PipelineCore
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException();
|
throw new ArgumentNullException();
|
||||||
}
|
}
|
||||||
HttpResponseInformation.StatusCode = 401;
|
HttpResponseFeature.StatusCode = 401;
|
||||||
var handler = HttpAuthentication.Handler;
|
var handler = HttpAuthenticationFeature.Handler;
|
||||||
|
|
||||||
var challengeContext = new ChallengeContext(authenticationTypes, properties == null ? null : properties.Dictionary);
|
var challengeContext = new ChallengeContext(authenticationTypes, properties == null ? null : properties.Dictionary);
|
||||||
if (handler != null)
|
if (handler != null)
|
||||||
|
|
@ -173,7 +173,7 @@ namespace Microsoft.AspNet.PipelineCore
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException();
|
throw new ArgumentNullException();
|
||||||
}
|
}
|
||||||
var handler = HttpAuthentication.Handler;
|
var handler = HttpAuthenticationFeature.Handler;
|
||||||
|
|
||||||
var signInContext = new SignInContext(identities, properties == null ? null : properties.Dictionary);
|
var signInContext = new SignInContext(identities, properties == null ? null : properties.Dictionary);
|
||||||
if (handler != null)
|
if (handler != null)
|
||||||
|
|
@ -195,7 +195,7 @@ namespace Microsoft.AspNet.PipelineCore
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException();
|
throw new ArgumentNullException();
|
||||||
}
|
}
|
||||||
var handler = HttpAuthentication.Handler;
|
var handler = HttpAuthenticationFeature.Handler;
|
||||||
|
|
||||||
var signOutContext = new SignOutContext(authenticationTypes);
|
var signOutContext = new SignOutContext(authenticationTypes);
|
||||||
if (handler != null)
|
if (handler != null)
|
||||||
|
|
|
||||||
|
|
@ -26,14 +26,14 @@ using Microsoft.AspNet.PipelineCore.Infrastructure;
|
||||||
|
|
||||||
namespace Microsoft.AspNet.PipelineCore
|
namespace Microsoft.AspNet.PipelineCore
|
||||||
{
|
{
|
||||||
public class DefaultCanHasForm : ICanHasForm
|
public class FormFeature : IFormFeature
|
||||||
{
|
{
|
||||||
private readonly IFeatureCollection _features;
|
private readonly IFeatureCollection _features;
|
||||||
private readonly FeatureReference<IHttpRequestInformation> _request = FeatureReference<IHttpRequestInformation>.Default;
|
private readonly FeatureReference<IHttpRequestFeature> _request = FeatureReference<IHttpRequestFeature>.Default;
|
||||||
private Stream _bodyStream;
|
private Stream _bodyStream;
|
||||||
private IReadableStringCollection _form;
|
private IReadableStringCollection _form;
|
||||||
|
|
||||||
public DefaultCanHasForm(IFeatureCollection features)
|
public FormFeature(IFeatureCollection features)
|
||||||
{
|
{
|
||||||
_features = features;
|
_features = features;
|
||||||
}
|
}
|
||||||
|
|
@ -20,7 +20,7 @@ using Microsoft.AspNet.Abstractions;
|
||||||
|
|
||||||
namespace Microsoft.AspNet.PipelineCore
|
namespace Microsoft.AspNet.PipelineCore
|
||||||
{
|
{
|
||||||
public interface ICanHasForm
|
public interface IFormFeature
|
||||||
{
|
{
|
||||||
Task<IReadableStringCollection> GetFormAsync();
|
Task<IReadableStringCollection> GetFormAsync();
|
||||||
}
|
}
|
||||||
|
|
@ -19,7 +19,7 @@ using System.Collections.Generic;
|
||||||
|
|
||||||
namespace Microsoft.AspNet.PipelineCore
|
namespace Microsoft.AspNet.PipelineCore
|
||||||
{
|
{
|
||||||
public interface ICanHasItems
|
public interface IItemsFeature
|
||||||
{
|
{
|
||||||
IDictionary<object, object> Items { get; }
|
IDictionary<object, object> Items { get; }
|
||||||
}
|
}
|
||||||
|
|
@ -19,7 +19,7 @@ using Microsoft.AspNet.Abstractions;
|
||||||
|
|
||||||
namespace Microsoft.AspNet.PipelineCore
|
namespace Microsoft.AspNet.PipelineCore
|
||||||
{
|
{
|
||||||
public interface ICanHasQuery
|
public interface IQueryFeature
|
||||||
{
|
{
|
||||||
IReadableStringCollection Query { get; }
|
IReadableStringCollection Query { get; }
|
||||||
}
|
}
|
||||||
|
|
@ -19,7 +19,7 @@ using Microsoft.AspNet.Abstractions;
|
||||||
|
|
||||||
namespace Microsoft.AspNet.PipelineCore
|
namespace Microsoft.AspNet.PipelineCore
|
||||||
{
|
{
|
||||||
public interface ICanHasRequestCookies
|
public interface IRequestCookiesFeature
|
||||||
{
|
{
|
||||||
IReadableStringCollection Cookies { get; }
|
IReadableStringCollection Cookies { get; }
|
||||||
}
|
}
|
||||||
|
|
@ -20,7 +20,7 @@ using Microsoft.AspNet.PipelineCore.Collections;
|
||||||
|
|
||||||
namespace Microsoft.AspNet.PipelineCore
|
namespace Microsoft.AspNet.PipelineCore
|
||||||
{
|
{
|
||||||
public interface ICanHasResponseCookies
|
public interface IResponseCookiesFeature
|
||||||
{
|
{
|
||||||
IResponseCookies Cookies { get; }
|
IResponseCookies Cookies { get; }
|
||||||
}
|
}
|
||||||
|
|
@ -19,7 +19,7 @@ using System;
|
||||||
|
|
||||||
namespace Microsoft.AspNet.PipelineCore
|
namespace Microsoft.AspNet.PipelineCore
|
||||||
{
|
{
|
||||||
public interface ICanHasServiceProviders
|
public interface IServiceProvidersFeature
|
||||||
{
|
{
|
||||||
IServiceProvider ApplicationServices { get; set; }
|
IServiceProvider ApplicationServices { get; set; }
|
||||||
IServiceProvider RequestServices { get; set; }
|
IServiceProvider RequestServices { get; set; }
|
||||||
|
|
@ -19,9 +19,9 @@ using System.Collections.Generic;
|
||||||
|
|
||||||
namespace Microsoft.AspNet.PipelineCore
|
namespace Microsoft.AspNet.PipelineCore
|
||||||
{
|
{
|
||||||
public class DefaultCanHasItems : ICanHasItems
|
public class ItemsFeature : IItemsFeature
|
||||||
{
|
{
|
||||||
public DefaultCanHasItems()
|
public ItemsFeature()
|
||||||
{
|
{
|
||||||
Items = new ItemsDictionary();
|
Items = new ItemsDictionary();
|
||||||
}
|
}
|
||||||
|
|
@ -27,28 +27,28 @@
|
||||||
<Compile Include="Collections\ReadableStringCollection.cs" />
|
<Compile Include="Collections\ReadableStringCollection.cs" />
|
||||||
<Compile Include="Collections\RequestCookiesCollection.cs" />
|
<Compile Include="Collections\RequestCookiesCollection.cs" />
|
||||||
<Compile Include="Collections\ResponseCookies.cs" />
|
<Compile Include="Collections\ResponseCookies.cs" />
|
||||||
<Compile Include="DefaultCanHasForm.cs" />
|
<Compile Include="FormFeature.cs" />
|
||||||
<Compile Include="DefaultCanHasItems.cs" />
|
<Compile Include="ItemsFeature.cs" />
|
||||||
<Compile Include="DefaultCanHasQuery.cs" />
|
<Compile Include="QueryFeature.cs" />
|
||||||
<Compile Include="DefaultCanHasRequestCookies.cs" />
|
<Compile Include="RequestCookiesFeature.cs" />
|
||||||
<Compile Include="DefaultCanHasResponseCookies.cs" />
|
<Compile Include="ResponseCookiesFeature.cs" />
|
||||||
<Compile Include="DefaultCanHasServiceProviders.cs" />
|
<Compile Include="ServiceProvidersFeature.cs" />
|
||||||
<Compile Include="DefaultHttpContext.cs" />
|
<Compile Include="DefaultHttpContext.cs" />
|
||||||
<Compile Include="DefaultHttpRequest.cs" />
|
<Compile Include="DefaultHttpRequest.cs" />
|
||||||
<Compile Include="DefaultHttpResponse.cs" />
|
<Compile Include="DefaultHttpResponse.cs" />
|
||||||
<Compile Include="ICanHasForm.cs" />
|
<Compile Include="IFormFeature.cs" />
|
||||||
<Compile Include="ICanHasItems.cs" />
|
<Compile Include="IItemsFeature.cs" />
|
||||||
<Compile Include="ICanHasQuery.cs" />
|
<Compile Include="IQueryFeature.cs" />
|
||||||
<Compile Include="ICanHasRequestCookies.cs" />
|
<Compile Include="IRequestCookiesFeature.cs" />
|
||||||
<Compile Include="ICanHasResponseCookies.cs" />
|
<Compile Include="IResponseCookiesFeature.cs" />
|
||||||
<Compile Include="ICanHasServiceProviders.cs" />
|
<Compile Include="IServiceProvidersFeature.cs" />
|
||||||
<Compile Include="Infrastructure\Constants.cs" />
|
<Compile Include="Infrastructure\Constants.cs" />
|
||||||
<Compile Include="Infrastructure\FeatureReference.cs" />
|
<Compile Include="Infrastructure\FeatureReference.cs" />
|
||||||
<Compile Include="Infrastructure\ParsingHelpers.cs" />
|
<Compile Include="Infrastructure\ParsingHelpers.cs" />
|
||||||
<Compile Include="Security\AuthenticateContext.cs" />
|
<Compile Include="Security\AuthenticateContext.cs" />
|
||||||
<Compile Include="Security\AuthTypeContext.cs" />
|
<Compile Include="Security\AuthTypeContext.cs" />
|
||||||
<Compile Include="Security\ChallengeContext.cs" />
|
<Compile Include="Security\ChallengeContext.cs" />
|
||||||
<Compile Include="Security\DefaultHttpAuthentication.cs" />
|
<Compile Include="Security\HttpAuthenticationFeature.cs" />
|
||||||
<Compile Include="Security\SignInContext.cs" />
|
<Compile Include="Security\SignInContext.cs" />
|
||||||
<Compile Include="Security\SignOutContext.cs" />
|
<Compile Include="Security\SignOutContext.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
|
||||||
|
|
@ -24,14 +24,14 @@ using Microsoft.AspNet.PipelineCore.Infrastructure;
|
||||||
|
|
||||||
namespace Microsoft.AspNet.PipelineCore
|
namespace Microsoft.AspNet.PipelineCore
|
||||||
{
|
{
|
||||||
public class DefaultCanHasQuery : ICanHasQuery
|
public class QueryFeature : IQueryFeature
|
||||||
{
|
{
|
||||||
private readonly IFeatureCollection _features;
|
private readonly IFeatureCollection _features;
|
||||||
private FeatureReference<IHttpRequestInformation> _request = FeatureReference<IHttpRequestInformation>.Default;
|
private FeatureReference<IHttpRequestFeature> _request = FeatureReference<IHttpRequestFeature>.Default;
|
||||||
private string _queryString;
|
private string _queryString;
|
||||||
private IReadableStringCollection _query;
|
private IReadableStringCollection _query;
|
||||||
|
|
||||||
public DefaultCanHasQuery(IFeatureCollection features)
|
public QueryFeature(IFeatureCollection features)
|
||||||
{
|
{
|
||||||
_features = features;
|
_features = features;
|
||||||
}
|
}
|
||||||
|
|
@ -25,15 +25,15 @@ using Microsoft.AspNet.PipelineCore.Infrastructure;
|
||||||
|
|
||||||
namespace Microsoft.AspNet.PipelineCore
|
namespace Microsoft.AspNet.PipelineCore
|
||||||
{
|
{
|
||||||
public class DefaultCanHasRequestCookies : ICanHasRequestCookies
|
public class RequestCookiesFeature : IRequestCookiesFeature
|
||||||
{
|
{
|
||||||
private readonly IFeatureCollection _features;
|
private readonly IFeatureCollection _features;
|
||||||
private readonly FeatureReference<IHttpRequestInformation> _request = FeatureReference<IHttpRequestInformation>.Default;
|
private readonly FeatureReference<IHttpRequestFeature> _request = FeatureReference<IHttpRequestFeature>.Default;
|
||||||
private string _cookiesHeader;
|
private string _cookiesHeader;
|
||||||
private RequestCookiesCollection _cookiesCollection;
|
private RequestCookiesCollection _cookiesCollection;
|
||||||
private static readonly string[] ZeroHeaders = new string[0];
|
private static readonly string[] ZeroHeaders = new string[0];
|
||||||
|
|
||||||
public DefaultCanHasRequestCookies(IFeatureCollection features)
|
public RequestCookiesFeature(IFeatureCollection features)
|
||||||
{
|
{
|
||||||
_features = features;
|
_features = features;
|
||||||
}
|
}
|
||||||
|
|
@ -23,13 +23,13 @@ using Microsoft.AspNet.PipelineCore.Infrastructure;
|
||||||
|
|
||||||
namespace Microsoft.AspNet.PipelineCore
|
namespace Microsoft.AspNet.PipelineCore
|
||||||
{
|
{
|
||||||
public class DefaultCanHasResponseCookies : ICanHasResponseCookies
|
public class ResponseCookiesFeature : IResponseCookiesFeature
|
||||||
{
|
{
|
||||||
private readonly IFeatureCollection _features;
|
private readonly IFeatureCollection _features;
|
||||||
private readonly FeatureReference<IHttpResponseInformation> _request = FeatureReference<IHttpResponseInformation>.Default;
|
private readonly FeatureReference<IHttpResponseFeature> _request = FeatureReference<IHttpResponseFeature>.Default;
|
||||||
private IResponseCookies _cookiesCollection;
|
private IResponseCookies _cookiesCollection;
|
||||||
|
|
||||||
public DefaultCanHasResponseCookies(IFeatureCollection features)
|
public ResponseCookiesFeature(IFeatureCollection features)
|
||||||
{
|
{
|
||||||
_features = features;
|
_features = features;
|
||||||
}
|
}
|
||||||
|
|
@ -20,9 +20,9 @@ using Microsoft.AspNet.HttpFeature.Security;
|
||||||
|
|
||||||
namespace Microsoft.AspNet.PipelineCore.Security
|
namespace Microsoft.AspNet.PipelineCore.Security
|
||||||
{
|
{
|
||||||
public class DefaultHttpAuthentication : IHttpAuthentication
|
public class HttpAuthenticationFeature : IHttpAuthenticationFeature
|
||||||
{
|
{
|
||||||
public DefaultHttpAuthentication()
|
public HttpAuthenticationFeature()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -19,7 +19,7 @@ using System;
|
||||||
|
|
||||||
namespace Microsoft.AspNet.PipelineCore
|
namespace Microsoft.AspNet.PipelineCore
|
||||||
{
|
{
|
||||||
public class DefaultCanHasServiceProviders : ICanHasServiceProviders
|
public class ServiceProvidersFeature : IServiceProvidersFeature
|
||||||
{
|
{
|
||||||
public IServiceProvider ApplicationServices { get; set; }
|
public IServiceProvider ApplicationServices { get; set; }
|
||||||
public IServiceProvider RequestServices { get; set; }
|
public IServiceProvider RequestServices { get; set; }
|
||||||
|
|
@ -22,7 +22,7 @@ using Microsoft.AspNet.HttpFeature;
|
||||||
|
|
||||||
namespace Microsoft.AspNet.Abstractions.Extensions
|
namespace Microsoft.AspNet.Abstractions.Extensions
|
||||||
{
|
{
|
||||||
public class FakeHttpRequestInfo : IHttpRequestInformation
|
public class FakeHttpRequestFeature : IHttpRequestFeature
|
||||||
{
|
{
|
||||||
public string Protocol { get; set; }
|
public string Protocol { get; set; }
|
||||||
public string Scheme { get; set; }
|
public string Scheme { get; set; }
|
||||||
|
|
@ -34,7 +34,7 @@ namespace Microsoft.AspNet.Abstractions.Extensions
|
||||||
public Stream Body { get; set; }
|
public Stream Body { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class FakeHttpResponseInfo : IHttpResponseInformation
|
public class FakeHttpResponseFeature : IHttpResponseFeature
|
||||||
{
|
{
|
||||||
public int StatusCode { get; set; }
|
public int StatusCode { get; set; }
|
||||||
public string ReasonPhrase { get; set; }
|
public string ReasonPhrase { get; set; }
|
||||||
|
|
|
||||||
|
|
@ -201,8 +201,8 @@ namespace Microsoft.AspNet.Abstractions.Extensions
|
||||||
private HttpContext CreateRequest(string basePath, string requestPath)
|
private HttpContext CreateRequest(string basePath, string requestPath)
|
||||||
{
|
{
|
||||||
HttpContext context = new DefaultHttpContext(new FeatureModel.FeatureCollection());
|
HttpContext context = new DefaultHttpContext(new FeatureModel.FeatureCollection());
|
||||||
context.SetFeature<IHttpRequestInformation>(new FakeHttpRequestInfo());
|
context.SetFeature<IHttpRequestFeature>(new FakeHttpRequestFeature());
|
||||||
context.SetFeature<IHttpResponseInformation>(new FakeHttpResponseInfo());
|
context.SetFeature<IHttpResponseFeature>(new FakeHttpResponseFeature());
|
||||||
context.Request.PathBase = new PathString(basePath);
|
context.Request.PathBase = new PathString(basePath);
|
||||||
context.Request.Path = new PathString(requestPath);
|
context.Request.Path = new PathString(requestPath);
|
||||||
return context;
|
return context;
|
||||||
|
|
|
||||||
|
|
@ -190,8 +190,8 @@ namespace Microsoft.AspNet.Abstractions.Extensions
|
||||||
private HttpContext CreateRequest()
|
private HttpContext CreateRequest()
|
||||||
{
|
{
|
||||||
HttpContext context = new DefaultHttpContext(new FeatureModel.FeatureCollection());
|
HttpContext context = new DefaultHttpContext(new FeatureModel.FeatureCollection());
|
||||||
context.SetFeature<IHttpRequestInformation>(new FakeHttpRequestInfo());
|
context.SetFeature<IHttpRequestFeature>(new FakeHttpRequestFeature());
|
||||||
context.SetFeature<IHttpResponseInformation>(new FakeHttpResponseInfo());
|
context.SetFeature<IHttpResponseFeature>(new FakeHttpResponseFeature());
|
||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -133,7 +133,7 @@ namespace Microsoft.AspNet.Owin
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class MoqHttpRequest : HttpRequest, IHttpRequestInformation
|
private class MoqHttpRequest : HttpRequest, IHttpRequestFeature
|
||||||
{
|
{
|
||||||
public override HttpContext HttpContext
|
public override HttpContext HttpContext
|
||||||
{
|
{
|
||||||
|
|
@ -225,25 +225,25 @@ namespace Microsoft.AspNet.Owin
|
||||||
set { throw new NotImplementedException(); }
|
set { throw new NotImplementedException(); }
|
||||||
}
|
}
|
||||||
|
|
||||||
string IHttpRequestInformation.PathBase
|
string IHttpRequestFeature.PathBase
|
||||||
{
|
{
|
||||||
get;
|
get;
|
||||||
set;
|
set;
|
||||||
}
|
}
|
||||||
|
|
||||||
string IHttpRequestInformation.Path
|
string IHttpRequestFeature.Path
|
||||||
{
|
{
|
||||||
get;
|
get;
|
||||||
set;
|
set;
|
||||||
}
|
}
|
||||||
|
|
||||||
string IHttpRequestInformation.QueryString
|
string IHttpRequestFeature.QueryString
|
||||||
{
|
{
|
||||||
get;
|
get;
|
||||||
set;
|
set;
|
||||||
}
|
}
|
||||||
|
|
||||||
IDictionary<string, string[]> IHttpRequestInformation.Headers
|
IDictionary<string, string[]> IHttpRequestFeature.Headers
|
||||||
{
|
{
|
||||||
get;
|
get;
|
||||||
set;
|
set;
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ namespace Microsoft.AspNet.Owin
|
||||||
};
|
};
|
||||||
var features = new FeatureObject(new OwinFeatureCollection(env));
|
var features = new FeatureObject(new OwinFeatureCollection(env));
|
||||||
|
|
||||||
Assert.Equal(Get<IHttpRequestInformation>(features).Method, "POST");
|
Assert.Equal(Get<IHttpRequestFeature>(features).Method, "POST");
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
|
|
@ -56,8 +56,8 @@ namespace Microsoft.AspNet.Owin
|
||||||
var keys = features.Keys.ToArray();
|
var keys = features.Keys.ToArray();
|
||||||
var values = features.Values.ToArray();
|
var values = features.Values.ToArray();
|
||||||
|
|
||||||
Assert.Contains(typeof(IHttpRequestInformation), keys);
|
Assert.Contains(typeof(IHttpRequestFeature), keys);
|
||||||
Assert.Contains(typeof(IHttpResponseInformation), keys);
|
Assert.Contains(typeof(IHttpResponseFeature), keys);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -95,11 +95,11 @@ namespace Microsoft.AspNet.PipelineCore.Tests
|
||||||
private HttpContext CreateContext()
|
private HttpContext CreateContext()
|
||||||
{
|
{
|
||||||
var context = new DefaultHttpContext(new FeatureCollection());
|
var context = new DefaultHttpContext(new FeatureCollection());
|
||||||
context.SetFeature<IHttpResponseInformation>(new FakeHttpResponse());
|
context.SetFeature<IHttpResponseFeature>(new FakeHttpResponse());
|
||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
|
|
||||||
private class FakeHttpResponse : IHttpResponseInformation
|
private class FakeHttpResponse : IHttpResponseFeature
|
||||||
{
|
{
|
||||||
public int StatusCode { get; set; }
|
public int StatusCode { get; set; }
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -124,11 +124,11 @@ namespace Microsoft.AspNet.PipelineCore.Tests
|
||||||
|
|
||||||
private static DefaultHttpRequest CreateRequest(IDictionary<string, string[]> headers)
|
private static DefaultHttpRequest CreateRequest(IDictionary<string, string[]> headers)
|
||||||
{
|
{
|
||||||
var requestInfo = new Mock<IHttpRequestInformation>();
|
var requestInfo = new Mock<IHttpRequestFeature>();
|
||||||
requestInfo.SetupGet(r => r.Headers).Returns(headers);
|
requestInfo.SetupGet(r => r.Headers).Returns(headers);
|
||||||
|
|
||||||
var features = new FeatureCollection();
|
var features = new FeatureCollection();
|
||||||
features.Add(typeof(IHttpRequestInformation), requestInfo.Object);
|
features.Add(typeof(IHttpRequestFeature), requestInfo.Object);
|
||||||
|
|
||||||
var context = new DefaultHttpContext(features);
|
var context = new DefaultHttpContext(features);
|
||||||
return new DefaultHttpRequest(context, features);
|
return new DefaultHttpRequest(context, features);
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ using Xunit;
|
||||||
|
|
||||||
namespace Microsoft.AspNet.PipelineCore.Tests
|
namespace Microsoft.AspNet.PipelineCore.Tests
|
||||||
{
|
{
|
||||||
public class DefaultCanHasFormTests
|
public class FormFeatureTests
|
||||||
{
|
{
|
||||||
[Fact]
|
[Fact]
|
||||||
public async Task GetFormAsync_ReturnsParsedFormCollection()
|
public async Task GetFormAsync_ReturnsParsedFormCollection()
|
||||||
|
|
@ -33,14 +33,14 @@ namespace Microsoft.AspNet.PipelineCore.Tests
|
||||||
// Arrange
|
// Arrange
|
||||||
var formContent = Encoding.UTF8.GetBytes("foo=bar&baz=2");
|
var formContent = Encoding.UTF8.GetBytes("foo=bar&baz=2");
|
||||||
var features = new Mock<IFeatureCollection>();
|
var features = new Mock<IFeatureCollection>();
|
||||||
var request = new Mock<IHttpRequestInformation>();
|
var request = new Mock<IHttpRequestFeature>();
|
||||||
request.SetupGet(r => r.Body).Returns(new MemoryStream(formContent));
|
request.SetupGet(r => r.Body).Returns(new MemoryStream(formContent));
|
||||||
|
|
||||||
object value = request.Object;
|
object value = request.Object;
|
||||||
features.Setup(f => f.TryGetValue(typeof(IHttpRequestInformation), out value))
|
features.Setup(f => f.TryGetValue(typeof(IHttpRequestFeature), out value))
|
||||||
.Returns(true);
|
.Returns(true);
|
||||||
|
|
||||||
var provider = new DefaultCanHasForm(features.Object);
|
var provider = new FormFeature(features.Object);
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
var formCollection = await provider.GetFormAsync();
|
var formCollection = await provider.GetFormAsync();
|
||||||
|
|
@ -57,14 +57,14 @@ namespace Microsoft.AspNet.PipelineCore.Tests
|
||||||
var formContent1 = Encoding.UTF8.GetBytes("foo=bar&baz=2");
|
var formContent1 = Encoding.UTF8.GetBytes("foo=bar&baz=2");
|
||||||
var formContent2 = Encoding.UTF8.GetBytes("collection2=value");
|
var formContent2 = Encoding.UTF8.GetBytes("collection2=value");
|
||||||
var features = new Mock<IFeatureCollection>();
|
var features = new Mock<IFeatureCollection>();
|
||||||
var request = new Mock<IHttpRequestInformation>();
|
var request = new Mock<IHttpRequestFeature>();
|
||||||
request.SetupGet(r => r.Body).Returns(new MemoryStream(formContent1));
|
request.SetupGet(r => r.Body).Returns(new MemoryStream(formContent1));
|
||||||
|
|
||||||
object value = request.Object;
|
object value = request.Object;
|
||||||
features.Setup(f => f.TryGetValue(typeof(IHttpRequestInformation), out value))
|
features.Setup(f => f.TryGetValue(typeof(IHttpRequestFeature), out value))
|
||||||
.Returns(true);
|
.Returns(true);
|
||||||
|
|
||||||
var provider = new DefaultCanHasForm(features.Object);
|
var provider = new FormFeature(features.Object);
|
||||||
|
|
||||||
// Act - 1
|
// Act - 1
|
||||||
var formCollection = await provider.GetFormAsync();
|
var formCollection = await provider.GetFormAsync();
|
||||||
|
|
@ -22,8 +22,8 @@
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="BuilderTests.cs" />
|
<Compile Include="BuilderTests.cs" />
|
||||||
<Compile Include="DefaultCanHasFormTests.cs" />
|
<Compile Include="FormFeatureTests.cs" />
|
||||||
<Compile Include="DefaultCanHasQueryTests.cs" />
|
<Compile Include="QueryFeatureTests.cs" />
|
||||||
<Compile Include="DefaultHttpContextTests.cs" />
|
<Compile Include="DefaultHttpContextTests.cs" />
|
||||||
<Compile Include="DefaultHttpRequestTests.cs" />
|
<Compile Include="DefaultHttpRequestTests.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
|
|
||||||
|
|
@ -22,21 +22,21 @@ using Xunit;
|
||||||
|
|
||||||
namespace Microsoft.AspNet.PipelineCore.Tests
|
namespace Microsoft.AspNet.PipelineCore.Tests
|
||||||
{
|
{
|
||||||
public class DefaultCanHasQueryTests
|
public class QueryFeatureTests
|
||||||
{
|
{
|
||||||
[Fact]
|
[Fact]
|
||||||
public void QueryReturnsParsedQueryCollection()
|
public void QueryReturnsParsedQueryCollection()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
var features = new Mock<IFeatureCollection>();
|
var features = new Mock<IFeatureCollection>();
|
||||||
var request = new Mock<IHttpRequestInformation>();
|
var request = new Mock<IHttpRequestFeature>();
|
||||||
request.SetupGet(r => r.QueryString).Returns("foo=bar");
|
request.SetupGet(r => r.QueryString).Returns("foo=bar");
|
||||||
|
|
||||||
object value = request.Object;
|
object value = request.Object;
|
||||||
features.Setup(f => f.TryGetValue(typeof(IHttpRequestInformation), out value))
|
features.Setup(f => f.TryGetValue(typeof(IHttpRequestFeature), out value))
|
||||||
.Returns(true);
|
.Returns(true);
|
||||||
|
|
||||||
var provider = new DefaultCanHasQuery(features.Object);
|
var provider = new QueryFeature(features.Object);
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
var queryCollection = provider.Query;
|
var queryCollection = provider.Query;
|
||||||
Loading…
Reference in New Issue