Class
Utilities

Holds a variety of useful functions used in Fiddler and its addons.

Definition

Namespace:Fiddler

Assembly:FiddlerCore.dll

Syntax:

cs-api-definition
public static class Utilities

Inheritance: objectUtilities

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

Fields

Http2MagicHeader

Magic string that must be sent first by the client when establishing a HTTP2 connection.

Declaration

cs-api-definition
public static readonly byte[] Http2MagicHeader

Field Value

byte[]

SupportedTLS1_3_Ciphers_Client

A list of supported TLS 1.3 ciphers for BouncyCastle Client(macOS only)

Declaration

cs-api-definition
public static int[] SupportedTLS1_3_Ciphers_Client

Field Value

int[]

A list of all TLS 1.3 ciphers that should be offered during handshake

SupportedTLS1_3_Ciphers_Server

A list of supported TLS 1.3 ciphers for BouncyCastle Server(macOS only)

Declaration

cs-api-definition
public static int[] SupportedTLS1_3_Ciphers_Server

Field Value

int[]

A list of all TLS 1.3 ciphers that should be offered during handshake

emptyByteArray

A static byte array containing 0 elements. Use to avoid having many copies of an empty byte[] floating around.

Declaration

cs-api-definition
public static readonly byte[] emptyByteArray

Field Value

byte[]

sCommonRequestHeaders

Declaration

cs-api-definition
public const string sCommonRequestHeaders = "Cache-Control,If-None-Match,If-Modified-Since,Pragma,If-Unmodified-Since,If-Range,If-Match,Content-Length,Content-Type,Referer,Origin,SOAPAction,Expect,Content-Encoding,TE,Transfer-Encoding,Proxy-Connection,Connection,Accept,Accept-Charset,Accept-Encoding,Accept-Language,User-Agent,UA-Color,UA-CPU,UA-OS,UA-Pixels,Cookie,Cookie2,DNT,Authorization,Proxy-Authorization,X-Requested-With,X-Download-Initiator"

Field Value

string

sCommonResponseHeaders

Declaration

cs-api-definition
public const string sCommonResponseHeaders = "Age,Cache-Control,Date,Expires,Pragma,Vary,Content-Length,ETag,Last-Modified,Content-Type,Content-Disposition,Content-Encoding,Transfer-encoding,Via,Keep-Alive,Location,Proxy-Connection,Connection,Set-Cookie,WWW-Authenticate,Proxy-Authenticate,P3P,X-UA-Compatible,X-Frame-options,X-Content-Type-Options,X-XSS-Protection,Strict-Transport-Security,Content-Security-Policy,Access-Control-Allow-Origin,Cross-Origin-Resource-Policy,Cross-Origin-Opener-Policy,Cross-Origin-Embedder-Policy,Cross-Origin-Embedder-Policy-Report-Only,Cross-Origin-Opener-Policy-Report-Only"

Field Value

string

Properties

ThisAssemblyVersion

Declaration

cs-api-definition
public static Version ThisAssemblyVersion { get; }

Property Value

Version

Methods

BrotliCompress(byte[], out long)

Compresses a byte array using Brotli

Declaration

cs-api-definition
public static byte[] BrotliCompress(byte[] input, out long elapsedMilliseconds)

Parameters

input

byte[]

Byte array containing data to compress

elapsedMilliseconds

long

Outputs the amount of milliseconds it took to compress the data

Returns

byte[]

Byte array compressed with Brotli algorithm

BrotliExpand(byte[])

Decompresses a byte array using Brotli

Declaration

cs-api-definition
public static byte[] BrotliExpand(byte[] input)

Parameters

input

byte[]

Byte array compressed with Brotli algorithm

Returns

byte[]

Byte array containing decompressed data

ByteArrayToHexView(byte[], int)

Pretty-print a Hex view of a byte array. Slow.

Declaration

cs-api-definition
[CodeDescription("Returns a string representing a Hex view of a byte array. Slow.")]
public static string ByteArrayToHexView(byte[] inArr, int iBytesPerLine)

Parameters

inArr

byte[]

The byte array

iBytesPerLine

int

Number of bytes per line

Returns

string

String containing a pretty-printed array

ByteArrayToHexView(byte[], int, int)

Pretty-print a Hex view of a byte array. Slow.

Declaration

cs-api-definition
[CodeDescription("Returns a string representing a Hex view of a byte array. PERF: Slow.")]
public static string ByteArrayToHexView(byte[] inArr, int iBytesPerLine, int iMaxByteCount)

Parameters

inArr

byte[]

The byte array

iBytesPerLine

int

Number of bytes per line

iMaxByteCount

int

The maximum number of bytes to pretty-print

Returns

string

String containing a pretty-printed array

ByteArrayToHexView(byte[], int, int, bool)

Pretty-print a Hex view of a byte array. Slow.

Declaration

cs-api-definition
[CodeDescription("Returns a string representing a Hex view of a byte array. PERF: Slow.")]
public static string ByteArrayToHexView(byte[] inArr, int iBytesPerLine, int iMaxByteCount, bool bShowASCII)

Parameters

inArr

byte[]

The byte array

iBytesPerLine

int

Number of bytes per line

iMaxByteCount

int

The maximum number of bytes to pretty-print

bShowASCII

bool

Show ASCII text at the end of each line

Returns

string

String containing a pretty-printed array

ByteArrayToHexView(byte[], int, int, int, bool)

Declaration

cs-api-definition
[CodeDescription("Returns a string representing a Hex view of a byte array. PERF: Slow.")]
public static string ByteArrayToHexView(byte[] inArr, int iStartAt, int iBytesPerLine, int iMaxByteCount, bool bShowASCII)

Parameters

inArr

byte[]

iStartAt

int

iBytesPerLine

int

iMaxByteCount

int

bShowASCII

bool

Returns

string

ByteArrayToString(byte[])

Print an byte array to a hex string. Slow.

Declaration

cs-api-definition
[CodeDescription("Returns a string representing a Hex stream of a byte array. Slow.")]
public static string ByteArrayToString(byte[] inArr)

Parameters

inArr

byte[]

Byte array

Returns

string

String of hex bytes, or "null"/"empty" if no bytes provided

ByteArrayToStringExt(byte[])

Print an byte array to a hex string without separation. 2-3 times faster than BitConverter.ToString

Declaration

cs-api-definition
[CodeDescription("Returns a string representing a Hex stream of a byte array. A bit faster.")]
public static string ByteArrayToStringExt(byte[] bytes)

Parameters

bytes

byte[]

Byte array

Returns

string

String of hex bytes, or "null"/"empty" if no bytes provided

CompareVersions(string, Version)

Typically, a version number is displayed as "major number.minor number.build number.private part number".

Declaration

cs-api-definition
public static int CompareVersions(string sRequiredVersion, Version verTest)

Parameters

sRequiredVersion

string

Version required

verTest

Version

Version of the binary being tested

Returns

int

Returns 0 if exact match, else greater than 0 if Required version greater than verTest

ContentTypeForFilename(string)

Return the content type of a target file, or application/octet-stream if unknown.

Declaration

cs-api-definition
public static string ContentTypeForFilename(string sFilename)

Parameters

sFilename

string

A filename, including the extension

Returns

string

CrackHostAndPort(string, out string, ref int)

This function cracks the Hostname/Port combo, removing IPV6 brackets if needed

Declaration

cs-api-definition
[CodeDescription("This function cracks the Host/Port combo, removing IPV6 brackets if needed.")]
public static void CrackHostAndPort(string sHostPort, out string sHostname, ref int iPort)

Parameters

sHostPort

string

Hostname/port combo, like www.foo.com or www.example.com:8888 or [::1]:80

sHostname

string

The hostname, minus any IPv6 literal brackets, if present

iPort

int

Port #, 80 if not specified, -1 if corrupt

DeflaterCompress(byte[])

Compress a byte array using RFC1951 DEFLATE

Declaration

cs-api-definition
[CodeDescription("Returns a byte[] containing a DEFLATE'd copy of writeData[]")]
public static byte[] DeflaterCompress(byte[] writeData)

Parameters

writeData

byte[]

Array to compress

Returns

byte[]

byte[] containing a DEFLATE'd copy of writeData[]

DeflaterCompress(byte[], CancellationToken)

Compress a byte array using RFC1951 DEFLATE

Declaration

cs-api-definition
public static Task<byte[]> DeflaterCompress(byte[] writeData, CancellationToken ct)

Parameters

writeData

byte[]

Array to compress

ct

CancellationToken

CancellationToken used to halt a long running task

Returns

Task<byte[]>

byte[] containing a DEFLATE'd copy of writeData[]

DeflaterExpand(byte[])

Decompress a byte array that was compressed using RFC1951 DEFLATE

Declaration

cs-api-definition
[CodeDescription("Returns a byte[] representing the INFLATE'd representation of compressedData[]")]
public static byte[] DeflaterExpand(byte[] compressedData)

Parameters

compressedData

byte[]

Array to decompress

Returns

byte[]

byte[] of decompressed data

DeflaterExpand(byte[], bool)

Declaration

cs-api-definition
public static byte[] DeflaterExpand(byte[] compressedData, bool bThrowErrors)

Parameters

compressedData

byte[]

bThrowErrors

bool

Returns

byte[]

DeflaterExpandInternal(byte[])

UnDeflate function which shows no UI and will throw on error

Declaration

cs-api-definition
public static byte[] DeflaterExpandInternal(byte[] compressedData)

Parameters

compressedData

byte[]

byte[] to decompress

Returns

byte[]

A decompressed byte array, or byte[0]. Throws on errors.

Dupe(byte[])

Duplicate a byte array, replacing null with byte[0]. Doing this instead of .Clone() because it better handles nulls and it may be faster.

Declaration

cs-api-definition
public static byte[] Dupe(byte[] bIn)

Parameters

bIn

byte[]

The array to copy

Returns

byte[]

The new array.

EllipsizeIfNeeded(string, int)

Ensures that the target string is iMaxLength or fewer characters, appending ... if truncation occurred

Declaration

cs-api-definition
public static string EllipsizeIfNeeded(string sString, int iMaxLength)

Parameters

sString

string

The string to trim from

iMaxLength

int

The maximum number of characters to return

Returns

string

The string, or up to iMaxLength-1 characters from the "Head" of the string, with \u2026 appeneded.

EnsureInRange<T>(T, T, T)

Ensures a value is within a specified range.

Declaration

cs-api-definition
public static T EnsureInRange<T>(T current, T min, T max)

Parameters

current

T

Current value

min

T

Min value

max

T

Max value

Returns

T

Returns the provided value, unless it is outside of the specified range, in which case the nearest "fencepost" is returned.

EnsureOverwritable(string)

Ensure that the target path exists and if a file exists there, it is not readonly or hidden. WARNING: Can throw if target "Filename" calls for a parent directoryname that is already used as a filename by a non-directory. E.g. EnsureOverwriteable(C:\io.sys\filename.txt); would throw.

Declaration

cs-api-definition
public static void EnsureOverwritable(string sFilename)

Parameters

sFilename

string

The candidate filename

EnsurePathIsAbsolute(string, string)

Ensure that a given path is absolute, if not, applying the root path. WARNING: This function only works as well as Path.IsPathRooted, which returns "True" for things like "/NoDriveSpecified/fuzzle.txt" A better approach would be to look at the internal Path.IsRelative method

Declaration

cs-api-definition
public static string EnsurePathIsAbsolute(string sRootPath, string sFilename)

Parameters

sRootPath

string

sFilename

string

Returns

string

EnsureUniqueFilename(string)

Ensure that the target file does not yet exist. If it does, generates a new filename with an embedded identifier, e.g. out[1].txt instead. Attempts to ensure filename is creatable; e.g. if a path component needs to be a directory but is a file already, injects [#] into that path component.

Declaration

cs-api-definition
public static string EnsureUniqueFilename(string sFilename)

Parameters

sFilename

string

Candidate filename

Returns

string

New filename which does not yet exist

EnsureValidAsPath(string)

Address the problem where the target "PATH" calls for a directoryname is already a filename

Declaration

cs-api-definition
public static string EnsureValidAsPath(string sTargetFolder)

Parameters

sTargetFolder

string

Returns

string

FileExtensionForMIMEType(string)

Maps a MIMEType to a file extension. Pass only the TYPE (e.g. use oResponse.MIMEType), to ensure no charset info in the string.

Declaration

cs-api-definition
public static string FileExtensionForMIMEType(string mime)

Parameters

mime

string

The MIME Type

Returns

string

A file extension for the type, or .TXT

FormatSslVersion(string)

Format the value of a SslProtocol - e.g. 'Tls11' becomes 'TLS 1.1'

Declaration

cs-api-definition
public static string FormatSslVersion(string sslVersion)

Parameters

sslVersion

string

String value of the SslProtocol

Returns

string

Formatted SslProtocol value

GetCommaTokenValue(string, string)

Returns the Value from a (case-insensitive) token in the header string. Correctly handles double-quoted strings. Allows comma and semicolon as delimiter. Trailing whitespace may be present.

Declaration

cs-api-definition
public static string GetCommaTokenValue(string sString, string sTokenName)

Parameters

sString

string

Name of the header

sTokenName

string

Name of the token

Returns

string

Value of the token if present; otherwise, null

GetCustomCertErrorPageTemplate(string, string, string)

Get the template shown when trying to open a URL with an invalid TLS certificate

Declaration

cs-api-definition
public static string GetCustomCertErrorPageTemplate(string host, string certError, string url)

Parameters

host

string

The host which fails the certificate check

certError

string

The certificate error

url

string

The url which the browser was trying to load

Returns

string

A string containing the HTML file content

GetEchoServicePageTemplate(Session)

Get the template shown for the Fiddler echo service (http://[fiddlerhost]:[fiddlerport]/)

Declaration

cs-api-definition
public static string GetEchoServicePageTemplate(Session oS)

Parameters

oS

Session

Session to use for host header if DNS hostname fails

Returns

string

A string containing the HTML file content

GetExecutableOutput(string, string, out int)

Run an executable, wait for it to exit, and return its output as a string. NOTE: Uses CreateProcess, so you cannot launch applications which require Elevation.

Declaration

cs-api-definition
[CodeDescription("Run an executable, wait for it to exit, and return its output as a string.")]
public static string GetExecutableOutput(string sExecute, string sParams, out int iExitCode)

Parameters

sExecute

string

Fully-qualified filename of file to Execute

sParams

string

Command-line parameters to pass

iExitCode

int

Exit code returned by the executable

Returns

string

String containing the standard-output of the executable

GetHostName(Session)

Return the DNS hostname of the machine. If that is not available, return the host header of the session.

Declaration

cs-api-definition
public static string GetHostName(Session oS)

Parameters

oS

Session

Session to use for host header if DNS hostname fails

Returns

string

the retrieved hostname

GetInstrumentedBrowserInitialPageTemplate(Session)

Get the template shown when starting a new instrumented browser (https://this.is.fiddler/)

Declaration

cs-api-definition
public static string GetInstrumentedBrowserInitialPageTemplate(Session _)

Parameters

_

Session

Session to use for host header if DNS hostname fails

Returns

string

A string containing the HTML file content

GetRegistryBool(RegistryKey, string, bool)

Get a bool from the registry

Declaration

cs-api-definition
[CodeDescription("Returns an bool from the registry, or bDefault if the registry key is missing or cannot be used as an bool.")]
public static bool GetRegistryBool(RegistryKey oReg, string sName, bool bDefault)

Parameters

oReg

RegistryKey

The RegistryKey

sName

string

The Value name

bDefault

bool

The default value

Returns

bool

Returns an bool from the registry, or bDefault if the registry key is missing or cannot be used as an bool.

GetRegistryFloat(RegistryKey, string, float)

Returns an Float from the registry, or a default.

Declaration

cs-api-definition
[CodeDescription("Returns an float from the registry, or flDefault if the registry key is missing or cannot be used as an float.")]
public static float GetRegistryFloat(RegistryKey oReg, string sName, float flDefault)

Parameters

oReg

RegistryKey

Registry key in which to find the value.

sName

string

The value name.

flDefault

float

The default float value if the registry key is missing or cannot be used as a float.

Returns

float

Float representing the value, or the default.

GetRegistryInt(RegistryKey, string, int)

Returns an integer from the registry, or a default.

Declaration

cs-api-definition
[CodeDescription("Returns an integer from the registry, or iDefault if the registry key is missing or cannot be used as an integer.")]
public static int GetRegistryInt(RegistryKey oReg, string sName, int iDefault)

Parameters

oReg

RegistryKey

The Registry key in which to find the value.

sName

string

The registry value name.

iDefault

int

Default to return if the registry key is missing or cannot be used as an integer

Returns

int

The retrieved integer, or the default.

GetRemoteDeviceConnectivityPageTemplate(Session)

Get the template shown on remote devices at the end of the remote device setup wizard (https://fiddler.device/)

Declaration

cs-api-definition
public static string GetRemoteDeviceConnectivityPageTemplate(Session oS)

Parameters

oS

Session

Session to use for host header if DNS hostname fails

Returns

string

A string containing the HTML file content

GetRequestHeaders(Session)

Get the Request headers as key-value pairs, including the pseudo headers.

Declaration

cs-api-definition
public static KeyValuePair<string, string>[] GetRequestHeaders(Session oSession)

Parameters

oSession

Session

The session

Returns

KeyValuePair<string, string>[]

The Request headers, including the pseudo headers.

GetResponseHeaders(Session)

Get the Response headers as key-value pairs

Declaration

cs-api-definition
public static KeyValuePair<string, string>[] GetResponseHeaders(Session oSession)

Parameters

oSession

Session

The session

Returns

KeyValuePair<string, string>[]

The Response headers

GetStringFromArrayRemovingBOM(byte[], Encoding)

Gets a string from a byte-array, stripping a Byte Order Marker preamble if present.

Declaration

cs-api-definition
[CodeDescription("Gets a string from a byte-array, stripping a BOM if present.")]
public static string GetStringFromArrayRemovingBOM(byte[] arrInput, Encoding oDefaultEncoding)

Parameters

arrInput

byte[]

The byte array

oDefaultEncoding

Encoding

The encoding to convert from if there's no Byte-order-marker

Returns

string

The string

Remarks

This function really shouldn't need to exist. Why doesn't calling .GetString on a string with a preamble remove the preamble???

GetTextEncoding(string)

WARNING: May throw. Gets an encoding, with proper respect for "utf8" as an alias for "utf-8"; Microsoft products don't support this prior to 2015-era, but it turns out to be common. We do have a linter elsewhere that reports a warning if it sees the dashless form. https://github.com/telerik/fiddler/issues/38

Declaration

cs-api-definition
public static Encoding GetTextEncoding(string sEncoding)

Parameters

sEncoding

string

Textual name of the encoding

Returns

Encoding

GetTickCount()

Get a TickCount (milliseconds since system start) as an unsigned 64bit value. On Windows Vista+, uses the GetTickCount64 API that won't rollover, but on any other platform, this unsigned wrapper moves the rollover point to 49 days of uptime.

Declaration

cs-api-definition
public static ulong GetTickCount()

Returns

ulong

Number of ms since the system started

GzipCompress(byte[])

GZIPs a byte-array

Declaration

cs-api-definition
[CodeDescription("Returns a byte[] containing a gzip-compressed copy of writeData[]")]
public static byte[] GzipCompress(byte[] writeData)

Parameters

writeData

byte[]

Input byte array

Returns

byte[]

byte[] containing a gzip-compressed copy of writeData[]

GzipExpand(byte[])

Expands a GZIP-compressed byte array

Declaration

cs-api-definition
[CodeDescription("Returns a byte[] containing an un-gzipped copy of compressedData[]")]
public static byte[] GzipExpand(byte[] compressedData)

Parameters

compressedData

byte[]

The array to decompress

Returns

byte[]

byte[] containing an un-gzipped copy of compressedData[]

GzipExpand(byte[], bool)

Declaration

cs-api-definition
public static byte[] GzipExpand(byte[] compressedData, bool bThrowErrors)

Parameters

compressedData

byte[]

bThrowErrors

bool

Returns

byte[]

GzipExpandInternal(byte[])

GZIP-Expand function which shows no UI and will throw on error

Declaration

cs-api-definition
public static byte[] GzipExpandInternal(byte[] compressedData)

Parameters

compressedData

byte[]

byte[] to decompress

Returns

byte[]

A decompressed byte array, or byte[0]. Throws on errors.

HTTPMethodAllowsBody(string)

Returns true if a request with the specified HTTP Method/Verb may contain a entity body

Declaration

cs-api-definition
[CodeDescription("Returns TRUE if the HTTP Method MAY have a body.")]
public static bool HTTPMethodAllowsBody(string sMethod)

Parameters

sMethod

string

The Method/Verb

Returns

bool

TRUE if the HTTP Method MAY contain a request body.

HTTPMethodIsIdempotent(string)

Declaration

cs-api-definition
public static bool HTTPMethodIsIdempotent(string sMethod)

Parameters

sMethod

string

HTTPMethod

Returns

bool

TRUE if the method is deemed idempotent

HTTPMethodRequiresBody(string)

Determines true if a request with the specified HTTP Method/Verb MUST contain a entity body

Declaration

cs-api-definition
[CodeDescription("Returns TRUE if the HTTP Method MUST have a body.")]
public static bool HTTPMethodRequiresBody(string sMethod)

Parameters

sMethod

string

The Method/Verb

Returns

bool

TRUE if the HTTP Method MUST contain a request body.

HTTPStatusAllowsBody(int)

Declaration

cs-api-definition
[CodeDescription("Returns TRUE if a response body is allowed for this responseCode.")]
public static bool HTTPStatusAllowsBody(int iResponseCode)

Parameters

iResponseCode

int

Returns

bool

HasMagicBytes(byte[], byte[])

Determines whether the arrData array STARTS WITH with the supplied arrMagics bytes. Used for Content-Type sniffing.

Declaration

cs-api-definition
public static bool HasMagicBytes(byte[] arrData, byte[] arrMagics)

Parameters

arrData

byte[]

The data, or null

arrMagics

byte[]

The MagicBytes to look for

Returns

bool

TRUE if arrData begins with arrMagics

HasMagicBytes(byte[], int, byte[])

Declaration

cs-api-definition
public static bool HasMagicBytes(byte[] arrData, int iXOffset, byte[] arrMagics)

Parameters

arrData

byte[]

iXOffset

int

arrMagics

byte[]

Returns

bool

HasMagicBytes(byte[], string)

Determines whether the arrData array begins with the supplied sMagics ASCII text. Used for Content-Type sniffing.

Declaration

cs-api-definition
public static bool HasMagicBytes(byte[] arrData, string sMagics)

Parameters

arrData

byte[]

The data, or null

sMagics

string

The ASCII text to look for

Returns

bool

TRUE if arrData begins with sMagics (encoded as ASCII octets)

HasResponseHeaders(Session)

Checks if the session has response headers

Declaration

cs-api-definition
public static bool HasResponseHeaders(Session oSession)

Parameters

oSession

Session

The session

Returns

bool

true if the session has response headers

HtmlEncode(string)

HtmlEncode a string. In Fiddler itself, this is a simple wrapper for the System.Web.HtmlEncode function. The .NET3.5/4.0 Client Profile doesn't include System.Web, so we must provide our own implementation of HtmlEncode for FiddlerCore's use.

Declaration

cs-api-definition
public static string HtmlEncode(string sInput)

Parameters

sInput

string

String to encode

Returns

string

String encoded according to the rules of HTML Encoding, or null.

IPEndPointFromHostPortString(string)

Given a string/list in the form HOSTNAME:PORT#;HOSTNAME2:PORT2#, this function returns the FIRST IPEndPoint. Defaults to port 80 if not specified. Warning: DNS resolution is slow, so use this function wisely.

Declaration

cs-api-definition
public static IPEndPoint IPEndPointFromHostPortString(string sHostAndPort)

Parameters

sHostAndPort

string

HOSTNAME:PORT#;OPTHOST2:PORT2#

Returns

IPEndPoint

An IPEndPoint or null

IPEndPointListFromHostPortString(string)

Given a string/list in the form HOSTNAME:PORT#;HOSTNAME2:PORT2#, this function returns all IPEndPoints for ALL listed hosts. Defaults to port 80 if not specified. Warning: DNS resolution is slow, so use this function wisely.

Declaration

cs-api-definition
public static IPEndPoint[] IPEndPointListFromHostPortString(string sAllHostAndPorts)

Parameters

sAllHostAndPorts

string

HOSTNAME:PORT#;OPTHOST2:PORT2#

Returns

IPEndPoint[]

An array of IPEndPoints or null if no results were obtained

IPFromString(string)

This function attempts to be a fast way to return an IP from a hoststring that contains an IPv4/6-Literal.

Declaration

cs-api-definition
[CodeDescription("This function attempts to be a ~fast~ way to return an IP from a hoststring that contains an IP-Literal. ")]
public static IPAddress IPFromString(string sHost)

Parameters

sHost

string

Hostname

Returns

IPAddress

IPAddress, or null, if the sHost wasn't an IP-Literal

IndexOfNth(string, int, char)

Declaration

cs-api-definition
public static int IndexOfNth(string sString, int n, char chSeek)

Parameters

sString

string

n

int

chSeek

char

Returns

int

IsBinaryMIME(string)

Determines if the specified MIME type is "binary" in nature.

Declaration

cs-api-definition
public static bool IsBinaryMIME(string sContentType)

Parameters

sContentType

string

The MIME type

Returns

bool

TRUE if the MIME type is likely binary in nature

IsBrowserProcessName(string)

For a given process name, returns a bool indicating whether this is a known browser process name.

Declaration

cs-api-definition
public static bool IsBrowserProcessName(string sProcessName)

Parameters

sProcessName

string

The Process name (e.g. "abrowser.exe")

Returns

bool

Returns true if the process name starts with a common browser process name (e.g. ie, firefox, etc)

IsCommentUserSupplied(string)

Returns TRUE if the string is non-empty and not of the pattern "[#123]" Necessary because SAZ-saving logic autogenerates comments of that form

Declaration

cs-api-definition
public static bool IsCommentUserSupplied(string strComment)

Parameters

strComment

string

Returns

bool

IsNullOrEmpty(byte[])

Returns TRUE if the array is null or contains 0 bytes

Declaration

cs-api-definition
public static bool IsNullOrEmpty(byte[] bIn)

Parameters

bIn

byte[]

byte[] to test

Returns

bool

IsRedirect(Session)

Checks if the session is a Redirect

Declaration

cs-api-definition
public static bool IsRedirect(Session oSession)

Parameters

oSession

Session

The session

Returns

bool

true if the session is a Redirect

IsRedirectStatus(int)

Declaration

cs-api-definition
public static bool IsRedirectStatus(int iResponseCode)

Parameters

iResponseCode

int

Returns

bool

JoinByteArrays(byte[], byte[])

Create a new byte[] containing the contents of two other byte arrays.

Declaration

cs-api-definition
public static byte[] JoinByteArrays(byte[] arr1, byte[] arr2)

Parameters

arr1

byte[]

arr2

byte[]

Returns

byte[]

Launch the user's browser to a hyperlink. This function traps exceptions and notifies the user via UI dialog.

Declaration

cs-api-definition
[CodeDescription("ShellExecutes the sURL.")]
public static bool LaunchHyperlink(string sURL)

Parameters

sURL

string

The URL to ShellExecute.

Returns

bool

TRUE if the ShellExecute call succeeded.

Parameterize(string)

Declaration

cs-api-definition
[CodeDescription("Tokenize a string into tokens. Delimits on whitespace; \" marks are dropped unless preceded by \\ characters.")]
public static string[] Parameterize(string sInput)

Parameters

sInput

string

Returns

string[]

Parameterize(string, bool)

Tokenize a string into tokens. Delimits on unquoted whitespace ; quote marks are dropped unless preceded by \ characters. Some special hackery to allow trailing slash not escape the final character of the entire input, so that: prefs set fiddler.config.path.vsplugins "F:\users\ericlaw\VSWebTest" ...doesn't end up with a trailing quote.

Declaration

cs-api-definition
[CodeDescription("Tokenize a string into tokens. Delimits on whitespace; \" marks are dropped unless preceded by \\ characters.")]
public static string[] Parameterize(string sInput, bool bAllowSQuote)

Parameters

sInput

string

The string to tokenize

bAllowSQuote

bool

Are single-quotes allowed to as escapes?

Returns

string[]

An array of strings

PrefixEllipsizeIfNeeded(string, int)

Declaration

cs-api-definition
public static string PrefixEllipsizeIfNeeded(string sString, int iMaxLength)

Parameters

sString

string

iMaxLength

int

Returns

string

ReadEntireStream(Stream)

Declaration

cs-api-definition
public static byte[] ReadEntireStream(Stream oS)

Parameters

oS

Stream

Returns

byte[]

ReadEntireStream(Stream, byte[])

Fills an array completely using the provided stream. Unlike a normal .Read(), this one will always fully fill the array unless the Stream throws.

Declaration

cs-api-definition
[CodeDescription("Reads oStream until arrBytes is filled.")]
public static int ReadEntireStream(Stream oStream, byte[] arrBytes)

Parameters

oStream

Stream

The stream from which to read.

arrBytes

byte[]

The byte array into which the data should be stored.

Returns

int

The count of bytes read.

ReadSessionArchive(string, out string)

Reads a Session Archive Zip file into an array of Session objects

Declaration

cs-api-definition
public static Session[] ReadSessionArchive(string sFilename, out string sazVersion)

Parameters

sFilename

string

Filename to load

sazVersion

string

Outputs the version of the read SAZ file

Returns

Session[]

Loaded array of sessions or null, in case of failure

ReadSessionArchive(string, string, GetPasswordDelegate, out string, bool, bool)

Reads a Session Archive Zip file into an array of Session objects

Declaration

cs-api-definition
[CodeDescription("Load the specified .SAZ or .ZIP session archive")]
public static Session[] ReadSessionArchive(string sFilename, string sContext, GetPasswordDelegate fnPasswordCallback, out string sazVersion, bool skipNewSessionEvent = false, bool skipOriginalIdComment = false)

Parameters

sFilename

string

Filename to load

sContext

string

Context for displaying errors

fnPasswordCallback

GetPasswordDelegate

Delegate to use to prompt for password if importing encrypted archive

sazVersion

string

Outputs the version of the read Session Archive Zip file

skipNewSessionEvent

bool

Specifies if the Session.SessionCreated event should be raised for each session in the archive of not.

skipOriginalIdComment

bool

Specifies if the sessions without comments should ge their original Id as an auto-generated comment of not.

Returns

Session[]

Loaded array of sessions or null, in case of failure

ReadSessionArchive(string, string, out string)

Reads a Session Archive Zip file into an array of Session objects

Declaration

cs-api-definition
public static Session[] ReadSessionArchive(string sFilename, string sContext, out string sazVersion)

Parameters

sFilename

string

Filename to load

sContext

string

Context for displaying errors

sazVersion

string

Outputs the version of the read SAZ file

Returns

Session[]

Loaded array of sessions or null, in case of failure

RecoverMemory()

Garbage collect and, if possible, compact the Large Object heap

Declaration

cs-api-definition
public static void RecoverMemory()

ResolveProtocol(Session)

Calculate the session protocol

Declaration

cs-api-definition
public static SessionProtocol ResolveProtocol(Session oSession)

Parameters

oSession

Session

The session

Returns

SessionProtocol

ResolveType(Session, bool)

Calculate the session type.

Declaration

cs-api-definition
public static SessionType ResolveType(Session oSession, bool resolveTypeBeforeSessionIsDone = false)

Parameters

oSession

Session

The session

resolveTypeBeforeSessionIsDone

bool

Return the actual sessionType even if the session is not in state Done or Aborted

Returns

SessionType

the type of the session

RunExecutable(string, string)

Wrapper for Process.Start that shows error messages in the event of failure.

Declaration

cs-api-definition
public static bool RunExecutable(string sExecute, string sParams)

Parameters

sExecute

string

Fully-qualified filename to execute.

sParams

string

Command line parameters to pass.

Returns

bool

TRUE if the execution succeeded. FALSE if the execution failed. An error message will be shown for any error except the user declining UAC.

RunExecutableAndWait(string, string)

Run an executable and wait for it to exit, notifying the user of any exceptions.

Declaration

cs-api-definition
[CodeDescription("Run an executable and wait for it to exit.")]
public static bool RunExecutableAndWait(string sExecute, string sParams)

Parameters

sExecute

string

Fully-qualified filename of file to execute.

sParams

string

Command-line parameters to pass.

Returns

bool

TRUE if the execution succeeded. FALSE if the error message was shown.

SanitizeFileName(string)

Remove invalid characters from a file name (no extension)

Declaration

cs-api-definition
public static string SanitizeFileName(string fileName)

Parameters

fileName

string

File name to sanitize (without the extension)

Returns

string

The file name with all special characters replaced with a dash

SetRegistryString(RegistryKey, string, string)

Save a string to the registry. Correctly handles null Value, saving as String.Empty

Declaration

cs-api-definition
[CodeDescription("Save a string to the registry. Correctly handles null Value, saving as String.Empty.")]
public static void SetRegistryString(RegistryKey oReg, string sName, string sValue)

Parameters

oReg

RegistryKey

The registry key into which the value will be written.

sName

string

The name of the value.

sValue

string

The value to write.

ToBcProtocolVersion(SslProtocols)

Declaration

cs-api-definition
public static ProtocolVersion ToBcProtocolVersion(SslProtocols value)

Parameters

value

SslProtocols

Returns

ProtocolVersion

ToDotNetCertificates(Certificate)

Declaration

cs-api-definition
public static IList<X509Certificate2> ToDotNetCertificates(Certificate certificate)

Parameters

certificate

Certificate

Returns

IList<X509Certificate2>

TrimAfter(string, char)

Returns the "Head" of a string, before and not including the first instance of specified delimiter.

Declaration

cs-api-definition
[CodeDescription("Returns the part of a string up to (but NOT including) the first instance of specified delimiter. If delim not found, returns entire string.")]
public static string TrimAfter(string sString, char chDelim)

Parameters

sString

string

The string to trim from.

chDelim

char

The delimiting character at which the trim should end.

Returns

string

Part of a string up to (but not including) chDelim, or the full string if chDelim was not found.

TrimAfter(string, int)

[Deprecated] Ensures that the target string is iMaxLength or fewer characters

Declaration

cs-api-definition
public static string TrimAfter(string sString, int iMaxLength)

Parameters

sString

string

The string to trim from

iMaxLength

int

The maximum number of characters to return

Returns

string

Up to iMaxLength characters from the "Head" of the string.

Remarks

Identical to the TrimTo(string, int) method.

TrimAfter(string, string)

Returns the "Head" of a string, before and not including a specified search string.

Declaration

cs-api-definition
[CodeDescription("Returns the part of a string up to (but NOT including) the first instance of specified substring. If delim not found, returns entire string.")]
public static string TrimAfter(string sString, string sDelim)

Parameters

sString

string

The string to trim from

sDelim

string

The delimiting string at which the trim should end.

Returns

string

Part of a string up to (but not including) sDelim, or the full string if sDelim was not found.

TrimBefore(string, char)

Returns the "Tail" of a string, after (but NOT including) the First instance of specified delimiter. See also TrimBeforeLast(string, char)

Declaration

cs-api-definition
[CodeDescription("Returns the part of a string after (but NOT including) the first instance of specified delimiter. If delim not found, returns entire string.")]
public static string TrimBefore(string sString, char chDelim)

Parameters

sString

string

The string to trim from.

chDelim

char

The delimiting character after which the text should be returned.

Returns

string

Part of a string after (but not including) chDelim, or the full string if chDelim was not found.

TrimBefore(string, string)

Returns the "Tail" of a string, after (but NOT including) the First instance of specified search string. TrimBeforeLast(string, string)

Declaration

cs-api-definition
[CodeDescription("Returns the part of a string after (but NOT including) the first instance of specified substring. If delim not found, returns entire string.")]
public static string TrimBefore(string sString, string sDelim)

Parameters

sString

string

The string to trim from.

sDelim

string

The delimiting string after which the text should be returned.

Returns

string

Part of a string after (but not including) sDelim, or the full string if sDelim was not found.

TrimBeforeLast(string, char)

Returns the "Tail" of a string, after (but not including) the Last instance of specified delimiter. TrimBefore(string, char)

Declaration

cs-api-definition
[CodeDescription("Returns the part of a string after (but not including) the last instance of specified delimiter. If delim not found, returns entire string.")]
public static string TrimBeforeLast(string sString, char chDelim)

Parameters

sString

string

The string to trim from.

chDelim

char

The delimiting character after which text should be returned.

Returns

string

Part of a string after (but not including) the final chDelim, or the full string if chDelim was not found.

TrimBeforeLast(string, string)

Returns the "Tail" of a string, after (but not including) the Last instance of specified substring. TrimBefore(string, string)

Declaration

cs-api-definition
[CodeDescription("Returns the part of a string after (but not including) the last instance of specified substring. If delim not found, returns entire string.")]
public static string TrimBeforeLast(string sString, string sDelim)

Parameters

sString

string

The string to trim from.

sDelim

string

The delimiting string after which text should be returned.

Returns

string

Part of a string after (but not including) the final sDelim, or the full string if sDelim was not found.

TrimTo(string, int)

Ensures that the target string is iMaxLength or fewer characters

Declaration

cs-api-definition
[CodeDescription("Returns the first iMaxLength or fewer characters from the target string.")]
public static string TrimTo(string sString, int iMaxLength)

Parameters

sString

string

The string to trim from

iMaxLength

int

The maximum number of characters to return

Returns

string

Up to iMaxLength characters from the "Head" of the string.

TrimUpTo(string, string)

Returns the "Tail" of a string, after (and including) the first instance of specified search string.

Declaration

cs-api-definition
[CodeDescription("Returns the part of a string after (and including) the first instance of specified substring. If delim not found, returns entire string.")]
public static string TrimUpTo(string sString, string sDelim)

Parameters

sString

string

The string to trim from.

sDelim

string

The delimiting string at which the text should be returned.

Returns

string

Part of the string starting with sDelim, or the entire string if sDelim not found.

TryHexParse(string, out int)

Try parsing the string for a Hex-formatted int. If it fails, return false and 0 in iOutput.

Declaration

cs-api-definition
[CodeDescription("Try parsing the string for a Hex-formatted int. If it fails, return false and 0 in iOutput.")]
public static bool TryHexParse(string sInput, out int iOutput)

Parameters

sInput

string

The hex number

iOutput

int

The int value

Returns

bool

TRUE if the parsing succeeded

UNSTABLE_DescribeClientHello(MemoryStream)

Parses the Client Hello part of a TLS handshake

Declaration

cs-api-definition
public static string UNSTABLE_DescribeClientHello(MemoryStream msHello)

Parameters

msHello

MemoryStream

a byte stream containing the handshake data

Returns

string

String containing the client handshake data

UNSTABLE_DescribeServerHello(MemoryStream)

Parses the Server Hello part of a TLS handshake

Declaration

cs-api-definition
public static string UNSTABLE_DescribeServerHello(MemoryStream msHello)

Parameters

msHello

MemoryStream

a byte stream containing the handshake data

Returns

string

String containing the server handshake data

UrlDecode(string)

Convert the %-encoded string into a string, interpreting %-escape sequences as UTF-8 characters

Declaration

cs-api-definition
public static string UrlDecode(string sInput)

Parameters

sInput

string

%-encoded string

Returns

string

Unencoded string

UrlEncode(string)

Declaration

cs-api-definition
public static string UrlEncode(string sInput)

Parameters

sInput

string

Returns

string

UrlEncode(string, Encoding)

Declaration

cs-api-definition
public static string UrlEncode(string sInput, Encoding oEnc)

Parameters

sInput

string

oEnc

Encoding

Returns

string

UrlPathEncode(string)

Replaces System.Web.HttpUtility.UrlPathEncode(str).

Declaration

cs-api-definition
public static string UrlPathEncode(string str)

Parameters

str

string

String to encode as a URL Path

Returns

string

Encoded string

UrlsEquals(string, string)

Compare urls by ignoring the case trimming invalid chars.

Declaration

cs-api-definition
public static bool UrlsEquals(string url1, string url2)

Parameters

url1

string

url2

string

Returns

bool

WriteArrayToFile(string, byte[])

Writes arrBytes to a file, creating the target directory and overwriting if the file exists.

Declaration

cs-api-definition
[CodeDescription("Writes arrBytes to a file, creating the target directory and overwriting if the file exists.")]
public static void WriteArrayToFile(string sFilename, byte[] arrBytes)

Parameters

sFilename

string

Path to File to write.

arrBytes

byte[]

Bytes to write.

WriteSessionArchive(string, Session[], string, bool)

Create a Session Archive Zip file containing the specified sessions

Declaration

cs-api-definition
[CodeDescription("Save the specified .SAZ session archive")]
public static bool WriteSessionArchive(string sFilename, Session[] arrSessions, string sPassword, bool allowEmpty = false)

Parameters

sFilename

string

The filename of the SAZ file to store

arrSessions

Session[]

Array of sessions to store

sPassword

string

Password to encrypt the file with, or null

allowEmpty

bool

TRUE to write an empty saz

Returns

bool

XpressExpand(byte[])

Decompress a byte array that was compressed using Microsoft's Xpress Raw format. Available only on Windows 8+

Declaration

cs-api-definition
public static byte[] XpressExpand(byte[] arrBlock)

Parameters

arrBlock

byte[]

Array to decompress

Returns

byte[]

byte[] of decompressed data

ZstdCompress(byte[])

Compresses an input byte array with zstd

Declaration

cs-api-definition
[CodeDescription("Returns a byte[] containing a zstd-compressed copy of writeData[]")]
public static byte[] ZstdCompress(byte[] writeData)

Parameters

writeData

byte[]

Input byte array

Returns

byte[]

byte[] containing a zstd-compressed copy of writeData[]

ZstdExpand(byte[])

Decompress a byte array that was compressed using zstd

Declaration

cs-api-definition
[CodeDescription("Returns a byte[] containing an decompressed copy of compressedData[]")]
public static byte[] ZstdExpand(byte[] compressedData)

Parameters

compressedData

byte[]

Array to decompress

Returns

byte[]

byte[] containing an decompressed copy of compressedData[]

ZstdExpand(byte[], bool)

Decompress a byte array that was compressed using zstd

Declaration

cs-api-definition
public static byte[] ZstdExpand(byte[] compressedData, bool throwErrors)

Parameters

compressedData

byte[]

Array to decompress

throwErrors

bool

throw exception on error

Returns

byte[]

byte[] containing an decompressed copy of compressedData[]

Exceptions

InvalidDataException

areOriginsEquivalent(string, string, int)

Returns TRUE if two ORIGIN (scheme+host+port) values are functionally equivalent.

Declaration

cs-api-definition
public static bool areOriginsEquivalent(string sOrigin1, string sOrigin2, int iDefaultPort)

Parameters

sOrigin1

string

The first ORIGIN

sOrigin2

string

The second ORIGIN

iDefaultPort

int

The default port, if a port is not specified

Returns

bool

TRUE if the two origins are equivalent

bzip2Compress(byte[])

Compress a byte[] using the bzip2 algorithm

Declaration

cs-api-definition
[CodeDescription("Returns a byte[] representing the bzip2'd representation of writeData[]")]
public static byte[] bzip2Compress(byte[] writeData)

Parameters

writeData

byte[]

Array to compress

Returns

byte[]

byte[] of data compressed using bzip2

bzip2Expand(byte[])

Decompress an array compressed using bzip2

Declaration

cs-api-definition
public static byte[] bzip2Expand(byte[] compressedData)

Parameters

compressedData

byte[]

The array to expand

Returns

byte[]

byte[] of decompressed data

bzip2Expand(byte[], bool)

Decompress an array compressed using bzip2

Declaration

cs-api-definition
public static byte[] bzip2Expand(byte[] compressedData, bool bThrowErrors)

Parameters

compressedData

byte[]

The array to expand

bThrowErrors

bool

If True, any errors during decompression will be thrown as an InvalidDataException.

Returns

byte[]

byte[] of decompressed data

doChunk(byte[], int)

Takes a byte array and applies HTTP Chunked Transfer Encoding to it

Declaration

cs-api-definition
public static byte[] doChunk(byte[] writeData, int iSuggestedChunkCount)

Parameters

writeData

byte[]

The byte array to convert

iSuggestedChunkCount

int

The number of chunks to try to create

Returns

byte[]

The byte array with Chunked Transfer Encoding applied

doUnchunk(byte[])

Removes HTTP chunked encoding from the data in writeData and returns the resulting array.

Declaration

cs-api-definition
public static byte[] doUnchunk(byte[] writeData)

Parameters

writeData

byte[]

Some chunked data

Returns

byte[]

Unchunked data. Throws InvalidDataException on data format errors.

getEntityBodyEncoding(HTTPHeaders, byte[])

WARNING: Potentially slow. WARNING: Does not decode the HTTP Response body; if compressed, embedded META or charset will not be checked Gets (via Headers or Sniff) the provided body's text Encoding. If not found, returns CONFIG.oHeaderEncoding (usually UTF-8).

Declaration

cs-api-definition
[CodeDescription("Gets (via Headers or Sniff) the provided body's text Encoding. Returns CONFIG.oHeaderEncoding (usually UTF-8) if unknown. Potentially slow.")]
public static Encoding getEntityBodyEncoding(HTTPHeaders oHeaders, byte[] oBody)

Parameters

oHeaders

HTTPHeaders

HTTP Headers, ideally containing a Content-Type header with a charset attribute.

oBody

byte[]

byte[] containing the entity body.

Returns

Encoding

A character encoding, if one could be determined

getResponseBodyEncoding(Session)

Gets (via Headers or Sniff) the Response Text Encoding. Returns CONFIG.oHeaderEncoding (usually UTF-8) if unknown. Perf: May be quite slow; cache the response

Declaration

cs-api-definition
[CodeDescription("Gets (via Headers or Sniff) the Response Text Encoding. Returns CONFIG.oHeaderEncoding (usually UTF-8) if unknown. Potentially slow.")]
public static Encoding getResponseBodyEncoding(Session oSession)

Parameters

oSession

Session

The session

Returns

Encoding

The encoding of the response body

isLocalhost(string)

This function cracks a sHostPort string to determine if the address refers to the local computer

Declaration

cs-api-definition
[CodeDescription("Returns true if True if the sHostAndPort's host is 127.0.0.1, 'localhost', or ::1. Note that list is not complete.")]
public static bool isLocalhost(string sHostAndPort)

Parameters

sHostAndPort

string

The string to evaluate, potentially containing a port

Returns

bool

True if the address is 127.0.0.1, 'localhost', or ::1

isLocalhostname(string)

Determines if the specified Hostname is a either 'localhost' or an IPv4 or IPv6 loopback literal

Declaration

cs-api-definition
[CodeDescription("Returns true if True if the sHostname is 127.0.0.1, 'localhost', or ::1. Note that list is not complete.")]
public static bool isLocalhostname(string sHostname)

Parameters

sHostname

string

Hostname (no port)

Returns

bool

TRUE if the hostname is equivalent to localhost

isPlainHostName(string)

This function cracks a sHostPort string to determine if the address refers to a "local" site

Declaration

cs-api-definition
[CodeDescription("Returns false if Hostname contains any dots or colons.")]
public static bool isPlainHostName(string sHostAndPort)

Parameters

sHostAndPort

string

The string to evaluate, potentially containing a port

Returns

bool

True if the address is local

isUnsupportedEncoding(string, string)

Implements a BlockList for "unknown" encodings that the utilDecode* functions cannot handle

Declaration

cs-api-definition
public static bool isUnsupportedEncoding(string sTE, string sCE)

Parameters

sTE

string

Transfer-Encoding

sCE

string

Content-Encoding

Returns

bool

TRUE if any encoding is known to be unsupported

utilDecodeGRPCMessage(HTTPHeaders, ref byte[])

Decode the provided data using the encoding specified in the grpc-encoding header

Declaration

cs-api-definition
public static void utilDecodeGRPCMessage(HTTPHeaders oHeaders, ref byte[] data)

Parameters

oHeaders

HTTPHeaders

Headers specifying what encodings are applied

data

byte[]

In/Out array to be modified

utilDecodeHTTPBody(HTTPHeaders, ref byte[])

Remove all encodings from arrBody, based on those specified in the supplied HTTP headers; DOES NOT MODIFY HEADERS. Throws on errors.

Declaration

cs-api-definition
public static void utilDecodeHTTPBody(HTTPHeaders oHeaders, ref byte[] arrBody)

Parameters

oHeaders

HTTPHeaders

Readonly headers specifying what encodings are applied

arrBody

byte[]

In/Out array to be modified

utilDecodeHTTPBody(HTTPHeaders, ref byte[], bool)

Remove all encodings from arrBody, based on those specified in the supplied HTTP headers; DOES NOT MODIFY HEADERS. DOES NOT HANDLE UNSUPPORTED ENCODINGS WELL. Throws on errors.

Declaration

cs-api-definition
public static void utilDecodeHTTPBody(HTTPHeaders oHeaders, ref byte[] arrBody, bool bSilent)

Parameters

oHeaders

HTTPHeaders

Readonly headers specifying what encodings are applied

arrBody

byte[]

In/Out array to be modified

bSilent

bool

FALSE to show dialog boxes on errors, TRUE to remain silent

utilDecodeWebsocketMessage(string, ref byte[])

Decode provided data using the encoding specified in Sec-WebSocket-Extensions header

Declaration

cs-api-definition
public static void utilDecodeWebsocketMessage(string encoding, ref byte[] data)

Parameters

encoding

string

Websocket messages encoding

data

byte[]

In/out payload array to be decoded

In this article
DefinitionFieldsHttp2MagicHeaderSupportedTLS1_3_Ciphers_ClientSupportedTLS1_3_Ciphers_ServeremptyByteArraysCommonRequestHeaderssCommonResponseHeadersPropertiesThisAssemblyVersionMethodsBrotliCompress(byte[], out long)BrotliExpand(byte[])ByteArrayToHexView(byte[], int)ByteArrayToHexView(byte[], int, int)ByteArrayToHexView(byte[], int, int, bool)ByteArrayToHexView(byte[], int, int, int, bool)ByteArrayToString(byte[])ByteArrayToStringExt(byte[])CompareVersions(string, Version)ContentTypeForFilename(string)CrackHostAndPort(string, out string, ref int)DeflaterCompress(byte[])DeflaterCompress(byte[], CancellationToken)DeflaterExpand(byte[])DeflaterExpand(byte[], bool)DeflaterExpandInternal(byte[])Dupe(byte[])EllipsizeIfNeeded(string, int)EnsureInRange<T>(T, T, T)EnsureOverwritable(string)EnsurePathIsAbsolute(string, string)EnsureUniqueFilename(string)EnsureValidAsPath(string)FileExtensionForMIMEType(string)FormatSslVersion(string)GetCommaTokenValue(string, string)GetCustomCertErrorPageTemplate(string, string, string)GetEchoServicePageTemplate(Session)GetExecutableOutput(string, string, out int)GetHostName(Session)GetInstrumentedBrowserInitialPageTemplate(Session)GetRegistryBool(RegistryKey, string, bool)GetRegistryFloat(RegistryKey, string, float)GetRegistryInt(RegistryKey, string, int)GetRemoteDeviceConnectivityPageTemplate(Session)GetRequestHeaders(Session)GetResponseHeaders(Session)GetStringFromArrayRemovingBOM(byte[], Encoding)GetTextEncoding(string)GetTickCount()GzipCompress(byte[])GzipExpand(byte[])GzipExpand(byte[], bool)GzipExpandInternal(byte[])HTTPMethodAllowsBody(string)HTTPMethodIsIdempotent(string)HTTPMethodRequiresBody(string)HTTPStatusAllowsBody(int)HasMagicBytes(byte[], byte[])HasMagicBytes(byte[], int, byte[])HasMagicBytes(byte[], string)HasResponseHeaders(Session)HtmlEncode(string)IPEndPointFromHostPortString(string)IPEndPointListFromHostPortString(string)IPFromString(string)IndexOfNth(string, int, char)IsBinaryMIME(string)IsBrowserProcessName(string)IsCommentUserSupplied(string)IsNullOrEmpty(byte[])IsRedirect(Session)IsRedirectStatus(int)JoinByteArrays(byte[], byte[])LaunchHyperlink(string)Parameterize(string)Parameterize(string, bool)PrefixEllipsizeIfNeeded(string, int)ReadEntireStream(Stream)ReadEntireStream(Stream, byte[])ReadSessionArchive(string, out string)ReadSessionArchive(string, string, GetPasswordDelegate, out string, bool, bool)ReadSessionArchive(string, string, out string)RecoverMemory()ResolveProtocol(Session)ResolveType(Session, bool)RunExecutable(string, string)RunExecutableAndWait(string, string)SanitizeFileName(string)SetRegistryString(RegistryKey, string, string)ToBcProtocolVersion(SslProtocols)ToDotNetCertificates(Certificate)TrimAfter(string, char)TrimAfter(string, int)TrimAfter(string, string)TrimBefore(string, char)TrimBefore(string, string)TrimBeforeLast(string, char)TrimBeforeLast(string, string)TrimTo(string, int)TrimUpTo(string, string)TryHexParse(string, out int)UNSTABLE_DescribeClientHello(MemoryStream)UNSTABLE_DescribeServerHello(MemoryStream)UrlDecode(string)UrlEncode(string)UrlEncode(string, Encoding)UrlPathEncode(string)UrlsEquals(string, string)WriteArrayToFile(string, byte[])WriteSessionArchive(string, Session[], string, bool)XpressExpand(byte[])ZstdCompress(byte[])ZstdExpand(byte[])ZstdExpand(byte[], bool)areOriginsEquivalent(string, string, int)bzip2Compress(byte[])bzip2Expand(byte[])bzip2Expand(byte[], bool)doChunk(byte[], int)doUnchunk(byte[])getEntityBodyEncoding(HTTPHeaders, byte[])getResponseBodyEncoding(Session)isLocalhost(string)isLocalhostname(string)isPlainHostName(string)isUnsupportedEncoding(string, string)utilDecodeGRPCMessage(HTTPHeaders, ref byte[])utilDecodeHTTPBody(HTTPHeaders, ref byte[])utilDecodeHTTPBody(HTTPHeaders, ref byte[], bool)utilDecodeWebsocketMessage(string, ref byte[])
Not finding the help you need?
Contact Support