Commit 35e3d3ac authored by Honfika's avatar Honfika

netcoreapp2.1 target removed, use netstandard 2.1

parent 6d5baf39
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<PropertyGroup> <PropertyGroup>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<TargetFrameworks>net461;netcoreapp2.1</TargetFrameworks> <TargetFrameworks>net461;netcoreapp3.0</TargetFrameworks>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo> <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<LangVersion>7.1</LangVersion> <LangVersion>7.1</LangVersion>
</PropertyGroup> </PropertyGroup>
......
...@@ -210,7 +210,7 @@ namespace Titanium.Web.Proxy ...@@ -210,7 +210,7 @@ namespace Titanium.Web.Proxy
options.CertificateRevocationCheckMode = X509RevocationMode.NoCheck; options.CertificateRevocationCheckMode = X509RevocationMode.NoCheck;
await sslStream.AuthenticateAsServerAsync(options, cancellationToken); await sslStream.AuthenticateAsServerAsync(options, cancellationToken);
#if NETCOREAPP2_1 #if NETSTANDARD2_1
clientConnection.NegotiatedApplicationProtocol = sslStream.NegotiatedApplicationProtocol; clientConnection.NegotiatedApplicationProtocol = sslStream.NegotiatedApplicationProtocol;
#endif #endif
...@@ -336,7 +336,7 @@ namespace Titanium.Web.Proxy ...@@ -336,7 +336,7 @@ namespace Titanium.Web.Proxy
await connection.StreamWriter.WriteLineAsync(cancellationToken); await connection.StreamWriter.WriteLineAsync(cancellationToken);
await connection.StreamWriter.WriteLineAsync("SM", cancellationToken); await connection.StreamWriter.WriteLineAsync("SM", cancellationToken);
await connection.StreamWriter.WriteLineAsync(cancellationToken); await connection.StreamWriter.WriteLineAsync(cancellationToken);
#if NETCOREAPP2_1 #if NETSTANDARD2_1
await Http2Helper.SendHttp2(clientStream, connection.Stream, await Http2Helper.SendHttp2(clientStream, connection.Stream,
() => new SessionEventArgs(this, endPoint, cancellationTokenSource) () => new SessionEventArgs(this, endPoint, cancellationTokenSource)
{ {
......
...@@ -28,7 +28,7 @@ namespace Titanium.Web.Proxy.Extensions ...@@ -28,7 +28,7 @@ namespace Titanium.Web.Proxy.Extensions
return null; return null;
} }
#if NETCOREAPP2_1 || NETSTANDARD2_1 #if NETSTANDARD2_1
internal static List<SslApplicationProtocol> GetAlpn(this ClientHelloInfo clientHelloInfo) internal static List<SslApplicationProtocol> GetAlpn(this ClientHelloInfo clientHelloInfo)
{ {
if (clientHelloInfo.Extensions != null && clientHelloInfo.Extensions.TryGetValue("ALPN", out var alpnExtension)) if (clientHelloInfo.Extensions != null && clientHelloInfo.Extensions.TryGetValue("ALPN", out var alpnExtension))
...@@ -78,7 +78,7 @@ namespace Titanium.Web.Proxy.Extensions ...@@ -78,7 +78,7 @@ namespace Titanium.Web.Proxy.Extensions
#endif #endif
} }
#if !NETCOREAPP2_1 && !NETSTANDARD2_1 #if !NETSTANDARD2_1
internal enum SslApplicationProtocol internal enum SslApplicationProtocol
{ {
Http11, Http11,
......
...@@ -167,7 +167,7 @@ namespace Titanium.Web.Proxy.Helpers ...@@ -167,7 +167,7 @@ namespace Titanium.Web.Proxy.Helpers
while (i < lengthToCheck) while (i < lengthToCheck)
{ {
int peeked = await clientStreamReader.PeekBytesAsync(buffer, i, i, lengthToCheck - i, cancellationToken); int peeked = await clientStreamReader.PeekBytesAsync(buffer, i, i, lengthToCheck - i, cancellationToken);
if (peeked == 0) if (peeked <= 0)
return -1; return -1;
peeked += i; peeked += i;
......
#if NETCOREAPP2_1 || NETSTANDARD2_1 #if NETSTANDARD2_1
using System; using System;
using System.Collections.Concurrent; using System.Collections.Concurrent;
using System.Collections.Generic; using System.Collections.Generic;
......
using System; using System;
using System.IO; using System.IO;
using System.Net; using System.Net;
#if NETCOREAPP2_1 || NETSTANDARD2_1 #if NETSTANDARD2_1
using System.Net.Security; using System.Net.Security;
#endif #endif
using System.Net.Sockets; using System.Net.Sockets;
......
...@@ -391,7 +391,7 @@ namespace Titanium.Web.Proxy.Network.Tcp ...@@ -391,7 +391,7 @@ namespace Titanium.Web.Proxy.Network.Tcp
CertificateRevocationCheckMode = proxyServer.CheckCertificateRevocation CertificateRevocationCheckMode = proxyServer.CheckCertificateRevocation
}; };
await sslStream.AuthenticateAsClientAsync(options, cancellationToken); await sslStream.AuthenticateAsClientAsync(options, cancellationToken);
#if NETCOREAPP2_1 || NETSTANDARD2_1 #if NETSTANDARD2_1
negotiatedApplicationProtocol = sslStream.NegotiatedApplicationProtocol; negotiatedApplicationProtocol = sslStream.NegotiatedApplicationProtocol;
#endif #endif
......
using System; using System;
using System.Net; using System.Net;
#if NETCOREAPP2_1 || NETSTANDARD2_1 #if NETSTANDARD2_1
using System.Net.Security; using System.Net.Security;
#endif #endif
using System.Net.Sockets; using System.Net.Sockets;
......
...@@ -3,7 +3,7 @@ using System.Collections.Generic; ...@@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Net; using System.Net;
using System.Net.Sockets; using System.Net.Sockets;
#if NETCOREAPP2_1 || NETSTANDARD2_1 #if NETSTANDARD2_1
using System.Net.Security; using System.Net.Security;
#endif #endif
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
......
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard2.1;netcoreapp2.1</TargetFrameworks> <TargetFrameworks>netstandard2.0;netstandard2.1</TargetFrameworks>
<RootNamespace>Titanium.Web.Proxy</RootNamespace> <RootNamespace>Titanium.Web.Proxy</RootNamespace>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo> <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<SignAssembly>True</SignAssembly> <SignAssembly>True</SignAssembly>
...@@ -35,15 +35,6 @@ ...@@ -35,15 +35,6 @@
</PackageReference> </PackageReference>
</ItemGroup> </ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp2.1'">
<PackageReference Include="Microsoft.Win32.Registry">
<Version>4.6.0</Version>
</PackageReference>
<PackageReference Include="System.Security.Principal.Windows">
<Version>4.6.0</Version>
</PackageReference>
</ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Update="Network\WinAuth\Security\Common.cs"> <Compile Update="Network\WinAuth\Security\Common.cs">
<ExcludeFromSourceAnalysis>True</ExcludeFromSourceAnalysis> <ExcludeFromSourceAnalysis>True</ExcludeFromSourceAnalysis>
......
...@@ -28,18 +28,10 @@ ...@@ -28,18 +28,10 @@
<dependency id="System.Buffers" version="4.5.0" /> <dependency id="System.Buffers" version="4.5.0" />
<dependency id="System.Security.Principal.Windows" version="4.6.0" /> <dependency id="System.Security.Principal.Windows" version="4.6.0" />
</group> </group>
<group targetFramework="netcoreapp2.1">
<dependency id="Portable.BouncyCastle" version="1.8.5" />
<dependency id="BrotliSharpLib" version="0.3.3" />
<dependency id="Microsoft.Win32.Registry" version="4.6.0" />
<dependency id="System.Buffers" version="4.5.0" />
<dependency id="System.Security.Principal.Windows" version="4.6.0" />
</group>
</dependencies> </dependencies>
</metadata> </metadata>
<files> <files>
<file src="bin\$configuration$\netstandard2.0\Titanium.Web.Proxy.dll" target="lib\netstandard2.0" /> <file src="bin\$configuration$\netstandard2.0\Titanium.Web.Proxy.dll" target="lib\netstandard2.0" />
<file src="bin\$configuration$\netstandard2.1\Titanium.Web.Proxy.dll" target="lib\netstandard2.1" /> <file src="bin\$configuration$\netstandard2.1\Titanium.Web.Proxy.dll" target="lib\netstandard2.1" />
<file src="bin\$configuration$\netcoreapp2.1\Titanium.Web.Proxy.dll" target="lib\netcoreapp2.1" />
</files> </files>
</package> </package>
using Microsoft.AspNetCore.Http; using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Buffers; using System.Buffers;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
...@@ -10,7 +8,7 @@ using System.Net.Http; ...@@ -10,7 +8,7 @@ using System.Net.Http;
using System.Net.Sockets; using System.Net.Sockets;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using Titanium.Web.Proxy.EventArguments; using Microsoft.VisualStudio.TestTools.UnitTesting;
using Titanium.Web.Proxy.Http; using Titanium.Web.Proxy.Http;
using Titanium.Web.Proxy.IntegrationTests.Helpers; using Titanium.Web.Proxy.IntegrationTests.Helpers;
...@@ -124,6 +122,7 @@ namespace Titanium.Web.Proxy.IntegrationTests ...@@ -124,6 +122,7 @@ namespace Titanium.Web.Proxy.IntegrationTests
e.Respond(serverError); e.Respond(serverError);
} }
return Task.CompletedTask; return Task.CompletedTask;
}; };
......
...@@ -39,6 +39,7 @@ namespace Titanium.Web.Proxy.IntegrationTests.Helpers ...@@ -39,6 +39,7 @@ namespace Titanium.Web.Proxy.IntegrationTests.Helpers
var readTask = client.GetStream().ReadAsync(buffer, 0, 1024); var readTask = client.GetStream().ReadAsync(buffer, 0, 1024);
if (!readTask.Wait(200)) if (!readTask.Wait(200))
return null; return null;
responseMsg += MsgEncoding.GetString(buffer, 0, readTask.Result); responseMsg += MsgEncoding.GetString(buffer, 0, readTask.Result);
} }
...@@ -58,10 +59,8 @@ namespace Titanium.Web.Proxy.IntegrationTests.Helpers ...@@ -58,10 +59,8 @@ namespace Titanium.Web.Proxy.IntegrationTests.Helpers
return response; return response;
} }
else
{
return response; return response;
} }
} }
}
} }
...@@ -66,6 +66,7 @@ namespace Titanium.Web.Proxy.IntegrationTests.Helpers ...@@ -66,6 +66,7 @@ namespace Titanium.Web.Proxy.IntegrationTests.Helpers
{ {
Console.WriteLine($"{ex.GetType()}: {ex.Message}"); Console.WriteLine($"{ex.GetType()}: {ex.Message}");
} }
return request; return request;
} }
...@@ -87,6 +88,7 @@ namespace Titanium.Web.Proxy.IntegrationTests.Helpers ...@@ -87,6 +88,7 @@ namespace Titanium.Web.Proxy.IntegrationTests.Helpers
{ {
Console.WriteLine($"{ex.GetType()}: {ex.Message}"); Console.WriteLine($"{ex.GetType()}: {ex.Message}");
} }
return request; return request;
} }
} }
......
...@@ -12,6 +12,7 @@ namespace Titanium.Web.Proxy.IntegrationTests.Helpers ...@@ -12,6 +12,7 @@ namespace Titanium.Web.Proxy.IntegrationTests.Helpers
/// http request, but it's good enough for testing purposes. /// http request, but it's good enough for testing purposes.
/// </summary> /// </summary>
/// <param name="messageText">The request message</param> /// <param name="messageText">The request message</param>
/// <param name="requireBody"></param>
/// <returns>Request object if message complete, null otherwise</returns> /// <returns>Request object if message complete, null otherwise</returns>
internal static Request ParseRequest(string messageText, bool requireBody) internal static Request ParseRequest(string messageText, bool requireBody)
{ {
...@@ -25,9 +26,7 @@ namespace Titanium.Web.Proxy.IntegrationTests.Helpers ...@@ -25,9 +26,7 @@ namespace Titanium.Web.Proxy.IntegrationTests.Helpers
Request.ParseRequestLine(line, out var method, out var url, out var version); Request.ParseRequestLine(line, out var method, out var url, out var version);
RequestResponseBase request = new Request() RequestResponseBase request = new Request()
{ {
Method = method, Method = method, RequestUriString = url, HttpVersion = version
RequestUriString = url,
HttpVersion = version
}; };
while (!string.IsNullOrEmpty(line = reader.ReadLine())) while (!string.IsNullOrEmpty(line = reader.ReadLine()))
{ {
...@@ -46,7 +45,10 @@ namespace Titanium.Web.Proxy.IntegrationTests.Helpers ...@@ -46,7 +45,10 @@ namespace Titanium.Web.Proxy.IntegrationTests.Helpers
if (parseBody(reader, ref request)) if (parseBody(reader, ref request))
return request as Request; return request as Request;
} }
catch { } catch
{
// ignore
}
return null; return null;
} }
...@@ -63,14 +65,13 @@ namespace Titanium.Web.Proxy.IntegrationTests.Helpers ...@@ -63,14 +65,13 @@ namespace Titanium.Web.Proxy.IntegrationTests.Helpers
var line = reader.ReadLine(); var line = reader.ReadLine();
if (string.IsNullOrEmpty(line)) if (string.IsNullOrEmpty(line))
return null; return null;
try try
{ {
Response.ParseResponseLine(line, out var version, out var status, out var desc); Response.ParseResponseLine(line, out var version, out var status, out var desc);
RequestResponseBase response = new Response() RequestResponseBase response = new Response()
{ {
HttpVersion = version, HttpVersion = version, StatusCode = status, StatusDescription = desc
StatusCode = status,
StatusDescription = desc
}; };
while (!string.IsNullOrEmpty(line = reader.ReadLine())) while (!string.IsNullOrEmpty(line = reader.ReadLine()))
...@@ -87,7 +88,10 @@ namespace Titanium.Web.Proxy.IntegrationTests.Helpers ...@@ -87,7 +88,10 @@ namespace Titanium.Web.Proxy.IntegrationTests.Helpers
if (parseBody(reader, ref response)) if (parseBody(reader, ref response))
return response as Response; return response as Response;
} }
catch { } catch
{
// ignore
}
return null; return null;
} }
...@@ -100,14 +104,11 @@ namespace Titanium.Web.Proxy.IntegrationTests.Helpers ...@@ -100,14 +104,11 @@ namespace Titanium.Web.Proxy.IntegrationTests.Helpers
// no body, done // no body, done
return true; return true;
} }
else
{
obj.Body = Encoding.ASCII.GetBytes(reader.ReadToEnd()); obj.Body = Encoding.ASCII.GetBytes(reader.ReadToEnd());
if (obj.ContentLength == obj.OriginalContentLength)
return true; // done reading body // done reading body
else return obj.ContentLength == obj.OriginalContentLength;
return false; // not done reading body
}
} }
} }
} }
using Microsoft.AspNetCore.Http; using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Net; using System.Net;
using System.Net.Http; using System.Net.Http;
using System.Net.Http.Headers; using System.Net.Http.Headers;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace Titanium.Web.Proxy.IntegrationTests namespace Titanium.Web.Proxy.IntegrationTests
{ {
......
using Microsoft.AspNetCore.Http; using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Net; using System.Net;
using System.Net.Http; using System.Net.Http;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace Titanium.Web.Proxy.IntegrationTests namespace Titanium.Web.Proxy.IntegrationTests
{ {
......
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework> <TargetFramework>netcoreapp3.0</TargetFramework>
<AssemblyOriginatorKeyFile>StrongNameKey.snk</AssemblyOriginatorKeyFile> <AssemblyOriginatorKeyFile>StrongNameKey.snk</AssemblyOriginatorKeyFile>
<SignAssembly>true</SignAssembly> <SignAssembly>true</SignAssembly>
</PropertyGroup> </PropertyGroup>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment