Class Session
The Session object manages the complete HTTP session including the UI listitem, the ServerChatter, and the ClientChatter.
Inheritance
Inherited Members
Namespace: Fiddler
Assembly: FiddlerCore.dll
Syntax
public class Session
Constructors
Session(HTTPRequestHeaders, Byte[])
Initialize a new session from a given request headers and body request builder data. Note: No Session ID is assigned here.
Declaration
public Session(HTTPRequestHeaders oRequestHeaders, byte[] arrRequestBody)
Parameters
HTTPRequestHeaders
oRequestHeaders
NB: If you're copying an existing request, use oRequestHeaders.Clone() |
System.Byte[]
arrRequestBody
The bytes of the request's body |
Session(Session)
Copy Constructor. BuildFromData(Boolean, HTTPRequestHeaders, Byte[], HTTPResponseHeaders, Byte[], SessionFlags).
Declaration
public Session(Session toDeepCopy)
Parameters
Session
toDeepCopy
Session to clone into a new Session instance |
Session(SessionData)
Create a Session object from a (serializable) SessionData object
Declaration
public Session(SessionData oSD)
Parameters
SessionData
oSD
|
Session(Byte[], Byte[])
Create a Session object from two byte[] representing request and response.
Declaration
public Session(byte[] arrRequest, byte[] arrResponse)
Parameters
System.Byte[]
arrRequest
The client data bytes |
System.Byte[]
arrResponse
The server data bytes |
Session(Byte[], Byte[], SessionFlags)
Create a Session object from two byte[] representing request and response. This is used when loading a Session Archive Zip.
Declaration
public Session(byte[] arrRequest, byte[] arrResponse, SessionFlags oSF)
Parameters
System.Byte[]
arrRequest
The client data bytes |
System.Byte[]
arrResponse
The server data bytes |
SessionFlags
oSF
SessionFlags for this session |
Fields
__oTunnel
Used if the Session is bound to a WebSocket or CONNECTTunnel
Declaration
public ITunnel __oTunnel
Field Value
ITunnel
|
bBufferResponse
Should response be buffered for tampering.
Declaration
public bool bBufferResponse
Field Value
System.Boolean
|
Remarks
ARCH: This should have been a property instead of a field, so we could throw an InvalidStateException if code tries to manipulate this value after the response has begun
m_clientIP
IP Address of the client for this session.
Declaration
[CodeDescription("IP Address of the client for this session.")]
public string m_clientIP
Field Value
System.String
|
m_clientPort
Client port attached to Fiddler.
Declaration
[CodeDescription("Client port attached to Fiddler.")]
public int m_clientPort
Field Value
System.Int32
|
m_hostIP
IP Address of the server for this session.
Declaration
[CodeDescription("IP Address of the server for this session.")]
public string m_hostIP
Field Value
System.String
|
oFlags
Fiddler-internal flags set on the Session.
Declaration
[CodeDescription("Fiddler-internal flags set on the session.")]
public readonly StringDictionary oFlags
Field Value
System.Collections.Specialized.StringDictionary
|
Remarks
TODO: ARCH: This shouldn't be exposed directly; it should be wrapped by a ReaderWriterLockSlim to prevent exceptions while enumerating the flags for storage, etc
oRequest
Object representing the HTTP Request.
Declaration
[CodeDescription("Object representing the HTTP Request.")]
public ClientChatter oRequest
Field Value
ClientChatter
|
oResponse
Object representing the HTTP Response.
Declaration
[CodeDescription("Object representing the HTTP Response.")]
public ServerChatter oResponse
Field Value
ServerChatter
|
requestBodyBytes
Contains the bytes of the request body.
Declaration
[CodeDescription("Contains the bytes of the request body.")]
public byte[] requestBodyBytes
Field Value
System.Byte[]
|
responseBodyBytes
Contains the bytes of the response body.
Declaration
[CodeDescription("Contains the bytes of the response body.")]
public byte[] responseBodyBytes
Field Value
System.Byte[]
|
Timers
Timers stored as this Session progresses
Declaration
public SessionTimers Timers
Field Value
SessionTimers
|
ViewItem
Declaration
public object ViewItem
Field Value
System.Object
|
Properties
bHasResponse
Returns TRUE if this session's State > ReadingResponse, and oResponse, oResponse.headers, and responseBodyBytes are all non-null. Note that bHasResponse returns FALSE if the session is currently reading, even if a body was copied using the COMETPeek feature
Declaration
[CodeDescription("Returns TRUE if this session state>ReadingResponse and oResponse not null.")]
public bool bHasResponse { get; }
Property Value
System.Boolean
|
bHasWebSocketMessages
Checks whether this is a WebSocket, and if so, whether it has logged any parsed messages.
Declaration
public bool bHasWebSocketMessages { get; }
Property Value
System.Boolean
|
BitFlags
Bitflags of commonly-queried session attributes
Declaration
public SessionFlags BitFlags { get; }
Property Value
SessionFlags
|
bypassGateway
Set to true in OnBeforeRequest if this request should bypass the gateway
Declaration
[CodeDescription("Set to true in OnBeforeRequest if this request should bypass the gateway")]
public bool bypassGateway { get; set; }
Property Value
System.Boolean
|
clientIP
Returns the Address used by the client to communicate to Fiddler.
Declaration
[CodeDescription("Returns the Address used by the client to communicate to Fiddler.")]
public string clientIP { get; }
Property Value
System.String
|
clientPort
Returns the port used by the client to communicate to Fiddler.
Declaration
[CodeDescription("Returns the port used by the client to communicate to Fiddler.")]
public int clientPort { get; }
Property Value
System.Int32
|
fullUrl
Retrieves the complete URI, including protocol/scheme, in the form http://www.host.com/filepath?query. Or sets the complete URI, adjusting the UriScheme and/or Host.
Declaration
[CodeDescription("Retrieves the complete URI, including protocol/scheme, in the form http://www.host.com/filepath?query.")]
public string fullUrl { get; set; }
Property Value
System.String
|
host
DNS Name of the host server targeted by this request. May include IPv6 literal brackets. NB: a port# may be included.
Declaration
[CodeDescription("Gets/Sets the host to which this request is targeted. MAY include IPv6 literal brackets. MAY include a trailing port#.")]
public string host { get; set; }
Property Value
System.String
|
hostname
DNS Name of the host server (no port) targeted by this request. Will include IPv6-literal brackets for IPv6-literal addresses
Declaration
[CodeDescription("Gets/Sets the hostname to which this request is targeted; does NOT include any port# but will include IPv6-literal brackets for IPv6 literals.")]
public string hostname { get; set; }
Property Value
System.String
|
id
Returns the sequential number of this session. Note, by default numbering is restarted at zero when the session list is cleared.
Declaration
[CodeDescription("Returns the sequential number of this request.")]
public int id { get; }
Property Value
System.Int32
|
isFTP
When true, this session was conducted using the FTP protocol.
Declaration
[CodeDescription("When true, this session was conducted using the FTP protocol.")]
public bool isFTP { get; }
Property Value
System.Boolean
|
isHTTPS
When true, this session was conducted using the HTTPS protocol.
Declaration
[CodeDescription("When true, this session was conducted using the HTTPS protocol.")]
public bool isHTTPS { get; }
Property Value
System.Boolean
|
isTunnel
Returns True if this is a HTTP CONNECT tunnel.
Declaration
public bool isTunnel { get; }
Property Value
System.Boolean
|
Item[String]
Simple indexer into the Session's oFlags object; returns null if flag is not present.
Declaration
[CodeDescription("Indexer property into session flags collection. oSession[\"Flagname\"] returns string value (or null if missing!).")]
public string this[string sFlag] { get; set; }
Parameters
System.String
sFlag
|
Property Value
System.String
Returns the string value if the specified flag is present, or null if it is not. |
Item[String, String]
Indexer property into SESSION flags, REQUEST headers, and RESPONSE headers. e.g. oSession["Request", "Host"] returns string value for the Request host header. If null, returns String.Empty
Declaration
[CodeDescription("Indexer property into SESSION flags, REQUEST headers, and RESPONSE headers. e.g. oSession[\"Request\", \"Host\"] returns string value for the Request host header. If null, returns String.Empty")]
public string this[string sCollection, string sName] { get; }
Parameters
System.String
sCollection
SESSION, REQUEST or RESPONSE |
System.String
sName
The name of the flag or header |
Property Value
System.String
String value or String.Empty |
LocalProcess
Get the Process Info of the application which made this request, or String.Empty if it is not known
Declaration
[CodeDescription("Get the Process Info the application which made this request, or String.Empty if it cannot be determined.")]
public string LocalProcess { get; }
Property Value
System.String
|
LocalProcessID
Get the process ID of the application which made this request, or 0 if it cannot be determined.
Declaration
[CodeDescription("Get the process ID of the application which made this request, or 0 if it cannot be determined.")]
public int LocalProcessID { get; }
Property Value
System.Int32
|
PathAndQuery
Returns the path and query part of the URL. (For a CONNECT request, returns the host:port to be connected.)
Declaration
[CodeDescription("Returns the path and query part of the URL. (For a CONNECT request, returns the host:port to be connected.)")]
public string PathAndQuery { get; set; }
Property Value
System.String
|
port
Returns the server port to which this request is targeted.
Declaration
[CodeDescription("Returns the server port to which this request is targeted.")]
public int port { get; set; }
Property Value
System.Int32
|
RequestBody
Gets or Sets the HTTP Request body bytes. Setter adjusts Content-Length header, and removes Transfer-Encoding and Content-Encoding headers. Setter DOES NOT CLONE the passed array. Setter will throw if the Request object does not exist for some reason. Use utilSetRequestBody(sStr) to ensure proper character encoding if you need to use a string.
Declaration
[CodeDescription("Gets or Sets the Request body bytes; Setter fixes up headers.")]
public byte[] RequestBody { get; set; }
Property Value
System.Byte[]
|
RequestHeaders
Declaration
[CodeDescription("Gets Request Headers, or empty headers if headers do not exist")]
public HTTPRequestHeaders RequestHeaders { get; }
Property Value
HTTPRequestHeaders
|
RequestMethod
Declaration
[CodeDescription("Gets or Sets the request's Method (e.g. GET, POST, etc).")]
public string RequestMethod { get; set; }
Property Value
System.String
|
ResponseBody
Gets or Sets the HTTP Response body bytes. Setter adjusts Content-Length header, and removes Transfer-Encoding and Content-Encoding headers. Setter DOES NOT CLONE the passed array. Setter will throw if the Response object has not yet been created. (See utilCreateResponseAndBypassServer) Use utilSetResponseBody(sStr) to ensure proper character encoding if you need to use a string.
Declaration
[CodeDescription("Gets or Sets the Response body bytes; Setter fixes up headers.")]
public byte[] ResponseBody { get; set; }
Property Value
System.Byte[]
|
responseCode
Gets or Sets the HTTP Status code of the server's response
Declaration
[CodeDescription("Gets or Sets the HTTP Status code of the server's response")]
public int responseCode { get; set; }
Property Value
System.Int32
|
ResponseHeaders
Declaration
[CodeDescription("Gets Response Headers, or empty headers if headers do not exist")]
public HTTPResponseHeaders ResponseHeaders { get; }
Property Value
HTTPResponseHeaders
|
state
State of session. Note Side-Effects: If setting to .Aborted, calls FinishUISession. If setting to/from a Tamper state, calls RefreshMyInspectors
Declaration
[CodeDescription("Enumerated state of the current session.")]
public SessionStates state { get; set; }
Property Value
SessionStates
|
SuggestedFilename
Gets a path-less filename suitable for saving the Response entity. Uses Content-Disposition if available.
Declaration
[CodeDescription("Gets a path-less filename suitable for saving the Response entity. Uses Content-Disposition if available.")]
public string SuggestedFilename { get; }
Property Value
System.String
|
Tag
A common use for the Tag property is to store data that is closely associated with the Session. It is NOT marshalled during drag/drop and is NOT serialized to a SAZ file.
Declaration
public object Tag { get; set; }
Property Value
System.Object
|
TunnelEgressByteCount
If this session is a Tunnel, returns number of bytes sent from the Client to the Server
Declaration
public long TunnelEgressByteCount { get; }
Property Value
System.Int64
|
TunnelIngressByteCount
If this session is a Tunnel, returns number of bytes sent from the Server to the Client
Declaration
public long TunnelIngressByteCount { get; }
Property Value
System.Int64
|
TunnelIsOpen
If this session is a Tunnel, and the tunnel's IsOpen property is TRUE, returns TRUE. Otherwise returns FALSE.
Declaration
public bool TunnelIsOpen { get; }
Property Value
System.Boolean
|
url
Gets or sets the URL (without protocol) being requested from the server, in the form www.host.com/filepath?query.
Declaration
[CodeDescription("Gets or sets the URL (without protocol) being requested from the server, in the form www.host.com/filepath?query.")]
public string url { get; set; }
Property Value
System.String
|
Methods
Abort()
Closes both client and server pipes and moves state to Aborted; unpauses thread if paused.
Declaration
public void Abort()
BuildFromData(Boolean, HTTPRequestHeaders, Byte[], HTTPResponseHeaders, Byte[], SessionFlags)
Factory constructor
Declaration
public static Session BuildFromData(bool bClone, HTTPRequestHeaders headersRequest, byte[] arrRequestBody, HTTPResponseHeaders headersResponse, byte[] arrResponseBody, SessionFlags oSF)
Parameters
System.Boolean
bClone
|
HTTPRequestHeaders
headersRequest
|
System.Byte[]
arrRequestBody
|
HTTPResponseHeaders
headersResponse
|
System.Byte[]
arrResponseBody
|
SessionFlags
oSF
|
Returns
Session
|
COMETPeek()
Call this function while in the "reading response" state to update the responseBodyBytes array with the partially read response.
Declaration
public bool COMETPeek()
Returns
System.Boolean
TRUE if the peek succeeded; FALSE if not in the ReadingResponse state |
GetRedirectTargetURL()
Returns the fully-qualified URL to which this Session's response points, or null. This method is needed because many servers (illegally) return a relative url in HTTP/3xx Location response headers.
Declaration
public string GetRedirectTargetURL()
Returns
System.String
null, or Target URL. Note, you may want to call Utilities.TrimAfter(sTarget, '#'); on the response |
GetRedirectTargetURL(String, String)
Gets a redirect-target from a base URI and a Location header
Declaration
public static string GetRedirectTargetURL(string sBase, string sLocation)
Parameters
System.String
sBase
|
System.String
sLocation
|
Returns
System.String
null, or Target URL. Note, you may want to call Utilities.TrimAfter(sTarget, '#'); |
GetRequestBodyAsString()
Return a string generated from the request body, decoding it and converting from a codepage if needed. Throws on errors.
Declaration
[CodeDescription("Return a string generated from the request body, decoding it and converting from a codepage if needed. Possibly expensive due to decompression and will throw on malformed content. Throws on errors.")]
public string GetRequestBodyAsString()
Returns
System.String
A string containing the request body. |
GetRequestBodyEncoding()
Find the text encoding of the request WARNING: Will not decompress body to scan for indications of the character set
Declaration
[CodeDescription("Returns the Encoding of the requestBodyBytes")]
public Encoding GetRequestBodyEncoding()
Returns
System.Text.Encoding
Returns the Encoding of the requestBodyBytes |
GetResponseBodyAsString()
Return a string generated from the response body, decoding it and converting from a codepage if needed. Throws on errors.
Declaration
[CodeDescription("Return a string generated from the response body, decoding it and converting from a codepage if needed. Possibly expensive due to decompression and will throw on malformed content. Throws on errors.")]
public string GetResponseBodyAsString()
Returns
System.String
A string containing the response body. |
GetResponseBodyEncoding()
Find the text encoding of the response WARNING: Will not decompress body to scan for indications of the character set
Declaration
[CodeDescription("Returns the Encoding of the responseBodyBytes")]
public Encoding GetResponseBodyEncoding()
Returns
System.Text.Encoding
The Encoding of the responseBodyBytes |
GetResponseBodyHash(String)
Declaration
[CodeDescription("Return a string md5, sha1, sha256, sha384, or sha512 hash of an unchunked and decompressed copy of the response body. Throws on errors.")]
public string GetResponseBodyHash(string sHashAlg)
Parameters
System.String
sHashAlg
|
Returns
System.String
|
GetResponseBodyHashAsBase64(String)
Declaration
[CodeDescription("Return a base64 string md5, sha1, sha256, sha384, or sha512 hash of an unchunked and decompressed copy of the response body. Throws on errors.")]
public string GetResponseBodyHashAsBase64(string sHashAlgorithm)
Parameters
System.String
sHashAlgorithm
|
Returns
System.String
|
HostnameIs(String)
Returns TRUE if the Session's target hostname (no port) matches sTestHost (case-insensitively).
Declaration
[CodeDescription("Returns TRUE if the Session's target hostname (no port) matches sTestHost (case-insensitively).")]
public bool HostnameIs(string sTestHost)
Parameters
System.String
sTestHost
The host to which this session's host should be compared. |
Returns
System.Boolean
True if this session is targeted to the specified host. |
HTTPMethodIs(String)
Returns TRUE if the Session's HTTP Method is available and matches the target method.
Declaration
[CodeDescription("Returns TRUE if the Session's HTTP Method is available and matches the target method.")]
public bool HTTPMethodIs(string sTestFor)
Parameters
System.String
sTestFor
The target HTTP Method being compared. |
Returns
System.Boolean
true, if the method is specified and matches sTestFor (case-insensitive); otherwise false. |
Ignore()
Set the SessionFlags.Ignore bit for this Session, also configuring it to stream, drop read data, and bypass event handlers. For a CONNECT Tunnel, traffic will be blindly shuffled back and forth. Session will be hidden.
Declaration
[CodeDescription("Sets the SessionFlags.Ignore bit for this Session, hiding it and ignoring its traffic.")]
public void Ignore()
isAnyFlagSet(SessionFlags)
Test the session's BitFlags
Declaration
public bool isAnyFlagSet(SessionFlags FlagsToTest)
Parameters
SessionFlags
FlagsToTest
One or more (OR'd) SessionFlags |
Returns
System.Boolean
TRUE if ANY of specified flag(s) are set |
isFlagSet(SessionFlags)
Test the session's BitFlags
Declaration
public bool isFlagSet(SessionFlags FlagsToTest)
Parameters
SessionFlags
FlagsToTest
One or more (OR'd) SessionFlags |
Returns
System.Boolean
TRUE if ALL specified flag(s) are set |
LoadMetadata(Stream)
Read metadata about this session from a stream. NB: Closes the Stream when done.
Declaration
public bool LoadMetadata(Stream strmMetadata)
Parameters
System.IO.Stream
strmMetadata
The stream of XML text from which session metadata will be loaded. |
Returns
System.Boolean
True if the Metadata was successfully loaded; False if any exceptions were trapped. |
LoadRequestBodyFromFile(String)
Replace HTTP request body using the specified file.
Declaration
[CodeDescription("Replace HTTP request headers and body using the specified file.")]
public bool LoadRequestBodyFromFile(string sFilename)
Parameters
System.String
sFilename
The file containing the request |
Returns
System.Boolean
True if the file was successfully loaded as the request body |
LoadResponseFromFile(String)
Replace HTTP response headers and body using the specified file.
Declaration
[CodeDescription("Replace HTTP response headers and body using the specified file.")]
public bool LoadResponseFromFile(string sFilename)
Parameters
System.String
sFilename
The file containing the response. |
Returns
System.Boolean
True if the file was successfully loaded. |
LoadResponseFromStream(Stream, String)
Replace HTTP response headers and body using the specified stream.
Declaration
public bool LoadResponseFromStream(Stream strmResponse, string sOptionalContentTypeHint)
Parameters
System.IO.Stream
strmResponse
The stream containing the response. |
System.String
sOptionalContentTypeHint
|
Returns
System.Boolean
True if the Stream was successfully loaded. |
PoisonClientPipe()
Ensures that, after the response is complete, the client socket is closed and not reused. Does NOT (and must not) close the pipe.
Declaration
public void PoisonClientPipe()
PoisonServerPipe()
Prevents the server pipe from this session from being pooled for reuse
Declaration
public void PoisonServerPipe()
SaveMetadata(String)
Writes this session's metadata to a file.
Declaration
public bool SaveMetadata(string sFilename)
Parameters
System.String
sFilename
The name of the file to which the metadata should be saved in XML format. |
Returns
System.Boolean
True if the file was successfully written. |
SaveRequest(String, Boolean)
Save the request to a file. The headers' Request Line will not contain the scheme or host, which is probably not what you want.
Declaration
public void SaveRequest(string sFilename, bool bHeadersOnly)
Parameters
System.String
sFilename
The name of the file to which the request should be saved. |
System.Boolean
bHeadersOnly
TRUE to save only the headers |
SaveRequest(String, Boolean, Boolean)
Save the request to a file. Throws if file cannot be written.
Declaration
public void SaveRequest(string sFilename, bool bHeadersOnly, bool bIncludeSchemeAndHostInPath)
Parameters
System.String
sFilename
The name of the file to which the request should be saved. |
System.Boolean
bHeadersOnly
TRUE to save only the headers. |
System.Boolean
bIncludeSchemeAndHostInPath
TRUE to include the Scheme and Host in the Request Line. |
SaveRequestBody(String)
Save the request body to a file. You likely want to call utilDecodeRequest first.
Declaration
[CodeDescription("Save HTTP request body to specified location.")]
public bool SaveRequestBody(string sFilename)
Parameters
System.String
sFilename
The name of the file to which the request body should be saved. |
Returns
System.Boolean
True if the file was successfully written. |
SaveResponse(String, Boolean)
Saves the response (headers and body) to a file
Declaration
public void SaveResponse(string sFilename, bool bHeadersOnly)
Parameters
System.String
sFilename
The File to write |
System.Boolean
bHeadersOnly
TRUE if only heaers should be written |
SaveResponseBody()
Save HTTP response body to Fiddler Captures folder. You likely want to call utilDecodeResponse first.
Declaration
[CodeDescription("Save HTTP response body to Fiddler Captures folder.")]
public bool SaveResponseBody()
Returns
System.Boolean
True if the response body was successfully saved |
SaveResponseBody(String)
Save HTTP response body to specified location. You likely want to call utilDecodeResponse first.
Declaration
[CodeDescription("Save HTTP response body to specified location.")]
public bool SaveResponseBody(string sFilename)
Parameters
System.String
sFilename
The name of the file to which the response body should be saved. |
Returns
System.Boolean
True if the file was successfully written. |
SaveSession(String, Boolean)
Save the request and response to a single file.
Declaration
public void SaveSession(string sFilename, bool bHeadersOnly)
Parameters
System.String
sFilename
The filename to which the session should be saved. |
System.Boolean
bHeadersOnly
TRUE if only the headers should be written. |
ThreadResume()
This method resumes the Session's thread in response to "Continue" commands from the UI
Declaration
public void ThreadResume()
ToHTMLFragment(Boolean)
Returns HTML representing the Session. Call Utilities.StringToCF_HTML on the result of this function before placing it on the clipboard.
Declaration
public string ToHTMLFragment(bool HeadersOnly)
Parameters
System.Boolean
HeadersOnly
TRUE if only the headers should be copied. |
Returns
System.String
A HTML-formatted fragment representing the current session. |
ToString()
Store this session's request and response to a string.
Declaration
public override string ToString()
Returns
System.String
A string containing the content of the request and response. |
Overrides
ToString(Boolean)
Store this session's request and response to a string.
Declaration
public string ToString(bool HeadersOnly)
Parameters
System.Boolean
HeadersOnly
If true, return only the request and response headers |
Returns
System.String
String representing this session |
UNSTABLE_SetBitFlag(SessionFlags, Boolean)
DO NOT USE. TEMPORARY WHILE REFACTORING VISIBILITY OF MEMBERS
Declaration
public void UNSTABLE_SetBitFlag(SessionFlags FlagsToSet, bool b)
Parameters
SessionFlags
FlagsToSet
|
System.Boolean
b
|
uriContains(String)
Returns true if the absolute request URI contains the specified string. Case-insensitive.
Declaration
[CodeDescription("Returns true if request URI contains the specified string. Case-insensitive.")]
public bool uriContains(string sLookfor)
Parameters
System.String
sLookfor
Case-insensitive string to find |
Returns
System.Boolean
TRUE if the URI contains the string |
utilAssignResponse(HTTPResponseHeaders, Byte[])
Declaration
[CodeDescription("Copy an existing response to this Session, bypassing the server if not already contacted")]
public void utilAssignResponse(HTTPResponseHeaders oRH, byte[] arrBody)
Parameters
HTTPResponseHeaders
oRH
|
System.Byte[]
arrBody
|
utilAssignResponse(Session)
Declaration
[CodeDescription("Copy an existing Session's response to this Session, bypassing the server if not already contacted")]
public void utilAssignResponse(Session oFromSession)
Parameters
Session
oFromSession
|
utilBZIP2Response()
Use BZIP2 to compress the response body. Throws exceptions to caller.
Declaration
[CodeDescription("Use BZIP2 to compress the response body. Throws exceptions to caller.")]
public bool utilBZIP2Response()
Returns
System.Boolean
TRUE if compression succeeded |
utilChunkResponse(Int32)
Introduces HTTP Chunked encoding on the response body
Declaration
[CodeDescription("Apply Transfer-Encoding: chunked to the response, if possible.")]
public bool utilChunkResponse(int iSuggestedChunkCount)
Parameters
System.Int32
iSuggestedChunkCount
The number of chunks to try to create |
Returns
System.Boolean
TRUE if the chunking could be performed. |
utilCreateResponseAndBypassServer()
Call inside OnBeforeRequest to create a response object and bypass the server.
Declaration
[CodeDescription("Call inside OnBeforeRequest to create a Response object and bypass the server.")]
public void utilCreateResponseAndBypassServer()
utilDecodeRequest()
Removes chunking and HTTP Compression from the Request. Adds or updates Content-Length header.
Declaration
[CodeDescription("Removes chunking and HTTP Compression from the Request. Adds or updates Content-Length header.")]
public bool utilDecodeRequest()
Returns
System.Boolean
Returns TRUE if the request was decoded; returns FALSE on failure, or if request didn't have headers that showed encoding. |
utilDecodeRequest(Boolean)
Declaration
public bool utilDecodeRequest(bool bSilent)
Parameters
System.Boolean
bSilent
|
Returns
System.Boolean
|
utilDecodeResponse()
Removes chunking and HTTP Compression from the Response. Adds or updates Content-Length header.
Declaration
[CodeDescription("Removes chunking and HTTP Compression from the response. Adds or updates Content-Length header.")]
public bool utilDecodeResponse()
Returns
System.Boolean
Returns TRUE if the response was decoded; returns FALSE on failure, or if response didn't have headers that showed encoding. |
utilDecodeResponse(Boolean)
Removes chunking and HTTP Compression from the Response. Adds or updates Content-Length header.
Declaration
public bool utilDecodeResponse(bool bSilent)
Parameters
System.Boolean
bSilent
TRUE if error messages should be suppressed. False otherwise. |
Returns
System.Boolean
TRUE if the decoding was successsful. |
utilDeflateResponse()
Use DEFLATE to compress the response body. Throws exceptions to caller.
Declaration
[CodeDescription("Use DEFLATE to compress the response body. Throws exceptions to caller.")]
public bool utilDeflateResponse()
Returns
System.Boolean
TRUE if compression succeeded |
utilFindInRequest(String, Boolean)
Find a string in the request body. Return its index, or -1.
Declaration
[CodeDescription("Find a string in the request body. Return its index or -1.")]
public int utilFindInRequest(string sSearchFor, bool bCaseSensitive)
Parameters
System.String
sSearchFor
Term to search for |
System.Boolean
bCaseSensitive
Require case-sensitive match? |
Returns
System.Int32
Location of sSearchFor,or -1 |
utilFindInResponse(String, Boolean)
Find a string in the response body. Return its index, or -1.
Declaration
[CodeDescription("Find a string in the response body. Return its index or -1. Note, you should call utilDecodeResponse first!")]
public int utilFindInResponse(string sSearchFor, bool bCaseSensitive)
Parameters
System.String
sSearchFor
Term to search for |
System.Boolean
bCaseSensitive
Require case-sensitive match? |
Returns
System.Int32
Location of sSearchFor,or -1 |
utilGZIPRequest()
Use GZIP to compress the request body. Throws exceptions to caller.
Declaration
[CodeDescription("Use GZIP to compress the request body. Throws exceptions to caller.")]
public bool utilGZIPRequest()
Returns
System.Boolean
TRUE if compression succeeded |
utilGZIPResponse()
Use GZIP to compress the response body. Throws exceptions to caller.
Declaration
[CodeDescription("Use GZIP to compress the response body. Throws exceptions to caller.")]
public bool utilGZIPResponse()
Returns
System.Boolean
TRUE if compression succeeded |
utilPrependToResponseBody(String)
Add a string to the top of the response body, updating Content-Length. (Call utilDecodeResponse first!)
Declaration
[CodeDescription("Prepend a string to the response body. Updates Content-Length header. Note, you should call utilDecodeResponse first!")]
public void utilPrependToResponseBody(string sString)
Parameters
System.String
sString
The string to prepend |
utilReplaceInRequest(String, String)
Perform a string replacement on the request body. Adjusts the Content-Length header if needed.
Declaration
[CodeDescription("Perform a case-sensitive string replacement on the request body (not URL!). Updates Content-Length header. Returns TRUE if replacements occur.")]
public bool utilReplaceInRequest(string sSearchFor, string sReplaceWith)
Parameters
System.String
sSearchFor
The case-sensitive string to search for. |
System.String
sReplaceWith
The text to replace. |
Returns
System.Boolean
TRUE if one or more replacements occurred. |
utilReplaceInResponse(String, String)
Perform a string replacement on the response body (potentially multiple times). Adjust the Content-Length header if needed.
Declaration
[CodeDescription("Perform a case-sensitive string replacement on the response body. Updates Content-Length header. Note, you should call utilDecodeResponse first! Returns TRUE if replacements occur.")]
public bool utilReplaceInResponse(string sSearchFor, string sReplaceWith)
Parameters
System.String
sSearchFor
String to find (case-sensitive) |
System.String
sReplaceWith
String to use to replace |
Returns
System.Boolean
TRUE if replacements occurred |
utilReplaceOnceInResponse(String, String, Boolean)
Perform a one-time string replacement on the response body. Adjust the Content-Length header if needed.
Declaration
[CodeDescription("Perform a single case-sensitive string replacement on the response body. Updates Content-Length header. Note, you should call utilDecodeResponse first! Returns TRUE if replacements occur.")]
public bool utilReplaceOnceInResponse(string sSearchFor, string sReplaceWith, bool bCaseSensitive)
Parameters
System.String
sSearchFor
String to find (case-sensitive) |
System.String
sReplaceWith
String to use to replace |
System.Boolean
bCaseSensitive
TRUE for Case-Sensitive |
Returns
System.Boolean
TRUE if a replacement occurred |
utilReplaceRegexInResponse(String, String)
Perform a regex-based string replacement on the response body. Adjusts the Content-Length header if needed.
Declaration
[CodeDescription("Perform a regex-based replacement on the response body. Specify RegEx Options via leading Inline Flags, e.g. (?im) for case-Insensitive Multi-line. Updates Content-Length header. Note, you should call utilDecodeResponse first! Returns TRUE if replacements occur.")]
public bool utilReplaceRegexInResponse(string sSearchForRegEx, string sReplaceWithExpression)
Parameters
System.String
sSearchForRegEx
The regular expression used to search the body. Specify RegEx Options via leading Inline Flags, e.g. (?im) for case-Insensitive Multi-line. |
System.String
sReplaceWithExpression
The text or expression used to replace |
Returns
System.Boolean
TRUE if replacements occured |
utilSetRequestBody(String)
Replaces the request body with sString. Sets Content-Length header and removes Transfer-Encoding/Content-Encoding.
Declaration
[CodeDescription("Replaces the request body with sString. Sets Content-Length header & removes Transfer-Encoding/Content-Encoding")]
public void utilSetRequestBody(string sString)
Parameters
System.String
sString
The desired request Body as a string |
utilSetResponseBody(String)
Replaces the response body with sString. Sets Content-Length header and removes Transfer-Encoding/Content-Encoding
Declaration
[CodeDescription("Replaces the response body with sString. Sets Content-Length header & removes Transfer-Encoding/Content-Encoding")]
public void utilSetResponseBody(string sString)
Parameters
System.String
sString
The desired response Body as a string |
WriteMetadataToStream(Stream)
Write the metadata about this Session to a stream. The Stream is left open!
Declaration
public void WriteMetadataToStream(Stream strmMetadata)
Parameters
System.IO.Stream
strmMetadata
The Stream to write to |
WriteRequestToStream(Boolean, Boolean, Boolean, Stream)
Write the session's Request to the specified stream
Declaration
public bool WriteRequestToStream(bool bHeadersOnly, bool bIncludeProtocolAndHostWithPath, bool bEncodeIfBinary, Stream oFS)
Parameters
System.Boolean
bHeadersOnly
TRUE if only the headers should be be written |
System.Boolean
bIncludeProtocolAndHostWithPath
TRUE if the Scheme and Host should be written in the Request Line |
System.Boolean
bEncodeIfBinary
TRUE if binary bodies should be encoded in base64 for text-safe transport (e.g. used by Composer drag/drop) |
System.IO.Stream
oFS
The Stream to which the request should be written |
Returns
System.Boolean
True if the request was written to the stream. False if the request headers do not exist. Throws on other stream errors. |
WriteRequestToStream(Boolean, Boolean, Stream)
Write the session's Request to the specified stream
Declaration
public bool WriteRequestToStream(bool bHeadersOnly, bool bIncludeProtocolAndHostWithPath, Stream oFS)
Parameters
System.Boolean
bHeadersOnly
TRUE if only the headers should be be written |
System.Boolean
bIncludeProtocolAndHostWithPath
TRUE if the Scheme and Host should be written in the Request Line |
System.IO.Stream
oFS
The Stream to which the request should be written |
Returns
System.Boolean
True if the request was written to the stream. False if the request headers do not exist. Throws on other stream errors. |
WriteResponseToStream(Stream, Boolean)
Write the session's Response to the specified stream
Declaration
public bool WriteResponseToStream(Stream oFS, bool bHeadersOnly)
Parameters
System.IO.Stream
oFS
The stream to which the response should be written |
System.Boolean
bHeadersOnly
TRUE if only the headers should be written |
Returns
System.Boolean
TRUE if the response was written to the stream. False if the response headers do not exist. Throws on other stream errors. |
WriteToStream(Stream, Boolean)
Write the session to the specified stream
Declaration
[CodeDescription("Write the session (or session headers) to the specified stream")]
public bool WriteToStream(Stream oFS, bool bHeadersOnly)
Parameters
System.IO.Stream
oFS
The stream to which the session should be written |
System.Boolean
bHeadersOnly
TRUE if only the request and response headers should be written |
Returns
System.Boolean
False on any exceptions; True otherwise |
Events
OnCompleteTransaction
Declaration
public event EventHandler<EventArgs> OnCompleteTransaction
Event Type
System.EventHandler<System.EventArgs>
|
OnContinueTransaction
This event fires if this Session automatically yields a new one, for instance, if Fiddler is configured to automatically follow redirects or perform multi-leg authentication (X-AutoAuth).
Declaration
public event EventHandler<ContinueTransactionEventArgs> OnContinueTransaction
Event Type
System.EventHandler<ContinueTransactionEventArgs>
|
OnStateChanged
This event fires at any time the session's State changes. Use with caution due to the potential for performance impact.
Declaration
public event EventHandler<StateChangeEventArgs> OnStateChanged
Event Type
System.EventHandler<StateChangeEventArgs>
|
SessionCreated
This event fires when new session is created.
Declaration
public static event EventHandler<Session> SessionCreated
Event Type
System.EventHandler<Session>
|