Pubternal IHttpHeadersHandler (#17573)
This commit is contained in:
parent
3b7cdc166a
commit
bd7c89aa20
|
|
@ -214,6 +214,13 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http
|
||||||
Custom = (byte)9,
|
Custom = (byte)9,
|
||||||
None = (byte)255,
|
None = (byte)255,
|
||||||
}
|
}
|
||||||
|
public partial class HttpParser<TRequestHandler> where TRequestHandler : Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.IHttpHeadersHandler, Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.IHttpRequestLineHandler
|
||||||
|
{
|
||||||
|
public HttpParser() { }
|
||||||
|
public HttpParser(bool showErrorDetails) { }
|
||||||
|
public bool ParseHeaders(TRequestHandler handler, ref System.Buffers.SequenceReader<byte> reader) { throw null; }
|
||||||
|
public bool ParseRequestLine(TRequestHandler handler, in System.Buffers.ReadOnlySequence<byte> buffer, out System.SequencePosition consumed, out System.SequencePosition examined) { throw null; }
|
||||||
|
}
|
||||||
public enum HttpScheme
|
public enum HttpScheme
|
||||||
{
|
{
|
||||||
Unknown = -1,
|
Unknown = -1,
|
||||||
|
|
@ -228,6 +235,11 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http
|
||||||
Http2 = 2,
|
Http2 = 2,
|
||||||
Http3 = 3,
|
Http3 = 3,
|
||||||
}
|
}
|
||||||
|
public partial interface IHttpHeadersHandler
|
||||||
|
{
|
||||||
|
void OnHeader(System.ReadOnlySpan<byte> name, System.ReadOnlySpan<byte> value);
|
||||||
|
void OnHeadersComplete(bool endStream);
|
||||||
|
}
|
||||||
public partial interface IHttpRequestLineHandler
|
public partial interface IHttpRequestLineHandler
|
||||||
{
|
{
|
||||||
void OnStartLine(Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpMethod method, Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpVersion version, System.Span<byte> target, System.Span<byte> path, System.Span<byte> query, System.Span<byte> customMethod, bool pathEncoded);
|
void OnStartLine(Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpMethod method, Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpVersion version, System.Span<byte> target, System.Span<byte> path, System.Span<byte> query, System.Span<byte> customMethod, bool pathEncoded);
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ using Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Infrastructure;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http
|
namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http
|
||||||
{
|
{
|
||||||
internal class HttpParser<TRequestHandler> : IHttpParser<TRequestHandler> where TRequestHandler : IHttpHeadersHandler, IHttpRequestLineHandler
|
public class HttpParser<TRequestHandler> : IHttpParser<TRequestHandler> where TRequestHandler : IHttpHeadersHandler, IHttpRequestLineHandler
|
||||||
{
|
{
|
||||||
private readonly bool _showErrorDetails;
|
private readonly bool _showErrorDetails;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,8 @@
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Buffers;
|
using System.Buffers;
|
||||||
using System.Net.Http;
|
|
||||||
using System.Net.Http.HPack;
|
using System.Net.Http.HPack;
|
||||||
|
using Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http3.QPack
|
namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http3.QPack
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@
|
||||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
<NoWarn>CS1591;$(NoWarn)</NoWarn>
|
<NoWarn>CS1591;$(NoWarn)</NoWarn>
|
||||||
<IsShippingPackage>false</IsShippingPackage>
|
<IsShippingPackage>false</IsShippingPackage>
|
||||||
|
<DefineConstants>$(DefineConstants);KESTREL</DefineConstants>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@
|
||||||
<TargetFramework>$(DefaultNetCoreTargetFramework)</TargetFramework>
|
<TargetFramework>$(DefaultNetCoreTargetFramework)</TargetFramework>
|
||||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
<TestGroupName>Kestrel.Core.Tests</TestGroupName>
|
<TestGroupName>Kestrel.Core.Tests</TestGroupName>
|
||||||
|
<DefineConstants>$(DefineConstants);KESTREL</DefineConstants>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,9 @@
|
||||||
|
|
||||||
using System.Buffers;
|
using System.Buffers;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
#if KESTREL
|
||||||
|
using Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http;
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace System.Net.Http.HPack
|
namespace System.Net.Http.HPack
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -2,11 +2,22 @@
|
||||||
// The .NET Foundation licenses this file to you under the MIT license.
|
// The .NET Foundation licenses this file to you under the MIT license.
|
||||||
// See the LICENSE file in the project root for more information.
|
// See the LICENSE file in the project root for more information.
|
||||||
|
|
||||||
|
#if KESTREL
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http
|
||||||
|
#else
|
||||||
namespace System.Net.Http
|
namespace System.Net.Http
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
internal interface IHttpHeadersHandler
|
#if KESTREL
|
||||||
|
public
|
||||||
|
#else
|
||||||
|
internal
|
||||||
|
#endif
|
||||||
|
interface IHttpHeadersHandler
|
||||||
{
|
{
|
||||||
void OnHeader(ReadOnlySpan<byte> name, ReadOnlySpan<byte> value);
|
void OnHeader(ReadOnlySpan<byte> name, ReadOnlySpan<byte> value);
|
||||||
void OnHeadersComplete(bool endStream);
|
void OnHeadersComplete(bool endStream);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,9 @@ using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Net.Http.HPack;
|
using System.Net.Http.HPack;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
#if KESTREL
|
||||||
|
using Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http;
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace System.Net.Http.Unit.Tests.HPack
|
namespace System.Net.Http.Unit.Tests.HPack
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue