Unverified Commit 96a8b1bf authored by honfika's avatar honfika Committed by GitHub

Merge pull request #642 from justcoding121/master

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