diff --git a/examples/Titanium.Web.Proxy.Examples.Basic/Titanium.Web.Proxy.Examples.Basic.csproj b/examples/Titanium.Web.Proxy.Examples.Basic/Titanium.Web.Proxy.Examples.Basic.csproj
index 18914479a..d924886a0 100644
--- a/examples/Titanium.Web.Proxy.Examples.Basic/Titanium.Web.Proxy.Examples.Basic.csproj
+++ b/examples/Titanium.Web.Proxy.Examples.Basic/Titanium.Web.Proxy.Examples.Basic.csproj
@@ -2,7 +2,7 @@
Exe
- net461;netcoreapp2.1
+ net461;netcoreapp3.0
false
7.1
diff --git a/src/Titanium.Web.Proxy/ExplicitClientHandler.cs b/src/Titanium.Web.Proxy/ExplicitClientHandler.cs
index 6035beaed..09a964995 100644
--- a/src/Titanium.Web.Proxy/ExplicitClientHandler.cs
+++ b/src/Titanium.Web.Proxy/ExplicitClientHandler.cs
@@ -210,7 +210,7 @@ await clientStreamWriter.WriteResponseAsync(connectArgs.HttpClient.Response,
options.CertificateRevocationCheckMode = X509RevocationMode.NoCheck;
await sslStream.AuthenticateAsServerAsync(options, cancellationToken);
-#if NETCOREAPP2_1
+#if NETSTANDARD2_1
clientConnection.NegotiatedApplicationProtocol = sslStream.NegotiatedApplicationProtocol;
#endif
@@ -336,7 +336,7 @@ await TcpHelper.SendRaw(clientStream, connection.Stream, BufferPool,
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)
{
diff --git a/src/Titanium.Web.Proxy/Extensions/SslExtensions.cs b/src/Titanium.Web.Proxy/Extensions/SslExtensions.cs
index 81ccd9324..1657b6712 100644
--- a/src/Titanium.Web.Proxy/Extensions/SslExtensions.cs
+++ b/src/Titanium.Web.Proxy/Extensions/SslExtensions.cs
@@ -28,7 +28,7 @@ internal static string GetServerName(this ClientHelloInfo clientHelloInfo)
return null;
}
-#if NETCOREAPP2_1 || NETSTANDARD2_1
+#if NETSTANDARD2_1
internal static List GetAlpn(this ClientHelloInfo clientHelloInfo)
{
if (clientHelloInfo.Extensions != null && clientHelloInfo.Extensions.TryGetValue("ALPN", out var alpnExtension))
@@ -78,7 +78,7 @@ internal static Task AuthenticateAsServerAsync(this SslStream sslStream, SslServ
#endif
}
-#if !NETCOREAPP2_1 && !NETSTANDARD2_1
+#if !NETSTANDARD2_1
internal enum SslApplicationProtocol
{
Http11,
diff --git a/src/Titanium.Web.Proxy/Helpers/HttpHelper.cs b/src/Titanium.Web.Proxy/Helpers/HttpHelper.cs
index 71b1d74aa..dd6e57251 100644
--- a/src/Titanium.Web.Proxy/Helpers/HttpHelper.cs
+++ b/src/Titanium.Web.Proxy/Helpers/HttpHelper.cs
@@ -167,7 +167,7 @@ private static async Task startsWith(ICustomStreamReader clientStreamReader
while (i < lengthToCheck)
{
int peeked = await clientStreamReader.PeekBytesAsync(buffer, i, i, lengthToCheck - i, cancellationToken);
- if (peeked == 0)
+ if (peeked <= 0)
return -1;
peeked += i;
diff --git a/src/Titanium.Web.Proxy/Http2/Http2Helper.cs b/src/Titanium.Web.Proxy/Http2/Http2Helper.cs
index 185f0bda8..9401c2290 100644
--- a/src/Titanium.Web.Proxy/Http2/Http2Helper.cs
+++ b/src/Titanium.Web.Proxy/Http2/Http2Helper.cs
@@ -1,4 +1,4 @@
-#if NETCOREAPP2_1 || NETSTANDARD2_1
+#if NETSTANDARD2_1
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
diff --git a/src/Titanium.Web.Proxy/Network/Tcp/TcpClientConnection.cs b/src/Titanium.Web.Proxy/Network/Tcp/TcpClientConnection.cs
index 6174406ef..877799b76 100644
--- a/src/Titanium.Web.Proxy/Network/Tcp/TcpClientConnection.cs
+++ b/src/Titanium.Web.Proxy/Network/Tcp/TcpClientConnection.cs
@@ -1,7 +1,7 @@
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;
diff --git a/src/Titanium.Web.Proxy/Network/Tcp/TcpConnectionFactory.cs b/src/Titanium.Web.Proxy/Network/Tcp/TcpConnectionFactory.cs
index 39aee703d..297996fb6 100644
--- a/src/Titanium.Web.Proxy/Network/Tcp/TcpConnectionFactory.cs
+++ b/src/Titanium.Web.Proxy/Network/Tcp/TcpConnectionFactory.cs
@@ -391,7 +391,7 @@ private async Task createServerConnection(string remoteHost
CertificateRevocationCheckMode = proxyServer.CheckCertificateRevocation
};
await sslStream.AuthenticateAsClientAsync(options, cancellationToken);
-#if NETCOREAPP2_1 || NETSTANDARD2_1
+#if NETSTANDARD2_1
negotiatedApplicationProtocol = sslStream.NegotiatedApplicationProtocol;
#endif
diff --git a/src/Titanium.Web.Proxy/Network/Tcp/TcpServerConnection.cs b/src/Titanium.Web.Proxy/Network/Tcp/TcpServerConnection.cs
index 051ee3250..ee649665e 100644
--- a/src/Titanium.Web.Proxy/Network/Tcp/TcpServerConnection.cs
+++ b/src/Titanium.Web.Proxy/Network/Tcp/TcpServerConnection.cs
@@ -1,6 +1,6 @@
using System;
using System.Net;
-#if NETCOREAPP2_1 || NETSTANDARD2_1
+#if NETSTANDARD2_1
using System.Net.Security;
#endif
using System.Net.Sockets;
diff --git a/src/Titanium.Web.Proxy/RequestHandler.cs b/src/Titanium.Web.Proxy/RequestHandler.cs
index c6cd9516e..0dcbd29ee 100644
--- a/src/Titanium.Web.Proxy/RequestHandler.cs
+++ b/src/Titanium.Web.Proxy/RequestHandler.cs
@@ -3,7 +3,7 @@
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;
diff --git a/src/Titanium.Web.Proxy/Titanium.Web.Proxy.csproj b/src/Titanium.Web.Proxy/Titanium.Web.Proxy.csproj
index ad7709dd0..13275b8be 100644
--- a/src/Titanium.Web.Proxy/Titanium.Web.Proxy.csproj
+++ b/src/Titanium.Web.Proxy/Titanium.Web.Proxy.csproj
@@ -1,7 +1,7 @@
- netstandard2.0;netstandard2.1;netcoreapp2.1
+ netstandard2.0;netstandard2.1
Titanium.Web.Proxy
false
True
@@ -35,15 +35,6 @@
-
-
- 4.6.0
-
-
- 4.6.0
-
-
-
True
diff --git a/src/Titanium.Web.Proxy/Titanium.Web.Proxy.nuspec b/src/Titanium.Web.Proxy/Titanium.Web.Proxy.nuspec
index 35443b675..80a5fcfe6 100644
--- a/src/Titanium.Web.Proxy/Titanium.Web.Proxy.nuspec
+++ b/src/Titanium.Web.Proxy/Titanium.Web.Proxy.nuspec
@@ -28,18 +28,10 @@
-
-
-
-
-
-
-
-
diff --git a/tests/Titanium.Web.Proxy.IntegrationTests/ExpectContinueTests.cs b/tests/Titanium.Web.Proxy.IntegrationTests/ExpectContinueTests.cs
index b0b3631d1..1becd5eb4 100644
--- a/tests/Titanium.Web.Proxy.IntegrationTests/ExpectContinueTests.cs
+++ b/tests/Titanium.Web.Proxy.IntegrationTests/ExpectContinueTests.cs
@@ -1,6 +1,4 @@
-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.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 @@ public async Task ReverseProxy_BeforeRequestThrows()
e.Respond(serverError);
}
+
return Task.CompletedTask;
};
diff --git a/tests/Titanium.Web.Proxy.IntegrationTests/Helpers/HttpContinueClient.cs b/tests/Titanium.Web.Proxy.IntegrationTests/Helpers/HttpContinueClient.cs
index 701cccca2..673a226d4 100644
--- a/tests/Titanium.Web.Proxy.IntegrationTests/Helpers/HttpContinueClient.cs
+++ b/tests/Titanium.Web.Proxy.IntegrationTests/Helpers/HttpContinueClient.cs
@@ -39,6 +39,7 @@ public async Task Post(string server, int port, string content)
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 @@ public async Task Post(string server, int port, string content)
return response;
}
- else
- {
- return response;
- }
+
+ return response;
}
}
}
diff --git a/tests/Titanium.Web.Proxy.IntegrationTests/Helpers/HttpContinueServer.cs b/tests/Titanium.Web.Proxy.IntegrationTests/Helpers/HttpContinueServer.cs
index 137cd9e23..adbad4178 100644
--- a/tests/Titanium.Web.Proxy.IntegrationTests/Helpers/HttpContinueServer.cs
+++ b/tests/Titanium.Web.Proxy.IntegrationTests/Helpers/HttpContinueServer.cs
@@ -66,6 +66,7 @@ private async Task ReadHeaders(PipeReader input)
{
Console.WriteLine($"{ex.GetType()}: {ex.Message}");
}
+
return request;
}
@@ -87,6 +88,7 @@ private async Task ReadBody(Request request, PipeReader input)
{
Console.WriteLine($"{ex.GetType()}: {ex.Message}");
}
+
return request;
}
}
diff --git a/tests/Titanium.Web.Proxy.IntegrationTests/Helpers/HttpMessageParsing.cs b/tests/Titanium.Web.Proxy.IntegrationTests/Helpers/HttpMessageParsing.cs
index 9733568fc..a4ef90a31 100644
--- a/tests/Titanium.Web.Proxy.IntegrationTests/Helpers/HttpMessageParsing.cs
+++ b/tests/Titanium.Web.Proxy.IntegrationTests/Helpers/HttpMessageParsing.cs
@@ -12,6 +12,7 @@ internal static class HttpMessageParsing
/// http request, but it's good enough for testing purposes.
///
/// The request message
+ ///
/// Request object if message complete, null otherwise
internal static Request ParseRequest(string messageText, bool requireBody)
{
@@ -25,9 +26,7 @@ internal static Request ParseRequest(string messageText, bool requireBody)
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 @@ internal static Request ParseRequest(string messageText, bool requireBody)
if (parseBody(reader, ref request))
return request as Request;
}
- catch { }
+ catch
+ {
+ // ignore
+ }
return null;
}
@@ -63,14 +65,13 @@ internal static Response ParseResponse(string messageText)
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 @@ internal static Response ParseResponse(string messageText)
if (parseBody(reader, ref response))
return response as Response;
}
- catch { }
+ catch
+ {
+ // ignore
+ }
return null;
}
@@ -100,14 +104,11 @@ private static bool parseBody(StringReader reader, ref RequestResponseBase obj)
// 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;
}
}
}
diff --git a/tests/Titanium.Web.Proxy.IntegrationTests/NestedProxyTests.cs b/tests/Titanium.Web.Proxy.IntegrationTests/NestedProxyTests.cs
index 8bb2080f6..d0267a560 100644
--- a/tests/Titanium.Web.Proxy.IntegrationTests/NestedProxyTests.cs
+++ b/tests/Titanium.Web.Proxy.IntegrationTests/NestedProxyTests.cs
@@ -1,11 +1,11 @@
-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
{
diff --git a/tests/Titanium.Web.Proxy.IntegrationTests/ReverseProxyTests.cs b/tests/Titanium.Web.Proxy.IntegrationTests/ReverseProxyTests.cs
index 37a6fb6d9..c38d6f6d2 100644
--- a/tests/Titanium.Web.Proxy.IntegrationTests/ReverseProxyTests.cs
+++ b/tests/Titanium.Web.Proxy.IntegrationTests/ReverseProxyTests.cs
@@ -1,9 +1,9 @@
-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
{
diff --git a/tests/Titanium.Web.Proxy.IntegrationTests/Titanium.Web.Proxy.IntegrationTests.csproj b/tests/Titanium.Web.Proxy.IntegrationTests/Titanium.Web.Proxy.IntegrationTests.csproj
index d0411b1dd..42c450b0b 100644
--- a/tests/Titanium.Web.Proxy.IntegrationTests/Titanium.Web.Proxy.IntegrationTests.csproj
+++ b/tests/Titanium.Web.Proxy.IntegrationTests/Titanium.Web.Proxy.IntegrationTests.csproj
@@ -1,7 +1,7 @@
- netcoreapp2.2
+ netcoreapp3.0
StrongNameKey.snk
true