< Summary

Line coverage
30%
Covered lines: 6
Uncovered lines: 14
Coverable lines: 20
Total lines: 72
Line coverage: 30%
Branch coverage
0%
Covered branches: 0
Total branches: 8
Branch coverage: 0%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Cyclomatic complexity NPath complexity Sequence coverage
.ctor()100%11100%

File(s)

https://raw.githubusercontent.com/dotnet/runtime/811a7eabb75c42db53440e8ba3f60c07511cfd1f/src/libraries/System.Net.WebSockets/src/System/Net/WebSockets/WebSocketDeflateOptions.cs

#LineLine coverage
 1// Licensed to the .NET Foundation under one or more agreements.
 2// The .NET Foundation licenses this file to you under the MIT license.
 3
 4namespace System.Net.WebSockets
 5{
 6    /// <summary>
 7    /// Options to enable per-message deflate compression for <seealso cref="WebSocket" />.
 8    /// </summary>
 9    /// <remarks>
 10    /// Although the WebSocket spec allows window bits from 8 to 15, the current implementation doesn't support 8 bits.
 11    /// </remarks>
 12    public sealed class WebSocketDeflateOptions
 13    {
 202514        private int _clientMaxWindowBits = WebSocketValidate.MaxDeflateWindowBits;
 202515        private int _serverMaxWindowBits = WebSocketValidate.MaxDeflateWindowBits;
 16
 17        /// <summary>
 18        /// This parameter indicates the base-2 logarithm for the LZ77 sliding window size used by
 19        /// the client to compress messages and by the server to decompress them.
 20        /// Must be a value between 9 and 15. The default is 15.
 21        /// </summary>
 22        /// <remarks>https://tools.ietf.org/html/rfc7692#section-7.1.2.2</remarks>
 23        public int ClientMaxWindowBits
 24        {
 202525            get => _clientMaxWindowBits;
 26            set
 027            {
 028                if (value < WebSocketValidate.MinDeflateWindowBits || value > WebSocketValidate.MaxDeflateWindowBits)
 029                {
 030                    throw new ArgumentOutOfRangeException(nameof(ClientMaxWindowBits), value,
 031                        SR.Format(SR.net_WebSockets_ArgumentOutOfRange, WebSocketValidate.MinDeflateWindowBits, WebSocke
 32                }
 033                _clientMaxWindowBits = value;
 034            }
 35        }
 36
 37        /// <summary>
 38        /// When true the client-side of the connection indicates that it will persist the deflate context across messag
 39        /// The default is true.
 40        /// </summary>
 41        /// <remarks>https://tools.ietf.org/html/rfc7692#section-7.1.1.2</remarks>
 405042        public bool ClientContextTakeover { get; set; } = true;
 43
 44        /// <summary>
 45        /// This parameter indicates the base-2 logarithm for the LZ77 sliding window size used by
 46        /// the server to compress messages and by the client to decompress them.
 47        /// Must be a value between 9 and 15. The default is 15.
 48        /// </summary>
 49        /// <remarks>https://tools.ietf.org/html/rfc7692#section-7.1.2.1</remarks>
 50        public int ServerMaxWindowBits
 51        {
 202552            get => _serverMaxWindowBits;
 53            set
 054            {
 055                if (value < WebSocketValidate.MinDeflateWindowBits || value > WebSocketValidate.MaxDeflateWindowBits)
 056                {
 057                    throw new ArgumentOutOfRangeException(nameof(ServerMaxWindowBits), value,
 058                        SR.Format(SR.net_WebSockets_ArgumentOutOfRange, WebSocketValidate.MinDeflateWindowBits, WebSocke
 59                }
 060                _serverMaxWindowBits = value;
 061            }
 62        }
 63
 64        /// <summary>
 65        /// When true the server-side of the connection indicates that it will persist the deflate context across messag
 66        /// The default is true.
 67        /// </summary>
 68        /// <remarks>https://tools.ietf.org/html/rfc7692#section-7.1.1.1</remarks>
 405069        public bool ServerContextTakeover { get; set; } = true;
 70    }
 71}
 72