.NET Core now has the efficient Span<T> and related types that allow more efficient memory operations. Also, there are some basic parsing primitives for dealing with Span<Byte> without having to decode UTF-8.
Kestrel can process requests without using string I reckon.
The user of ASP.NET Core, however, gets the request header (request path and HTTP headers) only as strings.
Is there a way to get that as Span<Byte> also? I have a very low-level application where ideally I would want certain requests make no memory allocations. I'm also just curious.
Not at this level, the abstraction for headers is a IHeaderDictionary. Those are parsed before your code runs and we give you a StringValues. There's been various discussions around exposing it as byte[]/Span<byte> but nothing has come of this as yet.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With