ClassHTTPRequestHeaders
HTTP Request headers object
Definition
Namespace:Fiddler
Assembly:FiddlerCore.dll
Syntax:
public class HTTPRequestHeaders : HTTPHeaders, ICloneable, IEnumerable<HTTPHeaderItem>, IEnumerable
Inheritance: objectHTTPHeadersHTTPRequestHeaders
Implements:
Inherited Members
Constructors
HTTPRequestHeaders()
Constructor for HTTP Request headers object
Declaration
public HTTPRequestHeaders()
HTTPRequestHeaders(Encoding)
Constructor for HTTP Request headers object
Declaration
public HTTPRequestHeaders(Encoding encodingForHeaders)
Parameters
encodingForHeaders
Text encoding to be used for this set of Headers when converting to a byte array
HTTPRequestHeaders(string, string[])
This method overload allows script to easily generate headers like so: var oRH: HTTPRequestHeaders = new HTTPRequestHeaders("/clipboard.json", ['Content-Type: foo', 'Host: Baz.com']);
Fields
HTTPMethod
The HTTP Method (e.g. GET, POST, etc)
Declaration
[CodeDescription("HTTP Method or Verb from HTTP Request.")]
public string HTTPMethod
Field Value
Properties
RawPath
Get or set the request path as a byte array
Declaration
[CodeDescription("Byte array representing the HTTP Request path.")]
public byte[] RawPath { get; set; }
Property Value
byte[]
RequestPath
Get or set the request path as a string
Declaration
[CodeDescription("String representing the HTTP Request path, e.g. '/path.htm'.")]
public string RequestPath { get; set; }
Property Value
UriScheme
The (lowercased) URI scheme for this request (https, http, or ftp)
Declaration
[CodeDescription("URI Scheme for this HTTP Request; usually 'http' or 'https'")]
public string UriScheme { get; set; }
Property Value
UriUserInfo
Username:Password info for FTP URLs. (either null or "user:pass@") (Note: It's silly that this contains a trailing @, but whatever...)
Declaration
[CodeDescription("For FTP URLs, returns either null or user:pass@")]
public string UriUserInfo { get; }
Property Value
Methods
AssignFromString(string)
Parses a string and assigns the headers parsed to this object
Declaration
[CodeDescription("Replaces the current Request header set using a string representing the new HTTP headers.")]
public override bool AssignFromString(string sHeaders)
Parameters
sHeaders
The header string
Returns
TRUE if the operation succeeded, false otherwise
Overrides
ByteCount()
Get byte count of this HTTP header instance when exported to a HTTP/1.1 headers string
Clone()
Clones the HTTP request headers
Declaration
public object Clone()
Returns
The new HTTPRequestHeaders object, cast to an object
Implements
FromHttp2HeaderFields(List<HeaderField>)
Transforms a list of HTTP2 header fields into a HTTPRequestHeaders object
Declaration
public static HTTPRequestHeaders FromHttp2HeaderFields(List<HeaderField> headerList)
Parameters
headerList
List<HeaderField>
The list of header fields
Returns
a HTTPRequestHeaders object with the parsed headers, or null if no headers in the list
FromHttp2Request(BasePipe, ArraySegment<byte>, uint, bool)
Transforms a binary HTTP2 request headers into a string
Declaration
public static HTTPRequestHeaders FromHttp2Request(BasePipe pipe, ArraySegment<byte> arrResponse, uint streamId, bool useNewDecoder = false)
Parameters
pipe
The data pipe (used for HTTP2 settings and decoding header data)
arrResponse
Data containing the header frame(s)
streamId
The stream ID to use (if data contains multiple streams)
useNewDecoder
If true, a new HPACK decoder instance will be used (to prevent polluting the default decoder table).
Returns
a HTTPRequestHeaders object with the parsed headers, or null if no headers
GetEnumerator()
Warning: You should protect your enumeration using the GetReaderLock
Declaration
public IEnumerator<HTTPHeaderItem> GetEnumerator()
Returns
Implements
ParseHttp2List(HTTPRequestHeaders, List<HeaderField>)
Parse a list of request headers from HeaderField objects
Declaration
public static void ParseHttp2List(HTTPRequestHeaders headers, List<HeaderField> headerFields)
Parameters
headers
The request headers object
headerFields
List<HeaderField>
The list of header fields to parse
ToByteArray(bool, bool, bool)
Returns a byte array representing the HTTP headers.
Declaration
[CodeDescription("Returns current Request Headers as a byte array.")]
public byte[] ToByteArray(bool prependVerbLine, bool appendEmptyLine, bool includeProtocolInPath)
Parameters
prependVerbLine
TRUE if the HTTP REQUEST line (method+path+httpversion) should be included
appendEmptyLine
TRUE if there should be a trailing \r\n byte sequence included
includeProtocolInPath
TRUE if the SCHEME and HOST should be included in the HTTP REQUEST LINE
Returns
byte[]
The HTTP headers as a byte[]
ToByteArray(bool, bool, bool, string, bool)
Returns a byte array representing the HTTP headers.
Declaration
[CodeDescription("Returns current Request Headers as a byte array.")]
public byte[] ToByteArray(bool prependVerbLine, bool appendEmptyLine, bool includeProtocolInPath, string sVerbLineHost, bool includePseudoHeaders = false)
Parameters
prependVerbLine
TRUE if the HTTP REQUEST line (method+path+httpversion) should be included
appendEmptyLine
TRUE if there should be a trailing \r\n byte sequence included
includeProtocolInPath
TRUE if the SCHEME and HOST should be included in the HTTP REQUEST LINE
sVerbLineHost
Only meaningful if prependVerbLine is TRUE, the host to use in the HTTP REQUEST LINE
includePseudoHeaders
If True, include the Pseudo Headers in result.
Returns
byte[]
The HTTP headers as a byte[]
ToString()
Returns a string representing the HTTP headers, without the SCHEME+HOST in the HTTP request line, and no trailing CRLF
Declaration
[CodeDescription("Returns a string representing the HTTP Request.")]
public override string ToString()
Returns
The header string
Overrides
ToString(bool, bool)
Returns a string representing the HTTP headers, without the SCHEME+HOST in the HTTP REQUEST line
Declaration
[CodeDescription("Returns a string representing the HTTP Request.")]
public string ToString(bool prependVerbLine, bool appendEmptyLine)
Parameters
prependVerbLine
TRUE if the HTTP REQUEST line (method+path+httpversion) should be included
appendEmptyLine
TRUE if there should be a trailing CRLF sequence included
Returns
The header string
ToString(bool, bool, bool, bool)
Returns a string representing the HTTP headers.
Declaration
[CodeDescription("Returns current Request Headers as a string.")]
public string ToString(bool prependVerbLine, bool appendEmptyLine, bool includeProtocolAndHostInPath, bool includePseudoHeaders = false)
Parameters
prependVerbLine
TRUE if the HTTP REQUEST line (method+path+httpversion) should be included
appendEmptyLine
TRUE if there should be a trailing CRLF sequence included
includeProtocolAndHostInPath
TRUE if the SCHEME and HOST should be included in the HTTP REQUEST LINE (Automatically set to FALSE for CONNECT requests)
includePseudoHeaders
If True, include the Pseudo Headers in result.
Returns
The HTTP headers as a string.