Removed ifdefs around RemoteIP and ClientCerts.
This commit is contained in:
parent
f8b1679240
commit
93aa23b6ab
|
|
@ -19,9 +19,6 @@
|
|||
<ItemGroup>
|
||||
<Content Include="Project.json" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Properties\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Program.cs" />
|
||||
</ItemGroup>
|
||||
|
|
|
|||
|
|
@ -170,7 +170,7 @@ namespace Microsoft.AspNet.Server.WebListener
|
|||
}
|
||||
return _hash;
|
||||
}
|
||||
#if NET45
|
||||
|
||||
internal IPAddress GetIPAddress()
|
||||
{
|
||||
if (Family == AddressFamily.InterNetworkV6)
|
||||
|
|
@ -200,7 +200,7 @@ namespace Microsoft.AspNet.Server.WebListener
|
|||
Contract.Assert(Size >= IPv4AddressSize);
|
||||
return new IPAddress(new byte[] { _buffer[4], _buffer[5], _buffer[6], _buffer[7] });
|
||||
}
|
||||
#endif
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
StringBuilder bytes = new StringBuilder();
|
||||
|
|
|
|||
|
|
@ -4,8 +4,6 @@
|
|||
// </copyright>
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
#if NET45
|
||||
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Diagnostics.Contracts;
|
||||
|
|
@ -343,5 +341,3 @@ namespace Microsoft.AspNet.Server.WebListener
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -2,9 +2,7 @@
|
|||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
#if NET45
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
#endif
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNet.FeatureModel;
|
||||
|
|
@ -12,10 +10,7 @@ using Microsoft.AspNet.HttpFeature;
|
|||
|
||||
namespace Microsoft.AspNet.Server.WebListener
|
||||
{
|
||||
internal class FeatureContext : IHttpRequestInformation, IHttpConnection, IHttpResponseInformation, IHttpSendFile
|
||||
#if NET45
|
||||
, IHttpTransportLayerSecurity
|
||||
#endif
|
||||
internal class FeatureContext : IHttpRequestInformation, IHttpConnection, IHttpResponseInformation, IHttpSendFile, IHttpTransportLayerSecurity
|
||||
{
|
||||
private RequestContext _requestContext;
|
||||
private FeatureCollection _features;
|
||||
|
|
@ -28,16 +23,12 @@ namespace Microsoft.AspNet.Server.WebListener
|
|||
private string _query;
|
||||
private string _pathBase;
|
||||
private string _path;
|
||||
#if NET45
|
||||
private IPAddress _remoteIpAddress;
|
||||
private IPAddress _localIpAddress;
|
||||
#endif
|
||||
private int? _remotePort;
|
||||
private int? _localPort;
|
||||
private bool? _isLocal;
|
||||
#if NET45
|
||||
private X509Certificate _clientCert;
|
||||
#endif
|
||||
private Stream _responseStream;
|
||||
private IDictionary<string, string[]> _responseHeaders;
|
||||
|
||||
|
|
@ -69,10 +60,8 @@ namespace Microsoft.AspNet.Server.WebListener
|
|||
_features.Add(typeof(IHttpConnection), this);
|
||||
if (Request.IsSecureConnection)
|
||||
{
|
||||
#if NET45
|
||||
// TODO: Should this feature be conditional? Should we add this for HTTP requests?
|
||||
_features.Add(typeof(IHttpTransportLayerSecurity), this);
|
||||
#endif
|
||||
}
|
||||
_features.Add(typeof(IHttpResponseInformation), this);
|
||||
_features.Add(typeof(IHttpSendFile), this);
|
||||
|
|
@ -90,7 +79,7 @@ namespace Microsoft.AspNet.Server.WebListener
|
|||
*/
|
||||
}
|
||||
|
||||
#region IHttpRequestInformation
|
||||
#region IHttpRequestInformation
|
||||
|
||||
Stream IHttpRequestInformation.Body
|
||||
{
|
||||
|
|
@ -207,8 +196,8 @@ namespace Microsoft.AspNet.Server.WebListener
|
|||
}
|
||||
set { _scheme = value; }
|
||||
}
|
||||
#endregion
|
||||
#region IHttpConnection
|
||||
#endregion
|
||||
#region IHttpConnection
|
||||
bool IHttpConnection.IsLocal
|
||||
{
|
||||
get
|
||||
|
|
@ -221,7 +210,7 @@ namespace Microsoft.AspNet.Server.WebListener
|
|||
}
|
||||
set { _isLocal = value; }
|
||||
}
|
||||
#if NET45
|
||||
|
||||
IPAddress IHttpConnection.LocalIpAddress
|
||||
{
|
||||
get
|
||||
|
|
@ -247,7 +236,7 @@ namespace Microsoft.AspNet.Server.WebListener
|
|||
}
|
||||
set { _remoteIpAddress = value; }
|
||||
}
|
||||
#endif
|
||||
|
||||
int IHttpConnection.LocalPort
|
||||
{
|
||||
get
|
||||
|
|
@ -273,9 +262,8 @@ namespace Microsoft.AspNet.Server.WebListener
|
|||
}
|
||||
set { _remotePort = value; }
|
||||
}
|
||||
#endregion
|
||||
#region IHttpTransportLayerSecurity
|
||||
#if NET45
|
||||
#endregion
|
||||
#region IHttpTransportLayerSecurity
|
||||
X509Certificate IHttpTransportLayerSecurity.ClientCertificate
|
||||
{
|
||||
get
|
||||
|
|
@ -296,9 +284,8 @@ namespace Microsoft.AspNet.Server.WebListener
|
|||
_clientCert = await Request.GetClientCertificateAsync();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endregion
|
||||
#region IHttpResponseInformation
|
||||
#endregion
|
||||
#region IHttpResponseInformation
|
||||
Stream IHttpResponseInformation.Body
|
||||
{
|
||||
get
|
||||
|
|
@ -341,7 +328,7 @@ namespace Microsoft.AspNet.Server.WebListener
|
|||
get { return Response.StatusCode; }
|
||||
set { Response.StatusCode = value; }
|
||||
}
|
||||
#endregion
|
||||
#endregion
|
||||
Task IHttpSendFile.SendFileAsync(string path, long offset, long? length, CancellationToken cancellation)
|
||||
{
|
||||
return Response.SendFileAsync(path, offset, length, cancellation);
|
||||
|
|
|
|||
|
|
@ -10,9 +10,7 @@ using System.Globalization;
|
|||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Runtime.InteropServices;
|
||||
#if NET45
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
#endif
|
||||
using System.Security.Principal;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
|
@ -41,9 +39,7 @@ namespace Microsoft.AspNet.Server.WebListener
|
|||
private string _pathBase;
|
||||
private string _path;
|
||||
|
||||
#if NET45
|
||||
private X509Certificate _clientCert;
|
||||
#endif
|
||||
|
||||
private IDictionary<string, string[]> _headers;
|
||||
private BoundaryType _contentBoundaryType;
|
||||
|
|
@ -270,11 +266,7 @@ namespace Microsoft.AspNet.Server.WebListener
|
|||
{
|
||||
get
|
||||
{
|
||||
#if NET45
|
||||
return LocalEndPoint.GetIPAddress().Equals(RemoteEndPoint.GetIPAddress());
|
||||
#else
|
||||
throw new NotImplementedException();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -337,7 +329,7 @@ namespace Microsoft.AspNet.Server.WebListener
|
|||
return _localEndPoint;
|
||||
}
|
||||
}
|
||||
#if NET45
|
||||
|
||||
public IPAddress RemoteIpAddress
|
||||
{
|
||||
get { return RemoteEndPoint.GetIPAddress(); }
|
||||
|
|
@ -347,7 +339,7 @@ namespace Microsoft.AspNet.Server.WebListener
|
|||
{
|
||||
get { return LocalEndPoint.GetIPAddress(); }
|
||||
}
|
||||
#endif
|
||||
|
||||
public int RemotePort
|
||||
{
|
||||
get { return RemoteEndPoint.GetPort(); }
|
||||
|
|
@ -432,7 +424,6 @@ namespace Microsoft.AspNet.Server.WebListener
|
|||
return UnsafeNclNativeMethods.HttpApi.GetKnownVerb(RequestBuffer, OriginalBlobAddress);
|
||||
}
|
||||
|
||||
#if NET45
|
||||
// Populates the client certificate. The result may be null if there is no client cert.
|
||||
// TODO: Does it make sense for this to be invoked multiple times (e.g. renegotiate)? Client and server code appear to
|
||||
// enable this, but it's unclear what Http.Sys would do.
|
||||
|
|
@ -470,7 +461,6 @@ namespace Microsoft.AspNet.Server.WebListener
|
|||
}
|
||||
return _clientCert;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Use this to save the blob from dispose if this object was never used (never given to a user) and is about to be
|
||||
// disposed.
|
||||
|
|
|
|||
Loading…
Reference in New Issue