Class HeaderParser
Parses MIME headers from a stream. Handles RFC 5322 §2.2.3 header folding (unfolding) and splits headers into name/value pairs with optional parameters.
Inherited Members
Namespace: DRIT.Mail.Rfc.Mime.Parsing
Assembly: DRIT.Mail.dll
Syntax
public static class HeaderParser
Methods
View SourceParse(LineReader)
Reads all headers from a LineReader positioned at the start of the header section. Stops at the first blank line (the header/body separator). The reader is left positioned just past the blank line.
Declaration
public static MimeHeaderCollection Parse(LineReader reader)
Parameters
| Type | Name | Description |
|---|---|---|
| LineReader | reader | Specifies the reader value. |
Returns
| Type | Description |
|---|---|
| MimeHeaderCollection |
ParseHeader(string, string)
Parses a single header line (already unfolded) into a MimeHeader.
Declaration
public static MimeHeader ParseHeader(string name, string rawValue)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | Specifies the name value. |
| string | rawValue | The raw value used by the operation. |
Returns
| Type | Description |
|---|---|
| MimeHeader |
ReadHeaderBlock(Stream)
Reads all header bytes from a stream until the blank line separator. Returns the headers as a single unfolded string block. Used when raw access to the header section is needed.
Declaration
public static string ReadHeaderBlock(Stream stream)
Parameters
| Type | Name | Description |
|---|---|---|
| Stream | stream | The stream used to read or write the data. |
Returns
| Type | Description |
|---|---|
| string |