Class
HTTPRequestHeaders

HTTP Request headers object

Definition

Namespace:Fiddler

Assembly:FiddlerCore.dll

Syntax:

cs-api-definition
public class HTTPRequestHeaders : HTTPHeaders, ICloneable, IEnumerable<HTTPHeaderItem>, IEnumerable

Inheritance: objectHTTPHeadersHTTPRequestHeaders

Implements: ICloneableIEnumerableIEnumerable<HTTPHeaderItem>

Inherited Members HTTPHeaders._HeaderEncodingHTTPHeaders.HTTPVersionHTTPHeaders.storageHTTPHeaders.GetReaderLock()HTTPHeaders.FreeReaderLock()HTTPHeaders.GetWriterLock()HTTPHeaders.FreeWriterLock()HTTPHeaders.Count()HTTPHeaders.FindAll(string)HTTPHeaders.ToArray()HTTPHeaders.SortAscByKeyAndValue()HTTPHeaders.FilterByHeaderName(string[])HTTPHeaders.AllValues(string)HTTPHeaders.CountOf(string)HTTPHeaders.Add(string, string)HTTPHeaders.AddPseudoHeader(string, string)HTTPHeaders.Add(string, string, bool)HTTPHeaders.AddRange(IEnumerable<HTTPHeaderItem>)HTTPHeaders.GetTokenValue(string, string)HTTPHeaders.Exists(string)HTTPHeaders.ExistsAny(IEnumerable<string>)HTTPHeaders.ExistsAndContains(string, string)HTTPHeaders.ExistsAndEquals(string, string, bool)HTTPHeaders.Remove(string)HTTPHeaders.RemoveRange(string[])HTTPHeaders.Remove(HTTPHeaderItem)HTTPHeaders.RemoveAll()HTTPHeaders.RenameHeaderItems(string, string)HTTPHeaders.FromHeadersFrame(BasePipe, ArraySegment<byte>, uint, bool)HTTPHeaders.EscapeHeader(string, bool)HTTPHeaders.this[string]HTTPHeaders.this[int]object.GetType()object.MemberwiseClone()object.Equals(object)object.Equals(object, object)object.ReferenceEquals(object, object)object.GetHashCode()

Constructors

HTTPRequestHeaders()

Constructor for HTTP Request headers object

Declaration

cs-api-definition
public HTTPRequestHeaders()

HTTPRequestHeaders(Encoding)

Constructor for HTTP Request headers object

Declaration

cs-api-definition
public HTTPRequestHeaders(Encoding encodingForHeaders)

Parameters

encodingForHeaders

Encoding

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']);

Declaration

cs-api-definition
public HTTPRequestHeaders(string sPath, string[] sHeaders)

Parameters

sPath

string

The request path

sHeaders

string[]

A list of string headers in the format "name: value"

Fields

HTTPMethod

The HTTP Method (e.g. GET, POST, etc)

Declaration

cs-api-definition
[CodeDescription("HTTP Method or Verb from HTTP Request.")]
public string HTTPMethod

Field Value

string

Properties

RawPath

Get or set the request path as a byte array

Declaration

cs-api-definition
[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

cs-api-definition
[CodeDescription("String representing the HTTP Request path, e.g. '/path.htm'.")]
public string RequestPath { get; set; }

Property Value

string

UriScheme

The (lowercased) URI scheme for this request (https, http, or ftp)

Declaration

cs-api-definition
[CodeDescription("URI Scheme for this HTTP Request; usually 'http' or 'https'")]
public string UriScheme { get; set; }

Property Value

string

UriUserInfo

Username:Password info for FTP URLs. (either null or "user:pass@") (Note: It's silly that this contains a trailing @, but whatever...)

Declaration

cs-api-definition
[CodeDescription("For FTP URLs, returns either null or user:pass@")]
public string UriUserInfo { get; }

Property Value

string

Methods

AssignFromString(string)

Parses a string and assigns the headers parsed to this object

Declaration

cs-api-definition
[CodeDescription("Replaces the current Request header set using a string representing the new HTTP headers.")]
public override bool AssignFromString(string sHeaders)

Parameters

sHeaders

string

The header string

Returns

bool

TRUE if the operation succeeded, false otherwise

Overrides HTTPHeaders.AssignFromString(string)

ByteCount()

Get byte count of this HTTP header instance when exported to a HTTP/1.1 headers string

Declaration

cs-api-definition
public override int ByteCount()

Returns

int

Byte Count

Overrides HTTPHeaders.ByteCount()

Clone()

Clones the HTTP request headers

Declaration

cs-api-definition
public object Clone()

Returns

object

The new HTTPRequestHeaders object, cast to an object

Implements ICloneable.Clone()

FromHttp2HeaderFields(List<HeaderField>)

Transforms a list of HTTP2 header fields into a HTTPRequestHeaders object

Declaration

cs-api-definition
public static HTTPRequestHeaders FromHttp2HeaderFields(List<HeaderField> headerList)

Parameters

headerList

List<HeaderField>

The list of header fields

Returns

HTTPRequestHeaders

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

cs-api-definition
public static HTTPRequestHeaders FromHttp2Request(BasePipe pipe, ArraySegment<byte> arrResponse, uint streamId, bool useNewDecoder = false)

Parameters

pipe

BasePipe

The data pipe (used for HTTP2 settings and decoding header data)

arrResponse

ArraySegment<byte>

Data containing the header frame(s)

streamId

uint

The stream ID to use (if data contains multiple streams)

useNewDecoder

bool

If true, a new HPACK decoder instance will be used (to prevent polluting the default decoder table).

Returns

HTTPRequestHeaders

a HTTPRequestHeaders object with the parsed headers, or null if no headers

GetEnumerator()

Warning: You should protect your enumeration using the GetReaderLock

Declaration

cs-api-definition
public IEnumerator<HTTPHeaderItem> GetEnumerator()

Returns

IEnumerator<HTTPHeaderItem>

Implements IEnumerable<HTTPHeaderItem>.GetEnumerator()

ParseHttp2List(HTTPRequestHeaders, List<HeaderField>)

Parse a list of request headers from HeaderField objects

Declaration

cs-api-definition
public static void ParseHttp2List(HTTPRequestHeaders headers, List<HeaderField> headerFields)

Parameters

headers

HTTPRequestHeaders

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

cs-api-definition
[CodeDescription("Returns current Request Headers as a byte array.")]
public byte[] ToByteArray(bool prependVerbLine, bool appendEmptyLine, bool includeProtocolInPath)

Parameters

prependVerbLine

bool

TRUE if the HTTP REQUEST line (method+path+httpversion) should be included

appendEmptyLine

bool

TRUE if there should be a trailing \r\n byte sequence included

includeProtocolInPath

bool

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

cs-api-definition
[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

bool

TRUE if the HTTP REQUEST line (method+path+httpversion) should be included

appendEmptyLine

bool

TRUE if there should be a trailing \r\n byte sequence included

includeProtocolInPath

bool

TRUE if the SCHEME and HOST should be included in the HTTP REQUEST LINE

sVerbLineHost

string

Only meaningful if prependVerbLine is TRUE, the host to use in the HTTP REQUEST LINE

includePseudoHeaders

bool

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

cs-api-definition
[CodeDescription("Returns a string representing the HTTP Request.")]
public override string ToString()

Returns

string

The header string

Overrides object.ToString()

ToString(bool, bool)

Returns a string representing the HTTP headers, without the SCHEME+HOST in the HTTP REQUEST line

Declaration

cs-api-definition
[CodeDescription("Returns a string representing the HTTP Request.")]
public string ToString(bool prependVerbLine, bool appendEmptyLine)

Parameters

prependVerbLine

bool

TRUE if the HTTP REQUEST line (method+path+httpversion) should be included

appendEmptyLine

bool

TRUE if there should be a trailing CRLF sequence included

Returns

string

The header string

ToString(bool, bool, bool, bool)

Returns a string representing the HTTP headers.

Declaration

cs-api-definition
[CodeDescription("Returns current Request Headers as a string.")]
public string ToString(bool prependVerbLine, bool appendEmptyLine, bool includeProtocolAndHostInPath, bool includePseudoHeaders = false)

Parameters

prependVerbLine

bool

TRUE if the HTTP REQUEST line (method+path+httpversion) should be included

appendEmptyLine

bool

TRUE if there should be a trailing CRLF sequence included

includeProtocolAndHostInPath

bool

TRUE if the SCHEME and HOST should be included in the HTTP REQUEST LINE (Automatically set to FALSE for CONNECT requests)

includePseudoHeaders

bool

If True, include the Pseudo Headers in result.

Returns

string

The HTTP headers as a string.