HttpTransportHeaderParser Class

System.Net.Http.Headers

Provides methods for parsing HTTP transport headers. This class is intended for internal use and is not meant to be used directly by your code.

Summary

The HttpTransportHeaderParser class is a low-level component within the .NET HTTP stack responsible for dissecting and interpreting the headers that define the transport layer of an HTTP message. It handles the complexities of parsing various header fields, ensuring that the data is correctly extracted and made available for further processing by higher-level components of the HTTP client or server.

Members

Constructors

Name Description
HttpTransportHeaderParser() Initializes a new instance of the HttpTransportHeaderParser class. This constructor is intended for internal use.

Methods

Name Description
ParseConnection(String, ref Int32) Parses the Connection header.
ParseKeepAlive(String, ref Int32) Parses the Keep-Alive header.
ParseTransferEncoding(String, ref Int32) Parses the Transfer-Encoding header.
ParseTrailer(String, ref Int32) Parses the Trailer header.
ParseContentEncoding(String, ref Int32) Parses the Content-Encoding header.
ParseVia(String, ref Int32) Parses the Via header.
ParseTE(String, ref Int32) Parses the TE header.
Remarks

The HttpTransportHeaderParser is part of the internal implementation of the .NET HttpClient and related classes. Its methods are designed to be called by other internal .NET components during the process of sending and receiving HTTP requests and responses. Developers typically do not need to interact with this class directly. For standard HTTP header manipulation, use classes like HttpHeaders and specific header-value types provided by the System.Net.Http.Headers namespace.

Example Usage (Internal)

This example illustrates how an internal component might use HttpTransportHeaderParser. It is for informational purposes only and not intended for direct application code.


// This code is for illustration of internal usage only.
// Do not use directly in your application.

/*
using System.Net.Http.Headers;

// Assume 'headers' is a collection of HTTP headers
string headerValue = "chunked";
int startIndex = 0;
try
{
    // Internal component might parse Transfer-Encoding
    var transferEncoding = HttpTransportHeaderParser.ParseTransferEncoding(headerValue, ref startIndex);
    // ... process transferEncoding ...
}
catch (FormatException ex)
{
    // Handle parsing error
    Console.WriteLine($"Failed to parse header: {ex.Message}");
}
*/