Utilities Methods |
The Utilities type exposes the following members.
Name | Description | |
---|---|---|
areOriginsEquivalent |
Returns TRUE if two ORIGIN (scheme+host+port) values are functionally equivalent.
| |
BrotliExpand | ||
ByteArrayToHexView(Byte, Int32) |
Pretty-print a Hex view of a byte array. Slow.
| |
ByteArrayToHexView(Byte, Int32, Int32) |
Pretty-print a Hex view of a byte array. Slow.
| |
ByteArrayToHexView(Byte, Int32, Int32, Boolean) |
Pretty-print a Hex view of a byte array. Slow.
| |
ByteArrayToHexView(Byte, Int32, Int32, Int32, Boolean) | ||
ByteArrayToString |
Print an byte array to a hex string.
Slow.
| |
bzip2Compress |
Compress a byte[] using the bzip2 algorithm
| |
bzip2Expand(Byte) |
Decompress an array compressed using bzip2
| |
bzip2Expand(Byte, Boolean) |
Decompress an array compressed using bzip2
| |
CollapsePath |
Convert a full path into one that uses environment variables
| |
CompactPath |
Shrinks a path string to fit within a certain number of characters, replacing segments with ellipses if needed.
| |
CompareVersions |
Typically, a version number is displayed as "major number.minor number.build number.private part number".
| |
ContentTypeForFilename |
Return the content type of a target file, or application/octet-stream if unknown.
| |
CopyToClipboard(String) |
Copy a string to the clipboard, notifying the user of any exceptions
| |
CopyToClipboard(DataObject) |
Copy an object to the clipboard, notifying the user of any exceptions
| |
CrackHostAndPort |
This function cracks the Hostname/Port combo, removing IPV6 brackets if needed
| |
DeflaterCompress |
Compress a byte array using RFC1951 DEFLATE
| |
DeflaterExpand(Byte) |
Decompress a byte array that was compressed using RFC1951 DEFLATE
| |
DeflaterExpand(Byte, Boolean) | ||
DeflaterExpandInternal |
UnDeflate function which shows no UI and will throw on error
| |
doChunk |
Takes a byte array and applies HTTP Chunked Transfer Encoding to it
| |
doUnchunk |
Removes HTTP chunked encoding from the data in writeData and returns the resulting array.
| |
Dupe |
Duplicate a byte array, replacing null with byte[0].
Doing this instead of .Clone() because it better handles nulls and it may be faster.
| |
EllipsizeIfNeeded |
Ensures that the target string is iMaxLength or fewer characters, appending ... if truncation occurred
| |
EnsureInRangeT |
Ensures a value is within a specified range.
| |
EnsureOverwritable |
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.
| |
EnsurePathIsAbsolute |
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
| |
EnsureUniqueFilename |
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.
| |
EnsureValidAsPath |
Address the problem where the target "PATH" calls for a directoryname is already a filename
| |
GetCommaTokenValue |
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.
| |
getEntityBodyEncoding |
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).
| |
GetExecutableOutput |
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.
| |
GetHashAsBase64 | ||
GetMD5Hash |
Warning: This will throw if FIPS mode is enabled
| |
GetRegistryBool |
Get a bool from the registry
| |
GetRegistryFloat |
Returns an Float from the registry, or a default.
| |
GetRegistryInt |
Returns an integer from the registry, or a default.
| |
getResponseBodyEncoding |
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
| |
GetSHA1Hash | ||
GetSHA256Hash | ||
GetSHA384Hash | ||
GetSHA512Hash | ||
GetStringFromArrayRemovingBOM |
Gets a string from a byte-array, stripping a Byte Order Marker preamble if present.
| |
GetTextEncoding |
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
| |
GetTickCount |
Get a TickCount (milliseconds since system start) as an unsigned 64bit value. On Vista+, uses the GetTickCount64 API that won't rollover,
but on XP, this unsigned wrapper moves the rollover point to 49 days of uptime.
| |
GzipCompress |
GZIPs a byte-array
| |
GzipExpand(Byte) |
Expands a GZIP-compressed byte array
| |
GzipExpand(Byte, Boolean) | ||
GzipExpandInternal |
GZIP-Expand function which shows no UI and will throw on error
| |
HasMagicBytes(Byte, Byte) |
Determines whether the arrData array STARTS WITH with the supplied arrMagics bytes. Used for Content-Type sniffing.
| |
HasMagicBytes(Byte, String) |
Determines whether the arrData array begins with the supplied sMagics ASCII text. Used for Content-Type sniffing.
| |
HasMagicBytes(Byte, Int32, Byte) | ||
HtmlEncode |
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.
| |
HTTPMethodAllowsBody |
Returns true if a request with the specified HTTP Method/Verb may contain a entity body
| |
HTTPMethodIsIdempotent |
http://tools.ietf.org/html/draft-ietf-httpbis-p2-semantics-26#section-4.2.2
| |
HTTPMethodRequiresBody |
Determines true if a request with the specified HTTP Method/Verb MUST contain a entity body
| |
HTTPStatusAllowsBody | ||
IndexOfNth | ||
IPEndPointFromHostPortString |
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.
| |
IPEndPointListFromHostPortString |
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.
| |
IPFromString |
This function attempts to be a ~fast~ way to return an IP from a hoststring that contains an IPv4/6-Literal.
| |
IsBinaryMIME |
Determines if the specified MIME type is "binary" in nature.
| |
IsBrowserProcessName |
For a given process name, returns a bool indicating whether this is a known browser process name.
| |
IsCommentUserSupplied |
Returns TRUE if the string is non-empty and not of the pattern "[#123]"
Necessary because SAZ-saving logic autogenerates comments of that form
| |
isLocalhost |
This function cracks a sHostPort string to determine if the address
refers to the local computer
| |
isLocalhostname |
Determines if the specified Hostname is a either 'localhost' or an IPv4 or IPv6 loopback literal
| |
IsNullOrEmpty |
Returns TRUE if the array is null or contains 0 bytes
| |
isPlainHostName |
This function cracks a sHostPort string to determine if the address
refers to a "local" site
| |
IsRedirectStatus | ||
isUnsupportedEncoding |
Implements a BlockList for "unknown" encodings that the utilDecode* functions cannot handle
| |
IsUserAnAdmin |
Returns TRUE if the user is running Elevated. Requires WinXP to Win8
| |
JoinByteArrays |
Create a new byte[] containing the contents of two other byte arrays.
| |
LaunchHyperlink |
Launch the user's browser to a hyperlink. This function traps exceptions and notifies the user via UI dialog.
| |
ObtainFilenames | ||
ObtainOpenFilename(String, String) |
Queries the user for an OPEN filename
| |
ObtainOpenFilename(String, String, String) |
Queries the user for an OPEN filename
| |
ObtainSaveFilename(String, String) |
Queries the user for a filename
| |
ObtainSaveFilename(String, String, String) |
Queries the user for a filename
| |
Parameterize(String) | ||
Parameterize(String, Boolean) |
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.
| |
PlaySoundFile | ||
PrefixEllipsizeIfNeeded | ||
ReadEntireStream(Stream) | ||
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.
| |
ReadSessionArchive(String, Boolean) | ||
ReadSessionArchive(String, Boolean, String) |
Reads a Session Archive Zip file into an array of Session objects
| |
ReadSessionArchive(String, Boolean, String, GetPasswordDelegate) |
Reads a Session Archive Zip file into an array of Session objects
| |
RecoverMemory |
Garbage collect and, if possible, compact the Large Object heap
| |
RunExecutable |
Wrapper for Process.Start that shows error messages in the event of failure.
| |
RunExecutableAndWait |
Run an executable and wait for it to exit, notifying the user of any exceptions.
| |
SetRegistryString |
Save a string to the registry. Correctly handles null Value, saving as String.Empty
| |
TrimAfter(String, Char) |
Returns the "Head" of a string, before and not including the first instance of specified delimiter.
| |
TrimAfter(String, Int32) |
[Deprecated] Ensures that the target string is iMaxLength or fewer characters
| |
TrimAfter(String, String) |
Returns the "Head" of a string, before and not including a specified search string.
| |
TrimBefore(String, Char) |
Returns the "Tail" of a string, after (but NOT including) the First instance of specified delimiter.
See also | |
TrimBefore(String, String) |
Returns the "Tail" of a string, after (but NOT including) the First instance of specified search string.
| |
TrimBeforeLast(String, Char) |
Returns the "Tail" of a string, after (but not including) the Last instance of specified delimiter.
| |
TrimBeforeLast(String, String) |
Returns the "Tail" of a string, after (but not including) the Last instance of specified substring.
| |
TrimTo |
Ensures that the target string is iMaxLength or fewer characters
| |
TrimUpTo |
Returns the "Tail" of a string, after (and including) the first instance of specified search string.
| |
TryHexParse |
Try parsing the string for a Hex-formatted int. If it fails, return false and 0 in iOutput.
| |
UNSTABLE_DescribeClientHello | ||
UNSTABLE_DescribeServerHello | ||
UrlDecode |
Convert the %-encoded string into a string, interpreting %-escape sequences as UTF-8 characters
| |
UrlEncode(String) | ||
UrlEncode(String, Encoding) | ||
UrlPathEncode |
Replaces System.Web.HttpUtility.UrlPathEncode(str).
| |
utilDecodeHTTPBody(HTTPHeaders, Byte) |
Remove all encodings from arrBody, based on those specified in the supplied HTTP headers; DOES NOT MODIFY HEADERS.
Throws on errors.
| |
utilDecodeHTTPBody(HTTPHeaders, Byte, Boolean) |
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.
| |
WriteArrayToFile |
Writes arrBytes to a file, creating the target directory and overwriting if the file exists.
| |
WriteSessionArchive |
Create a Session Archive Zip file containing the specified sessions
| |
XpressExpand |
Decompress a byte array that was compressed using Microsoft's Xpress Raw format.
Available only on Windows 8+
| |
ZLibExpand |
Decompress an array compressed using an Zlib DEFLATE stream. Not a HTTP Encoding; it's used internally in the PNG format.
|