< Summary

Line coverage
0%
Covered lines: 0
Uncovered lines: 11
Coverable lines: 11
Total lines: 63
Line coverage: 0%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

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

File(s)

https://raw.githubusercontent.com/dotnet/runtime/811a7eabb75c42db53440e8ba3f60c07511cfd1f/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/SocketsHttpPlaintextStreamFilterContext.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
 4using System.Diagnostics.CodeAnalysis;
 5using System.Diagnostics.Tracing;
 6using System.IO;
 7
 8namespace System.Net.Http
 9{
 10    /// <summary>
 11    /// Represents the context passed to the PlaintextStreamFilter for a SocketsHttpHandler instance.
 12    /// </summary>
 13    public sealed class SocketsHttpPlaintextStreamFilterContext
 14    {
 15        private readonly Stream _plaintextStream;
 16        private readonly Version _negotiatedHttpVersion;
 17        private readonly HttpRequestMessage _initialRequestMessage;
 18        private readonly long _connectionId;
 19
 020        internal SocketsHttpPlaintextStreamFilterContext(Stream plaintextStream, Version negotiatedHttpVersion, HttpRequ
 021        {
 022            _plaintextStream = plaintextStream;
 023            _negotiatedHttpVersion = negotiatedHttpVersion;
 024            _initialRequestMessage = initialRequestMessage;
 025            _connectionId = connectionId;
 026        }
 27
 28        /// <summary>
 29        /// The plaintext Stream that will be used for HTTP protocol requests and responses.
 30        /// </summary>
 031        public Stream PlaintextStream => _plaintextStream;
 32
 33        /// <summary>
 34        /// The version of HTTP in use for this stream.
 35        /// </summary>
 036        public Version NegotiatedHttpVersion => _negotiatedHttpVersion;
 37
 38        /// <summary>
 39        /// The initial HttpRequestMessage that is causing the stream to be used.
 40        /// </summary>
 041        public HttpRequestMessage InitialRequestMessage => _initialRequestMessage;
 42
 43        /// <summary>
 44        /// The identifier of the connection whose stream is being filtered. This matches the connection id reported
 45        /// through <see cref="EventSource"/> telemetry for that connection. For a direct connection it also matches the
 46        /// <see cref="SocketsHttpConnectionContext.ConnectionId"/> surfaced to
 47        /// <see cref="SocketsHttpHandler.ConnectCallback"/>, the
 48        /// <see cref="SocketsHttpConnectionEvictionContext.ConnectionId"/> passed to
 49        /// <see cref="SocketsHttpHandler.ShouldEvictConnection"/>, and the <see cref="HttpRequestMessage.ConnectionId"/
 50        /// stamped on requests sent over the connection. It can be used to associate caller state with the connection
 51        /// and to correlate it with the requests it serves.
 52        /// </summary>
 53        /// <remarks>
 54        /// For an HTTP CONNECT proxy tunnel the filter runs once per hop: on the CONNECT hop this is the transport
 55        /// connection's id (the one the <see cref="SocketsHttpHandler.ConnectCallback"/> observed), and on the
 56        /// tunneled hop it is the tunneled connection's id (the one passed to
 57        /// <see cref="SocketsHttpHandler.ShouldEvictConnection"/> and stamped on requests).
 58        /// </remarks>
 59        [Experimental(Experimentals.SocketsHttpHandlerExperimentalDiagId, UrlFormat = Experimentals.SharedUrlFormat)]
 060        public long ConnectionId => _connectionId;
 61    }
 62}
 63