Make Kestrels Internals truly internal. (#8517)

This commit is contained in:
Justin Kotalik 2019-03-18 10:15:39 -07:00 committed by GitHub
parent 5c6e1aa1d9
commit a3c8bd16f7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
218 changed files with 664 additions and 2662 deletions

View File

@ -5,14 +5,13 @@ using System;
using System.IO;
using System.IO.Pipelines;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http;
using Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Infrastructure;
using Microsoft.AspNetCore.Server.Kestrel.Transport.Abstractions.Internal;
using Microsoft.Extensions.Logging;
namespace Microsoft.AspNetCore.Server.Kestrel.Core.Adapter.Internal
{
public class AdaptedPipeline : IDuplexPipe
internal class AdaptedPipeline : IDuplexPipe
{
private static readonly int MinAllocBufferSize = KestrelMemoryPool.MinimumSegmentSize / 2;

View File

@ -8,7 +8,7 @@ using Microsoft.Extensions.Logging;
namespace Microsoft.AspNetCore.Server.Kestrel.Core.Adapter.Internal
{
public class LoggingConnectionAdapter : IConnectionAdapter
internal class LoggingConnectionAdapter : IConnectionAdapter
{
private readonly ILogger _logger;

View File

@ -10,7 +10,7 @@ using System.Buffers;
namespace Microsoft.AspNetCore.Server.Kestrel.Core.Adapter.Internal
{
public class RawStream : Stream
internal class RawStream : Stream
{
private readonly PipeReader _input;
private readonly PipeWriter _output;

View File

@ -1,4 +1,4 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Diagnostics;
@ -42,10 +42,8 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core
}
[StackTraceHidden]
#pragma warning disable PUB0001 // Pubternal type in public API
public static void Throw(RequestRejectionReason reason, HttpMethod method)
internal static void Throw(RequestRejectionReason reason, HttpMethod method)
=> throw GetException(reason, method.ToString().ToUpperInvariant());
#pragma warning restore PUB0001 // Pubternal type in public API
[MethodImpl(MethodImplOptions.NoInlining)]
internal static BadHttpRequestException GetException(RequestRejectionReason reason)
@ -175,4 +173,4 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core
return ex;
}
}
}
}

View File

@ -1,4 +1,4 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;

View File

@ -1,4 +1,4 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
@ -13,7 +13,7 @@ using Microsoft.Extensions.Logging;
namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal
{
public class ConnectionDispatcher : IConnectionDispatcher
internal class ConnectionDispatcher : IConnectionDispatcher
{
private static long _lastConnectionId = long.MinValue;

View File

@ -1,4 +1,4 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Threading.Tasks;
@ -8,7 +8,7 @@ using Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Infrastructure;
namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal
{
public class ConnectionLimitMiddleware
internal class ConnectionLimitMiddleware
{
private readonly ConnectionDelegate _next;
private readonly ResourceCounter _concurrentConnectionCounter;

View File

@ -8,7 +8,7 @@ using System.Globalization;
namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal
{
public class ConnectionLogScope : IReadOnlyList<KeyValuePair<string, object>>
internal class ConnectionLogScope : IReadOnlyList<KeyValuePair<string, object>>
{
private readonly string _connectionId;

View File

@ -1,4 +1,7 @@
namespace System.IO.Pipelines
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
namespace System.IO.Pipelines
{
internal class DuplexPipe : IDuplexPipe
{

View File

@ -6,7 +6,7 @@ using System;
namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http
{
[Flags]
public enum ConnectionOptions
internal enum ConnectionOptions
{
None = 0,
Close = 1,

View File

@ -12,7 +12,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http
/// <summary>
/// Manages the generation of the date header value.
/// </summary>
public class DateHeaderValueManager : IHeartbeatHandler
internal class DateHeaderValueManager : IHeartbeatHandler
{
private static readonly byte[] _datePreambleBytes = Encoding.ASCII.GetBytes("\r\nDate: ");

View File

@ -9,7 +9,6 @@ using System.IO.Pipelines;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Connections;
using Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Infrastructure;
using Microsoft.AspNetCore.Server.Kestrel.Transport.Abstractions.Internal;
namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http
@ -17,7 +16,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http
/// <summary>
/// http://tools.ietf.org/html/rfc2616#section-3.6.1
/// </summary>
public class Http1ChunkedEncodingMessageBody : Http1MessageBody
internal class Http1ChunkedEncodingMessageBody : Http1MessageBody
{
// byte consts don't have a data type annotation so we pre-cast it
private const byte ByteCR = (byte)'\r';

View File

@ -11,7 +11,7 @@ using Microsoft.AspNetCore.Server.Kestrel.Core.Features;
namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http
{
public partial class Http1Connection : IHttpMinRequestBodyDataRateFeature,
internal partial class Http1Connection : IHttpMinRequestBodyDataRateFeature,
IHttpMinResponseDataRateFeature
{
MinDataRate IHttpMinRequestBodyDataRateFeature.MinDataRate

View File

@ -11,11 +11,10 @@ using System.Threading.Tasks;
using Microsoft.AspNetCore.Connections;
using Microsoft.AspNetCore.Http.Features;
using Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Infrastructure;
using Microsoft.AspNetCore.Server.Kestrel.Transport.Abstractions.Internal;
namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http
{
public partial class Http1Connection : HttpProtocol, IRequestProcessor
internal partial class Http1Connection : HttpProtocol, IRequestProcessor
{
private const byte ByteAsterisk = (byte)'*';
private const byte ByteForwardSlash = (byte)'/';

View File

@ -9,7 +9,7 @@ using Microsoft.AspNetCore.Connections;
namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http
{
public class Http1ContentLengthMessageBody : Http1MessageBody
internal class Http1ContentLengthMessageBody : Http1MessageBody
{
private readonly long _contentLength;
private long _inputLength;

View File

@ -9,7 +9,7 @@ using Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Infrastructure;
namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http
{
public abstract class Http1MessageBody : MessageBody
internal abstract class Http1MessageBody : MessageBody
{
protected readonly Http1Connection _context;

View File

@ -15,7 +15,7 @@ using Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Infrastructure;
namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http
{
public class Http1OutputProducer : IHttpOutputProducer, IHttpOutputAborter, IDisposable
internal class Http1OutputProducer : IHttpOutputProducer, IHttpOutputAborter, IDisposable
{
// Use C#7.3's ReadOnlySpan<byte> optimization for static data https://vcsjones.com/2019/02/01/csharp-readonly-span-bytes-static/
// "HTTP/1.1 100 Continue\r\n\r\n"

View File

@ -5,7 +5,7 @@ using System;
namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http
{
public readonly struct Http1ParsingHandler : IHttpRequestLineHandler, IHttpHeadersHandler
internal readonly struct Http1ParsingHandler : IHttpRequestLineHandler, IHttpHeadersHandler
{
public readonly Http1Connection Connection;

View File

@ -12,7 +12,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http
/// The upgrade stream uses the raw connection stream instead of going through the RequestBodyPipe. This
/// removes the redundant copy from the transport pipe to the body pipe.
/// </summary>
public class Http1UpgradeMessageBody : Http1MessageBody
internal class Http1UpgradeMessageBody : Http1MessageBody
{
public bool _completed;
public Http1UpgradeMessageBody(Http1Connection context)

View File

@ -12,7 +12,7 @@ using Microsoft.Net.Http.Headers;
namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http
{
public partial class HttpRequestHeaders
internal partial class HttpRequestHeaders
{
private long _bits = 0;
@ -4705,7 +4705,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http
}
}
public partial class HttpResponseHeaders
internal partial class HttpResponseHeaders
{
private static ReadOnlySpan<byte> HeaderBytes => new byte[]
{
@ -8531,7 +8531,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http
}
}
public partial class HttpResponseTrailers
internal partial class HttpResponseTrailers
{
private static ReadOnlySpan<byte> HeaderBytes => new byte[]
{

View File

@ -14,7 +14,7 @@ using Microsoft.Net.Http.Headers;
namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http
{
public abstract class HttpHeaders : IHeaderDictionary
internal abstract class HttpHeaders : IHeaderDictionary
{
protected long? _contentLength;
protected bool _isReadOnly;

View File

@ -3,7 +3,7 @@
namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http
{
public enum HttpMethod: byte
internal enum HttpMethod: byte
{
Get,
Put,

View File

@ -9,7 +9,7 @@ using Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Infrastructure;
namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http
{
public class HttpParser<TRequestHandler> : IHttpParser<TRequestHandler> where TRequestHandler : IHttpHeadersHandler, IHttpRequestLineHandler
internal class HttpParser<TRequestHandler> : IHttpParser<TRequestHandler> where TRequestHandler : IHttpHeadersHandler, IHttpRequestLineHandler
{
private bool _showErrorDetails;

View File

@ -3,7 +3,6 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.IO.Pipelines;
using System.Net;
@ -17,7 +16,7 @@ using Microsoft.AspNetCore.Server.Kestrel.Transport.Abstractions.Internal;
namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http
{
public partial class HttpProtocol : IHttpRequestFeature,
internal partial class HttpProtocol : IHttpRequestFeature,
IHttpResponseFeature,
IResponseBodyPipeFeature,
IRequestBodyPipeFeature,

View File

@ -11,7 +11,7 @@ using Microsoft.AspNetCore.Server.Kestrel.Core.Features;
namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http
{
public partial class HttpProtocol : IFeatureCollection
internal partial class HttpProtocol : IFeatureCollection
{
private static readonly Type IHttpRequestFeatureType = typeof(IHttpRequestFeature);
private static readonly Type IHttpResponseFeatureType = typeof(IHttpResponseFeature);

View File

@ -23,7 +23,7 @@ using Microsoft.Extensions.Primitives;
namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http
{
public abstract partial class HttpProtocol : IDefaultHttpContextContainer, IHttpResponseControl
internal abstract partial class HttpProtocol : IDefaultHttpContextContainer, IHttpResponseControl
{
private static readonly byte[] _bytesConnectionClose = Encoding.ASCII.GetBytes("\r\nConnection: close");
private static readonly byte[] _bytesConnectionKeepAlive = Encoding.ASCII.GetBytes("\r\nConnection: keep-alive");

View File

@ -11,7 +11,7 @@ using Microsoft.Net.Http.Headers;
namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http
{
public sealed partial class HttpRequestHeaders : HttpHeaders
internal sealed partial class HttpRequestHeaders : HttpHeaders
{
private static long ParseContentLength(string value)
{

View File

@ -13,7 +13,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http
/// <summary>
/// Default HttpRequest PipeReader implementation to be used by Kestrel.
/// </summary>
public class HttpRequestPipeReader : PipeReader
internal class HttpRequestPipeReader : PipeReader
{
private MessageBody _body;
private HttpStreamState _state;

View File

@ -3,7 +3,7 @@
namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http
{
public enum HttpRequestTarget
internal enum HttpRequestTarget
{
Unknown = -1,
// origin-form is the most common

View File

@ -12,7 +12,7 @@ using Microsoft.Net.Http.Headers;
namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http
{
public sealed partial class HttpResponseHeaders : HttpHeaders
internal sealed partial class HttpResponseHeaders : HttpHeaders
{
private static ReadOnlySpan<byte> _CrLf => new[] { (byte)'\r', (byte)'\n' };
private static ReadOnlySpan<byte> _colonSpace => new[] { (byte)':', (byte)' ' };

View File

@ -9,7 +9,7 @@ using System.Threading.Tasks;
namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http
{
public class HttpResponsePipeWriter : PipeWriter
internal class HttpResponsePipeWriter : PipeWriter
{
private HttpStreamState _state;
private readonly IHttpResponseControl _pipeControl;

View File

@ -9,7 +9,7 @@ using Microsoft.Extensions.Primitives;
namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http
{
public partial class HttpResponseTrailers : HttpHeaders
internal partial class HttpResponseTrailers : HttpHeaders
{
public Enumerator GetEnumerator()
{

View File

@ -3,7 +3,7 @@
namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http
{
public enum HttpScheme
internal enum HttpScheme
{
Unknown = -1,
Http = 0,

View File

@ -3,7 +3,7 @@
namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http
{
enum HttpStreamState
internal enum HttpStreamState
{
Open,
Closed,

View File

@ -3,7 +3,7 @@
namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http
{
public enum HttpVersion
internal enum HttpVersion
{
Unknown = -1,
Http10 = 0,

View File

@ -5,7 +5,7 @@ using System;
namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http
{
public interface IHttpHeadersHandler
internal interface IHttpHeadersHandler
{
void OnHeader(Span<byte> name, Span<byte> value);
}

View File

@ -5,7 +5,7 @@ using Microsoft.AspNetCore.Connections;
namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http
{
public interface IHttpOutputAborter
internal interface IHttpOutputAborter
{
void Abort(ConnectionAbortedException abortReason);
}

View File

@ -8,7 +8,7 @@ using System.Threading.Tasks;
namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http
{
public interface IHttpOutputProducer
internal interface IHttpOutputProducer
{
ValueTask<FlushResult> WriteChunkAsync(ReadOnlySpan<byte> data, CancellationToken cancellationToken);
ValueTask<FlushResult> FlushAsync(CancellationToken cancellationToken);

View File

@ -6,7 +6,7 @@ using System.Buffers;
namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http
{
public interface IHttpParser<TRequestHandler> where TRequestHandler : IHttpHeadersHandler, IHttpRequestLineHandler
internal interface IHttpParser<TRequestHandler> where TRequestHandler : IHttpHeadersHandler, IHttpRequestLineHandler
{
bool ParseRequestLine(TRequestHandler handler, in ReadOnlySequence<byte> buffer, out SequencePosition consumed, out SequencePosition examined);

View File

@ -5,8 +5,8 @@ using System;
namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http
{
public interface IHttpRequestLineHandler
internal interface IHttpRequestLineHandler
{
void OnStartLine(HttpMethod method, HttpVersion version, Span<byte> target, Span<byte> path, Span<byte> query, Span<byte> customMethod, bool pathEncoded);
}
}
}

View File

@ -8,7 +8,7 @@ using System.Threading.Tasks;
namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http
{
public interface IHttpResponseControl
internal interface IHttpResponseControl
{
void ProduceContinue();
Memory<byte> GetMemory(int sizeHint = 0);

View File

@ -10,7 +10,7 @@ using System.Threading.Tasks;
namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http
{
public interface IHttpResponsePipeWriterControl
internal interface IHttpResponsePipeWriterControl
{
void ProduceContinue();
Memory<byte> GetMemory(int sizeHint = 0);

View File

@ -9,7 +9,7 @@ using Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Infrastructure;
namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http
{
public abstract class MessageBody
internal abstract class MessageBody
{
private static readonly MessageBody _zeroContentLengthClose = new ZeroContentLengthMessageBody(keepAlive: false);
private static readonly MessageBody _zeroContentLengthKeepAlive = new ZeroContentLengthMessageBody(keepAlive: true);

View File

@ -9,7 +9,7 @@ using Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Infrastructure;
namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http
{
public static class PathNormalizer
internal static class PathNormalizer
{
private const byte ByteSlash = (byte)'/';
private const byte ByteDot = (byte)'.';

View File

@ -9,7 +9,7 @@ using System.Runtime.InteropServices;
namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http
{
public static class PipelineExtensions
internal static class PipelineExtensions
{
private const int _maxULongByteLength = 20;

View File

@ -3,7 +3,7 @@
namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http
{
public enum ProduceEndType
internal enum ProduceEndType
{
SocketShutdown,
SocketDisconnect,

View File

@ -8,7 +8,7 @@ using Microsoft.AspNetCore.Http;
namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http
{
public static class ReasonPhrases
internal static class ReasonPhrases
{
private static readonly byte[] _bytesStatus100 = CreateStatusBytes(StatusCodes.Status100Continue);
private static readonly byte[] _bytesStatus101 = CreateStatusBytes(StatusCodes.Status101SwitchingProtocols);

View File

@ -3,7 +3,7 @@
namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http
{
public enum RequestProcessingStatus
internal enum RequestProcessingStatus
{
RequestPending,
ParsingRequestLine,

View File

@ -3,7 +3,7 @@
namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http
{
public enum RequestRejectionReason
internal enum RequestRejectionReason
{
UnrecognizedHTTPVersion,
InvalidRequestLine,

View File

@ -6,7 +6,7 @@ using System;
namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http
{
[Flags]
public enum TransferCoding
internal enum TransferCoding
{
None,
Chunked,

View File

@ -8,7 +8,7 @@ using System.Threading.Tasks;
namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http
{
public class ZeroContentLengthMessageBody : MessageBody
internal class ZeroContentLengthMessageBody : MessageBody
{
public ZeroContentLengthMessageBody(bool keepAlive)
: base(null, null)

View File

@ -1,11 +1,11 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Diagnostics;
namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2.FlowControl
{
public struct FlowControl
internal struct FlowControl
{
public FlowControl(uint initialWindowSize)
{

View File

@ -1,11 +1,11 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Diagnostics;
namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2.FlowControl
{
public class InputFlowControl
internal class InputFlowControl
{
private readonly int _initialWindowSize;
private readonly int _minWindowSizeIncrement;

View File

@ -1,4 +1,4 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Generic;
@ -6,7 +6,7 @@ using System.Diagnostics;
namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2.FlowControl
{
public class OutputFlowControl
internal class OutputFlowControl
{
private FlowControl _flow;
private Queue<OutputFlowControlAwaitable> _awaitableQueue;

View File

@ -1,4 +1,4 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
@ -8,7 +8,7 @@ using System.Threading;
namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2.FlowControl
{
public class OutputFlowControlAwaitable : ICriticalNotifyCompletion
internal class OutputFlowControlAwaitable : ICriticalNotifyCompletion
{
private static readonly Action _callbackCompleted = () => { };

View File

@ -1,11 +1,11 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Diagnostics;
namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2.FlowControl
{
public class StreamInputFlowControl
internal class StreamInputFlowControl
{
private readonly InputFlowControl _connectionLevelFlowControl;
private readonly InputFlowControl _streamLevelFlowControl;

View File

@ -1,4 +1,4 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
@ -7,7 +7,7 @@ using System.Runtime.CompilerServices;
namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2.FlowControl
{
public class StreamOutputFlowControl
internal class StreamOutputFlowControl
{
private readonly OutputFlowControl _connectionLevelFlowControl;
private readonly OutputFlowControl _streamLevelFlowControl;

View File

@ -5,7 +5,7 @@ using System;
namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2.HPack
{
public class DynamicTable
internal class DynamicTable
{
private HeaderField[] _buffer;
private int _maxSize;

View File

@ -7,7 +7,7 @@ using Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http;
namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2.HPack
{
public class HPackDecoder
internal class HPackDecoder
{
private enum State
{

View File

@ -1,11 +1,11 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2.HPack
{
public class HPackDecodingException : Exception
internal class HPackDecodingException : Exception
{
public HPackDecodingException(string message)
: base(message)

View File

@ -6,7 +6,7 @@ using System.Collections.Generic;
namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2.HPack
{
public class HPackEncoder
internal class HPackEncoder
{
private IEnumerator<KeyValuePair<string, string>> _enumerator;

View File

@ -1,11 +1,11 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2.HPack
{
public class HPackEncodingException : Exception
internal class HPackEncodingException : Exception
{
public HPackEncodingException(string message)
: base(message)

View File

@ -5,7 +5,7 @@ using System;
namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2.HPack
{
public readonly struct HeaderField
internal readonly struct HeaderField
{
// http://httpwg.org/specs/rfc7541.html#rfc.section.4.1
public const int RfcOverhead = 32;

View File

@ -5,7 +5,7 @@ using System;
namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2.HPack
{
public class Huffman
internal class Huffman
{
// TODO: this can be constructed from _decodingTable
private static readonly (uint code, int bitLength)[] _encodingTable = new (uint code, int bitLength)[]

View File

@ -1,11 +1,11 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2.HPack
{
public class HuffmanDecodingException : Exception
internal class HuffmanDecodingException : Exception
{
public HuffmanDecodingException(string message)
: base(message)

View File

@ -6,7 +6,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2.HPack
/// <summary>
/// The maximum we will decode is Int32.MaxValue, which is also the maximum request header field size.
/// </summary>
public class IntegerDecoder
internal class IntegerDecoder
{
private int _i;
private int _m;

View File

@ -5,7 +5,7 @@ using System;
namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2.HPack
{
public static class IntegerEncoder
internal static class IntegerEncoder
{
public static bool Encode(int i, int n, Span<byte> buffer, out int length)
{

View File

@ -7,7 +7,7 @@ using Microsoft.Net.Http.Headers;
namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2.HPack
{
public class StaticTable
internal class StaticTable
{
private static readonly StaticTable _instance = new StaticTable();

View File

@ -6,7 +6,7 @@ using System.Text;
namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2.HPack
{
public static class StatusCodes
internal static class StatusCodes
{
private static readonly byte[] _bytesStatus100 = CreateStatusBytes(Microsoft.AspNetCore.Http.StatusCodes.Status100Continue);
private static readonly byte[] _bytesStatus101 = CreateStatusBytes(Microsoft.AspNetCore.Http.StatusCodes.Status101SwitchingProtocols);

View File

@ -26,7 +26,7 @@ using Microsoft.Net.Http.Headers;
namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2
{
public class Http2Connection : IHttp2StreamLifetimeHandler, IHttpHeadersHandler, IRequestProcessor
internal class Http2Connection : IHttp2StreamLifetimeHandler, IHttpHeadersHandler, IRequestProcessor
{
public static byte[] ClientPreface { get; } = Encoding.ASCII.GetBytes("PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n");

View File

@ -5,7 +5,7 @@ using System;
namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2
{
public class Http2ConnectionErrorException : Exception
internal class Http2ConnectionErrorException : Exception
{
public Http2ConnectionErrorException(string message, Http2ErrorCode errorCode)
: base($"HTTP/2 connection error ({errorCode}): {message}")

View File

@ -6,7 +6,7 @@ using System;
namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2
{
[Flags]
public enum Http2ContinuationFrameFlags : byte
internal enum Http2ContinuationFrameFlags : byte
{
NONE = 0x0,
END_HEADERS = 0x4,

View File

@ -6,7 +6,7 @@ using System;
namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2
{
[Flags]
public enum Http2DataFrameFlags : byte
internal enum Http2DataFrameFlags : byte
{
NONE = 0x0,
END_STREAM = 0x1,

View File

@ -4,7 +4,7 @@
namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2
{
public enum Http2ErrorCode : uint
internal enum Http2ErrorCode : uint
{
NO_ERROR = 0x0,
PROTOCOL_ERROR = 0x1,

View File

@ -8,7 +8,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2
| Header Block Fragment (*) ...
+---------------------------------------------------------------+
*/
public partial class Http2Frame
internal partial class Http2Frame
{
public Http2ContinuationFrameFlags ContinuationFlags
{

View File

@ -12,7 +12,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2
| Padding (*) ...
+---------------------------------------------------------------+
*/
public partial class Http2Frame
internal partial class Http2Frame
{
public Http2DataFrameFlags DataFlags
{

View File

@ -12,7 +12,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2
| Additional Debug Data (*) |
+---------------------------------------------------------------+
*/
public partial class Http2Frame
internal partial class Http2Frame
{
public int GoAwayLastStreamId { get; set; }

View File

@ -16,7 +16,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2
| Padding (*) ...
+---------------------------------------------------------------+
*/
public partial class Http2Frame
internal partial class Http2Frame
{
public Http2HeadersFrameFlags HeadersFlags
{

View File

@ -10,7 +10,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2
| |
+---------------------------------------------------------------+
*/
public partial class Http2Frame
internal partial class Http2Frame
{
public Http2PingFrameFlags PingFlags
{

View File

@ -10,7 +10,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2
| Weight (8) |
+-+-------------+
*/
public partial class Http2Frame
internal partial class Http2Frame
{
public int PriorityStreamDependency { get; set; }

View File

@ -8,7 +8,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2
| Error Code (32) |
+---------------------------------------------------------------+
*/
public partial class Http2Frame
internal partial class Http2Frame
{
public Http2ErrorCode RstStreamErrorCode { get; set; }

View File

@ -11,7 +11,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2
| Value (32) |
+---------------------------------------------------------------+
*/
public partial class Http2Frame
internal partial class Http2Frame
{
public Http2SettingsFrameFlags SettingsFlags
{

View File

@ -8,7 +8,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2
|R| Window Size Increment (31) |
+-+-------------------------------------------------------------+
*/
public partial class Http2Frame
internal partial class Http2Frame
{
public int WindowUpdateSizeIncrement { get; set; }

View File

@ -14,7 +14,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2
| Frame Payload (0...) ...
+---------------------------------------------------------------+
*/
public partial class Http2Frame
internal partial class Http2Frame
{
public int PayloadLength { get; set; }

View File

@ -10,7 +10,7 @@ using Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http;
namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2
{
public static class Http2FrameReader
internal static class Http2FrameReader
{
/* https://tools.ietf.org/html/rfc7540#section-4.1
+-----------------------------------------------+

View File

@ -3,7 +3,7 @@
namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2
{
public enum Http2FrameType : byte
internal enum Http2FrameType : byte
{
DATA = 0x0,
HEADERS = 0x1,

View File

@ -18,7 +18,7 @@ using Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Infrastructure;
namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2
{
public class Http2FrameWriter
internal class Http2FrameWriter
{
// Literal Header Field without Indexing - Indexed Name (Index 8 - :status)
private static ReadOnlySpan<byte> _continueBytes => new byte[] { 0x08, 0x03, (byte)'1', (byte)'0', (byte)'0' };

View File

@ -6,7 +6,7 @@ using System;
namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2
{
[Flags]
public enum Http2HeadersFrameFlags : byte
internal enum Http2HeadersFrameFlags : byte
{
NONE = 0x0,
END_STREAM = 0x1,

View File

@ -10,7 +10,7 @@ using Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http;
namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2
{
public class Http2MessageBody : MessageBody
internal class Http2MessageBody : MessageBody
{
private readonly Http2Stream _context;
private ReadResult _readResult;

View File

@ -16,7 +16,7 @@ using Microsoft.AspNetCore.Server.Kestrel.Transport.Abstractions.Internal;
namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2
{
public class Http2OutputProducer : IHttpOutputProducer, IHttpOutputAborter
internal class Http2OutputProducer : IHttpOutputProducer, IHttpOutputAborter
{
private readonly int _streamId;
private readonly Http2FrameWriter _frameWriter;

View File

@ -3,7 +3,7 @@
namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2
{
public readonly struct Http2PeerSetting
internal readonly struct Http2PeerSetting
{
public Http2PeerSetting(Http2SettingsParameter parameter, uint value)
{

View File

@ -5,7 +5,7 @@ using System.Collections.Generic;
namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2
{
public class Http2PeerSettings
internal class Http2PeerSettings
{
// Note these are protocol defaults, not Kestrel defaults.
public const uint DefaultHeaderTableSize = 4096;

View File

@ -6,7 +6,7 @@ using System;
namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2
{
[Flags]
public enum Http2PingFrameFlags : byte
internal enum Http2PingFrameFlags : byte
{
NONE = 0x0,
ACK = 0x1

View File

@ -6,7 +6,7 @@ using System;
namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2
{
[Flags]
public enum Http2SettingsFrameFlags : byte
internal enum Http2SettingsFrameFlags : byte
{
NONE = 0x0,
ACK = 0x1,

View File

@ -3,7 +3,7 @@
namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2
{
public enum Http2SettingsParameter : ushort
internal enum Http2SettingsParameter : ushort
{
SETTINGS_HEADER_TABLE_SIZE = 0x1,
SETTINGS_ENABLE_PUSH = 0x2,

View File

@ -5,7 +5,7 @@ using System;
namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2
{
public class Http2SettingsParameterOutOfRangeException : Exception
internal class Http2SettingsParameterOutOfRangeException : Exception
{
public Http2SettingsParameterOutOfRangeException(Http2SettingsParameter parameter, long lowerBound, long upperBound)
: base($"HTTP/2 SETTINGS parameter {parameter} must be set to a value between {lowerBound} and {upperBound}")

View File

@ -8,7 +8,7 @@ using Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http;
namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2
{
public partial class Http2Stream : IHttp2StreamIdFeature, IHttpResponseTrailersFeature
internal partial class Http2Stream : IHttp2StreamIdFeature, IHttpResponseTrailersFeature
{
internal HttpResponseTrailers Trailers { get; set; }
private IHeaderDictionary _userTrailers;

View File

@ -18,7 +18,7 @@ using Microsoft.Net.Http.Headers;
namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2
{
public abstract partial class Http2Stream : HttpProtocol, IThreadPoolWorkItem
internal abstract partial class Http2Stream : HttpProtocol, IThreadPoolWorkItem
{
private readonly Http2StreamContext _context;
private readonly Http2OutputProducer _http2Output;

View File

@ -5,7 +5,7 @@ using Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2.FlowControl;
namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2
{
public class Http2StreamContext : HttpConnectionContext
internal class Http2StreamContext : HttpConnectionContext
{
public int StreamId { get; set; }
public IHttp2StreamLifetimeHandler StreamLifetimeHandler { get; set; }

Some files were not shown because too many files have changed in this diff Show More