Class
Parser

The Parser class exposes static methods used to parse strings or byte arrays into HTTP messages.

Definition

Namespace:Fiddler

Assembly:FiddlerCore.dll

Syntax:

cs-api-definition
public class Parser

Inheritance: objectParser

Inherited Members object.GetType()object.MemberwiseClone()object.ToString()object.Equals(object)object.Equals(object, object)object.ReferenceEquals(object, object)object.GetHashCode()

Constructors

Parser()

Declaration

cs-api-definition
public Parser()

Methods

FindEntityBodyOffsetFromArray(byte[], out int, out int, out HTTPHeaderParseWarnings)

Given a byte array, determines the Headers length

Declaration

cs-api-definition
public static bool FindEntityBodyOffsetFromArray(byte[] arrData, out int iHeadersLen, out int iEntityBodyOffset, out HTTPHeaderParseWarnings outWarnings)

Parameters

arrData

byte[]

Input array of data

iHeadersLen

int

Returns the calculated length of the headers.

iEntityBodyOffset

int

Returns the calculated start of the response body.

outWarnings

HTTPHeaderParseWarnings

Any HTTPHeaderParseWarnings discovered during parsing.

Returns

bool

True, if the parsing was successful.

ParseRequest(string, bool)

Parse the HTTP Request into a headers object.

Declaration

cs-api-definition
public static HTTPRequestHeaders ParseRequest(string sRequest, bool skipHost = false)

Parameters

sRequest

string

The HTTP Request string, including at least the headers with a trailing CRLFCRLF

skipHost

bool

Whether to append Host header info or not

Returns

HTTPRequestHeaders

HTTPRequestHeaders parsed from the string.

ParseResponse(string)

Parse the HTTP Response into a headers object.

Declaration

cs-api-definition
public static HTTPResponseHeaders ParseResponse(string sResponse)

Parameters

sResponse

string

The HTTP response as a string, including at least the headers.

Returns

HTTPResponseHeaders

HTTPResponseHeaders parsed from the string.

TakeRequest(MemoryStream, out HTTPRequestHeaders, out byte[])

Given a MemoryStream, attempts to parse a HTTP Request starting at the current position.

Declaration

cs-api-definition
public static bool TakeRequest(MemoryStream strmClient, out HTTPRequestHeaders headersRequest, out byte[] arrRequestBody)

Parameters

strmClient

MemoryStream

headersRequest

HTTPRequestHeaders

arrRequestBody

byte[]

Returns

bool

TRUE if a request could be parsed, FALSE otherwise

TakeResponse(MemoryStream, string, out HTTPResponseHeaders, out byte[])

Given a MemoryStream, attempts to parse a HTTP Response starting at the current position

Declaration

cs-api-definition
public static bool TakeResponse(MemoryStream strmServer, string sRequestMethod, out HTTPResponseHeaders headersResponse, out byte[] arrResponseBody)

Parameters

strmServer

MemoryStream

sRequestMethod

string

headersResponse

HTTPResponseHeaders

arrResponseBody

byte[]

Returns

bool

TRUE if a response could be parsed, FALSE otherwise