diff --git a/src/CHttpServer/CHttpServer/DuplexPipeStreamAdapter.cs b/src/CHttpServer/CHttpServer/DuplexPipeStreamAdapter.cs index ee44f5f..6b062cb 100644 --- a/src/CHttpServer/CHttpServer/DuplexPipeStreamAdapter.cs +++ b/src/CHttpServer/CHttpServer/DuplexPipeStreamAdapter.cs @@ -7,7 +7,7 @@ namespace CHttpServer; internal class DuplexPipeStreamAdapter : Stream, IDuplexPipe where TStream : Stream { private bool _disposed; - private readonly object _disposeLock = new object(); + private readonly Lock _disposeLock = new(); public DuplexPipeStreamAdapter(TStream stream, StreamPipeReaderOptions readerOptions, StreamPipeWriterOptions writerOptions) { diff --git a/src/CHttpServer/CHttpServer/Http3/Http3FramingStreamWriter.cs b/src/CHttpServer/CHttpServer/Http3/Http3FramingStreamWriter.cs index 18c0ec6..bae9dc8 100644 --- a/src/CHttpServer/CHttpServer/Http3/Http3FramingStreamWriter.cs +++ b/src/CHttpServer/CHttpServer/Http3/Http3FramingStreamWriter.cs @@ -154,7 +154,7 @@ public override async ValueTask WriteAsync(ReadOnlyMemory sou _responseStream.Flush(); return new FlushResult(isCanceled: false, isCompleted: false); } - catch (Exception ex) + catch (Exception) { _isCompleted = true; ClearSegments(CollectionsMarshal.AsSpan(_segments)); diff --git a/src/CHttpServer/CHttpServer/HttpsConnectionMiddleware.cs b/src/CHttpServer/CHttpServer/HttpsConnectionMiddleware.cs index 928f4ac..71a4fc8 100644 --- a/src/CHttpServer/CHttpServer/HttpsConnectionMiddleware.cs +++ b/src/CHttpServer/CHttpServer/HttpsConnectionMiddleware.cs @@ -54,7 +54,7 @@ public async Task OnConnectionAsync(CHttp2ConnectionContext context) } var sslDuplexPipe = CreateSslDuplexPipe( - context.Transport, + context.Transport!, context.Features.Get()?.MemoryPool ?? MemoryPool.Shared); var sslStream = sslDuplexPipe.Stream; @@ -252,17 +252,23 @@ public X509Certificate2? ClientCertificate // Required for TLS Handshake feature public TlsCipherSuite? NegotiatedCipherSuite => _sslStream.NegotiatedCipherSuite; - + + [Obsolete("Obsolete by BCL, use NegotiatedCipherSuite instead.")] public CipherAlgorithmType CipherAlgorithm => _sslStream.CipherAlgorithm; + [Obsolete("Obsolete by BCL, use NegotiatedCipherSuite instead.")] public int CipherStrength => _sslStream.CipherStrength; + [Obsolete("Obsolete by BCL, use NegotiatedCipherSuite instead.")] public HashAlgorithmType HashAlgorithm => _sslStream.HashAlgorithm; + [Obsolete("Obsolete by BCL, use NegotiatedCipherSuite instead.")] public int HashStrength => _sslStream.HashStrength; + [Obsolete("Obsolete by BCL, use NegotiatedCipherSuite instead.")] public ExchangeAlgorithmType KeyExchangeAlgorithm => _sslStream.KeyExchangeAlgorithm; + [Obsolete("Obsolete by BCL, use NegotiatedCipherSuite instead.")] public int KeyExchangeStrength => _sslStream.KeyExchangeStrength; public Task GetClientCertificateAsync(CancellationToken cancellationToken) diff --git a/src/CHttpServer/TestCHttpServerApplication/Program.cs b/src/CHttpServer/TestCHttpServerApplication/Program.cs index 3ea9cc9..8e3983a 100644 --- a/src/CHttpServer/TestCHttpServerApplication/Program.cs +++ b/src/CHttpServer/TestCHttpServerApplication/Program.cs @@ -58,7 +58,7 @@ public class Data { - public string Message { get; set; } + public required string Message { get; set; } } [JsonSerializable(typeof(Data))] diff --git a/tests/CHttpServer.Tests/TestBase.cs b/tests/CHttpServer.Tests/TestBase.cs index e205e75..7d3713c 100644 --- a/tests/CHttpServer.Tests/TestBase.cs +++ b/tests/CHttpServer.Tests/TestBase.cs @@ -116,14 +116,17 @@ internal class TestTls : ITlsHandshakeFeature { public SslProtocols Protocol => SslProtocols.Tls12; + [Obsolete("Obsolete by BCL, use NegotiatedCipherSuite instead.")] public CipherAlgorithmType CipherAlgorithm => throw new NotImplementedException(); public int CipherStrength => throw new NotImplementedException(); + [Obsolete("Obsolete by BCL, use NegotiatedCipherSuite instead.")] public HashAlgorithmType HashAlgorithm => throw new NotImplementedException(); public int HashStrength => throw new NotImplementedException(); + [Obsolete("Obsolete by BCL, use NegotiatedCipherSuite instead.")] public ExchangeAlgorithmType KeyExchangeAlgorithm => throw new NotImplementedException(); public int KeyExchangeStrength => throw new NotImplementedException();