Class
HTTPResponseHeaders

HTTP Response headers object

Definition

Namespace:Fiddler

Assembly:FiddlerCore.dll

Syntax:

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

Inheritance: objectHTTPHeadersHTTPResponseHeaders

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

HTTPResponseHeaders()

Constructor for HTTP Response headers object

Declaration

cs-api-definition
public HTTPResponseHeaders()

HTTPResponseHeaders(Encoding)

Constructor for HTTP Response headers object

Declaration

cs-api-definition
public HTTPResponseHeaders(Encoding encodingForHeaders)

Parameters

encodingForHeaders

Encoding

Text encoding to be used for this set of Headers when converting to a byte array

HTTPResponseHeaders(int, string, string[])

This method overload allows script to easily generate headers like so: var oRH: HTTPResponseHeaders = new HTTPResponseHeaders(200, "Ok", ['Content-Type: foo', 'Blarg: Baz']);

Declaration

cs-api-definition
public HTTPResponseHeaders(int iStatusCode, string sStatusText, string[] sHeaders)

Parameters

iStatusCode

int

The response status code number

sStatusText

string

The response status code text

sHeaders

string[]

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

HTTPResponseHeaders(int, string[])

This method overload allows script to easily generate headers like so: var oRH: HTTPResponseHeaders = new HTTPResponseHeaders(200, ['Content-Type: foo', 'Blarg: Baz']);

Declaration

cs-api-definition
public HTTPResponseHeaders(int iStatus, string[] sHeaders)

Parameters

iStatus

int

The response status code number

sHeaders

string[]

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

Fields

HTTPResponseCode

Status code from HTTP Response. If setting, also set HTTPResponseStatus too!

Declaration

cs-api-definition
[CodeDescription("Status code from HTTP Response. Call SetStatus() instead of manipulating directly.")]
public int HTTPResponseCode

Field Value

int

HTTPResponseStatus

Code AND Description of Response Status (e.g. '200 OK').

Declaration

cs-api-definition
[CodeDescription("Status text from HTTP Response (e.g. '200 OK'). Call SetStatus() instead of manipulating directly.")]
public string HTTPResponseStatus

Field Value

string

Properties

IsTrailers

Gets or sets a value indicating whether the object represents Response Headers or Response Trailers (GRPC)

Declaration

cs-api-definition
public bool IsTrailers { get; set; }

Property Value

bool

StatusDescription

Gets or sets the text associated with the response code (e.g. "OK", "Not Found", etc)

Declaration

cs-api-definition
public string StatusDescription { get; set; }

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 Response 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()

Clone this HTTPResponseHeaders object and return the result cast to an Object

Declaration

cs-api-definition
public object Clone()

Returns

object

The new response headers object, cast to an object

Implements ICloneable.Clone()

FromHttp2HeaderFields(List<HeaderField>)

Transforms a list of HTTP2 header fields into a HTTPResponseHeaders object

Declaration

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

Parameters

headerList

List<HeaderField>

The list of HTTP2 header fields

Returns

HTTPResponseHeaders

A HTTPResponseHeaders object or null if the header list was empty

FromHttp2Response(BasePipe, ArraySegment<byte>, uint)

Transforms a binary HTTP2 request/response headers into a string

Declaration

cs-api-definition
public static HTTPResponseHeaders FromHttp2Response(BasePipe pipe, ArraySegment<byte> arrResponse, uint streamId)

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)

Returns

HTTPResponseHeaders

GetEnumerator()

Protect your enumeration using GetReaderLock

Declaration

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

Returns

IEnumerator<HTTPHeaderItem>

Implements IEnumerable<HTTPHeaderItem>.GetEnumerator()

ParseHttp2List(HTTPResponseHeaders, List<HeaderField>)

Parse a list of response headers from HeaderField objects

Declaration

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

Parameters

headers

HTTPResponseHeaders

The response headers object

headerFields

List<HeaderField>

The list of header fields to parse

SetStatus(int, string)

Update the response status code and text

Declaration

cs-api-definition
public void SetStatus(int iCode, string sDescription)

Parameters

iCode

int

HTTP Status code (e.g. 401)

sDescription

string

HTTP Status text (e.g. "Access Denied")

ToByteArray(bool, bool)

Returns a byte array representing the HTTP headers.

Declaration

cs-api-definition
[CodeDescription("Returns a byte[] representing the HTTP headers.")]
public byte[] ToByteArray(bool prependStatusLine, bool appendEmptyLine)

Parameters

prependStatusLine

bool

TRUE if the response status line should be included

appendEmptyLine

bool

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

Returns

byte[]

Byte[] containing the headers

ToString()

Returns a string containing the http headers

Declaration

cs-api-definition
[CodeDescription("Returns a string containing the HTTP Response headers.")]
public override string ToString()

Returns

string

Returns a string containing http headers with a status line but no trailing CRLF

Overrides object.ToString()

ToString(bool, bool)

Returns a string containing http headers

Declaration

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

Parameters

prependStatusLine

bool

TRUE if the response status line should be included

appendEmptyLine

bool

TRUE if there should be a trailing CRLF included

Returns

string

String containing http headers