HttpHeaders

Overview

The HttpHeaders class provides access to a collection of HTTP headers represented by HttpHeader instances.

Location

  • Reference:
    • RemObjects.InternetPack.dll  .NET, .NET Core 5.0, .NET Standard 2.0
    • RemObjects.InternetPack.fx  Island
    • libRemObjects.InternetPack.fx  Toffee
  • Namespace: RemObjects.InternetPack.Http


 

constructor

Creates a new instance of the HttpHeaders class.

 

constructor

 

HttpHeaders()

 

init()

 

Sub New()

ContainsHeaderValue  virtual

Returns true if HTTP headers collection contains provided HTTP header.

 

method ContainsHeaderValue(key: String): Boolean

 

Boolean ContainsHeaderValue(String key)

 

func ContainsHeaderValue(_ key: String) -> Boolean

 

Function ContainsHeaderValue(key As String) As Boolean

Parameters:

  • key: HTTP header name

ContentType  virtual

Gets or sets MIME content type.

 

property ContentType: nullable String read write;

 

String? ContentType { get; set; }

 

// .NET, .NET Core 5.0, .NET Standard 2.0, Island
var ContentType: String? { get{} set{} }
// Toffee
var ContentType: String { get{} set{} }

 

Property ContentType() As String?

Count  virtual

Gets the number of elements contained in the HTTP headers collection.

 

property Count: Int32 read;

 

Int32 Count { get; }

 

var Count: Int32 { get{} }

 

ReadOnly Property Count() As Int32

Create  virtual

Reads HTTP headers from the provided HTTP connection and creates a HttpHeaders instance containing these headers.

 

class method Create(connection: Connection): HttpHeaders

 

static HttpHeaders Create(Connection connection)

 

static func Create(_ connection: Connection) -> HttpHeaders

 

Shared Function Create(connection As Connection) As HttpHeaders

Parameters:

  • connection: HTTP connection

description  override Toffee

 

func description() -> NSString

FirstHeader  virtual

Gets or sets the first header in the headers collection. This header contains HTTP request or response information (f.e. HTTP method name, request path etc).

 

property FirstHeader: String read write;

 

String FirstHeader { get; set; }

 

var FirstHeader: String { get{} set{} }

 

Property FirstHeader() As String

GetHeaderValue  virtual

Gets the header associated with the specified name. If the header with requested name is not present in the internal collection then returns null.

 

method GetHeaderValue(name: String): String

 

String GetHeaderValue(String name)

 

func GetHeaderValue(_ name: String) -> String

 

Function GetHeaderValue(name As String) As String

Parameters:

  • name: HTTP header name

GetSequence  virtual

 

method GetSequence: not nullable IEnumerable<HttpHeader>

 

IEnumerable<HttpHeader>! GetSequence()

 

func GetSequence() -> INSFastEnumeration<HttpHeader>

 

Function GetSequence() As IEnumerable<HttpHeader>

Headers  virtual

 

property Headers: not nullable IEnumerable<HttpHeader> read;

 

IEnumerable<HttpHeader>! Headers { get; }

 

// .NET, .NET Core 5.0, .NET Standard 2.0, Island
var Headers: IEnumerable<HttpHeader> { get{} }
// Toffee
var Headers: INSFastEnumeration<HttpHeader> { get{} }

 

ReadOnly Property Headers() As IEnumerable<HttpHeader>

Host  virtual

 

property Host: nullable String read;

 

String? Host { get; }

 

// .NET, .NET Core 5.0, .NET Standard 2.0, Island
var Host: String? { get{} }
// Toffee
var Host: String { get{} }

 

ReadOnly Property Host() As String?

HttpCode  virtual

Gets HTTP status code.

 

property HttpCode: HttpStatusCode read write;

 

HttpStatusCode HttpCode { get; set; }

 

var HttpCode: HttpStatusCode { get{} set{} }

 

Property HttpCode() As HttpStatusCode

Initialize  protected virtual

Sets default values for properties MaxHeaderLines and MaxHeaderLinesEnabled.

 

method Initialize

 

void Initialize()

 

func Initialize()

 

Sub Initialize()

Keys  virtual

 

property Keys: not nullable IEnumerable<String> read;

 

IEnumerable<String>! Keys { get; }

 

// .NET, .NET Core 5.0, .NET Standard 2.0, Island
var Keys: IEnumerable<String> { get{} }
// Toffee
var Keys: INSFastEnumeration<String> { get{} }

 

ReadOnly Property Keys() As IEnumerable<String>

MaxHeaderLines  virtual

Gets or sets maximum HTTP header count allowed.

The default value is 100.

 

property MaxHeaderLines: Int32 read write;

 

Int32 MaxHeaderLines { get; set; }

 

var MaxHeaderLines: Int32 { get{} set{} }

 

Property MaxHeaderLines() As Int32

MaxHeaderLinesEnabled  virtual

Gets or sets flag indicating whether number of HTTP headers read should be limited by MaxHeaderLines.

The default value is true.

 

property MaxHeaderLinesEnabled: Boolean read write;

 

Boolean MaxHeaderLinesEnabled { get; set; }

 

var MaxHeaderLinesEnabled: Boolean { get{} set{} }

 

Property MaxHeaderLinesEnabled() As Boolean

Mode  virtual

 

// .NET, .NET Core 5.0, .NET Standard 2.0
property Mode: nullable HttpRequestMethod read write;
// Island
property Mode: nullable HttpRequestMode read write;

 

// .NET, .NET Core 5.0, .NET Standard 2.0
HttpRequestMethod? Mode { get; set; }
// Island
HttpRequestMode? Mode { get; set; }

 

// .NET, .NET Core 5.0, .NET Standard 2.0
var Mode: HttpRequestMethod! { get{} set{} }
// Island, Toffee
var Mode: HttpRequestMode! { get{} set{} }

 

// .NET, .NET Core 5.0, .NET Standard 2.0
Property Mode() As HttpRequestMethod?
// Island
Property Mode() As HttpRequestMode?

ParseFirstLine  virtual

Parses first HTTP header in the collection and sets properties corresponding to it (f.e. RequestType, RequestPath and RequestVersion).

 

method ParseFirstLine

 

void ParseFirstLine()

 

func ParseFirstLine()

 

Sub ParseFirstLine()

ReadHeader  virtual

Reads HTTP headers collection from the provided HTTP connection.

 

method ReadHeader(connection: Connection): Boolean

 

Boolean ReadHeader(Connection connection)

 

func ReadHeader(_ connection: Connection) -> Boolean

 

Function ReadHeader(connection As Connection) As Boolean

Parameters:

  • connection: HTTP connection

RequestPath  virtual

Gets or sets the request URL, not including the server URL.

 

property RequestPath: String read write;

 

String RequestPath { get; set; }

 

var RequestPath: String { get{} set{} }

 

Property RequestPath() As String

RequestType  virtual

Gets or sets the method of the HTTP request, f.e. GET or POST.

 

property RequestType: String read write;

 

String RequestType { get; set; }

 

var RequestType: String { get{} set{} }

 

Property RequestType() As String

RequestVersion  virtual

Gets or sets the HTTP protocol version.

 

property RequestVersion: String read write;

 

String RequestVersion { get; set; }

 

var RequestVersion: String { get{} set{} }

 

Property RequestVersion() As String

ResponseCode  virtual obsolete

Gets HTTP status code.

Note: This property is obsolete. Use the HttpCode property instead.

 

property ResponseCode: Int32 read write;

 

Int32 ResponseCode { get; set; }

 

var ResponseCode: Int32 { get{} set{} }

 

Property ResponseCode() As Int32

SetHeaderValue  virtual

Sets HTTP header value.

 

method SetHeaderValue(name: String; value: String)

 

void SetHeaderValue(String name, String value)

 

func SetHeaderValue(_ name: String, _ value: String)

 

Sub SetHeaderValue(name As String, value As String)

Parameters:

  • name: HTTP header name
  • value: HTTP header value

SetRequestHeader  virtual

Composes the 1st HTTP headers line based on the provided HTTP version, HTTP method and request path.

 

method SetRequestHeader(version: String; requestType: String; requestPath: String)

 

void SetRequestHeader(String version, String requestType, String requestPath)

 

func SetRequestHeader(_ version: String, _ requestType: String, _ requestPath: String)

 

Sub SetRequestHeader(version As String, requestType As String, requestPath As String)

Parameters:

  • version: HTTP version
  • requestType: HTTP method
  • requestPath: HTTP request path (w/o the server URL)

SetResponseHeader (String, Int32)  virtual obsolete

Composes the 1st HTTP headers line based on the provided HTTP version and HTTP response code.

 

method SetResponseHeader(version: String; code: Int32)

 

void SetResponseHeader(String version, Int32 code)

 

func SetResponseHeader(_ version: String, _ code: Int32)

 

Sub SetResponseHeader(version As String, code As Int32)

Parameters:

  • version: HTTP version
  • code: HTTP response code

SetResponseHeader (String, HttpStatusCode)  virtual

 

method SetResponseHeader(version: String; code: HttpStatusCode)

 

void SetResponseHeader(String version, HttpStatusCode code)

 

func SetResponseHeader(_ version: String, _ code: HttpStatusCode)

 

Sub SetResponseHeader(version As String, code As HttpStatusCode)

Parameters:

  • version:
  • code:

ToString  virtual

Converts HTTP headers collection to a string like

GET http://wiki.remobjects.com/wiki/HttpHeaders_Class HTTP/1.1 Host: wiki.remobjects.com Connection: keep-alive

 

method ToString: PlatformString

 

PlatformString ToString()

 

func ToString() -> String

 

Function ToString() As PlatformString

WriteHeader  virtual

Writes HTTP headers collection to the provided HTTP connection.

 

method WriteHeader(connection: Connection)

 

void WriteHeader(Connection connection)

 

func WriteHeader(_ connection: Connection)

 

Sub WriteHeader(connection As Connection)

Parameters:

  • connection: HTTP connection

 

ContentType  virtual

Gets or sets MIME content type.

 

property ContentType: nullable String read write;

 

String? ContentType { get; set; }

 

// .NET, .NET Core 5.0, .NET Standard 2.0, Island
var ContentType: String? { get{} set{} }
// Toffee
var ContentType: String { get{} set{} }

 

Property ContentType() As String?

Count  virtual

Gets the number of elements contained in the HTTP headers collection.

 

property Count: Int32 read;

 

Int32 Count { get; }

 

var Count: Int32 { get{} }

 

ReadOnly Property Count() As Int32

FirstHeader  virtual

Gets or sets the first header in the headers collection. This header contains HTTP request or response information (f.e. HTTP method name, request path etc).

 

property FirstHeader: String read write;

 

String FirstHeader { get; set; }

 

var FirstHeader: String { get{} set{} }

 

Property FirstHeader() As String

Headers  virtual

 

property Headers: not nullable IEnumerable<HttpHeader> read;

 

IEnumerable<HttpHeader>! Headers { get; }

 

// .NET, .NET Core 5.0, .NET Standard 2.0, Island
var Headers: IEnumerable<HttpHeader> { get{} }
// Toffee
var Headers: INSFastEnumeration<HttpHeader> { get{} }

 

ReadOnly Property Headers() As IEnumerable<HttpHeader>

Host  virtual

 

property Host: nullable String read;

 

String? Host { get; }

 

// .NET, .NET Core 5.0, .NET Standard 2.0, Island
var Host: String? { get{} }
// Toffee
var Host: String { get{} }

 

ReadOnly Property Host() As String?

HttpCode  virtual

Gets HTTP status code.

 

property HttpCode: HttpStatusCode read write;

 

HttpStatusCode HttpCode { get; set; }

 

var HttpCode: HttpStatusCode { get{} set{} }

 

Property HttpCode() As HttpStatusCode

Keys  virtual

 

property Keys: not nullable IEnumerable<String> read;

 

IEnumerable<String>! Keys { get; }

 

// .NET, .NET Core 5.0, .NET Standard 2.0, Island
var Keys: IEnumerable<String> { get{} }
// Toffee
var Keys: INSFastEnumeration<String> { get{} }

 

ReadOnly Property Keys() As IEnumerable<String>

MaxHeaderLines  virtual

Gets or sets maximum HTTP header count allowed.

The default value is 100.

 

property MaxHeaderLines: Int32 read write;

 

Int32 MaxHeaderLines { get; set; }

 

var MaxHeaderLines: Int32 { get{} set{} }

 

Property MaxHeaderLines() As Int32

MaxHeaderLinesEnabled  virtual

Gets or sets flag indicating whether number of HTTP headers read should be limited by MaxHeaderLines.

The default value is true.

 

property MaxHeaderLinesEnabled: Boolean read write;

 

Boolean MaxHeaderLinesEnabled { get; set; }

 

var MaxHeaderLinesEnabled: Boolean { get{} set{} }

 

Property MaxHeaderLinesEnabled() As Boolean

Mode  virtual

 

// .NET, .NET Core 5.0, .NET Standard 2.0
property Mode: nullable HttpRequestMethod read write;
// Island
property Mode: nullable HttpRequestMode read write;

 

// .NET, .NET Core 5.0, .NET Standard 2.0
HttpRequestMethod? Mode { get; set; }
// Island
HttpRequestMode? Mode { get; set; }

 

// .NET, .NET Core 5.0, .NET Standard 2.0
var Mode: HttpRequestMethod! { get{} set{} }
// Island, Toffee
var Mode: HttpRequestMode! { get{} set{} }

 

// .NET, .NET Core 5.0, .NET Standard 2.0
Property Mode() As HttpRequestMethod?
// Island
Property Mode() As HttpRequestMode?

RequestPath  virtual

Gets or sets the request URL, not including the server URL.

 

property RequestPath: String read write;

 

String RequestPath { get; set; }

 

var RequestPath: String { get{} set{} }

 

Property RequestPath() As String

RequestType  virtual

Gets or sets the method of the HTTP request, f.e. GET or POST.

 

property RequestType: String read write;

 

String RequestType { get; set; }

 

var RequestType: String { get{} set{} }

 

Property RequestType() As String

RequestVersion  virtual

Gets or sets the HTTP protocol version.

 

property RequestVersion: String read write;

 

String RequestVersion { get; set; }

 

var RequestVersion: String { get{} set{} }

 

Property RequestVersion() As String

ResponseCode  virtual obsolete

Gets HTTP status code.

Note: This property is obsolete. Use the HttpCode property instead.

 

property ResponseCode: Int32 read write;

 

Int32 ResponseCode { get; set; }

 

var ResponseCode: Int32 { get{} set{} }

 

Property ResponseCode() As Int32

 

Create  virtual

Reads HTTP headers from the provided HTTP connection and creates a HttpHeaders instance containing these headers.

 

class method Create(connection: Connection): HttpHeaders

 

static HttpHeaders Create(Connection connection)

 

static func Create(_ connection: Connection) -> HttpHeaders

 

Shared Function Create(connection As Connection) As HttpHeaders

Parameters:

  • connection: HTTP connection

 

constructor

Creates a new instance of the HttpHeaders class.

 

constructor

 

HttpHeaders()

 

init()

 

Sub New()

ContainsHeaderValue  virtual

Returns true if HTTP headers collection contains provided HTTP header.

 

method ContainsHeaderValue(key: String): Boolean

 

Boolean ContainsHeaderValue(String key)

 

func ContainsHeaderValue(_ key: String) -> Boolean

 

Function ContainsHeaderValue(key As String) As Boolean

Parameters:

  • key: HTTP header name

description  override Toffee

 

func description() -> NSString

GetHeaderValue  virtual

Gets the header associated with the specified name. If the header with requested name is not present in the internal collection then returns null.

 

method GetHeaderValue(name: String): String

 

String GetHeaderValue(String name)

 

func GetHeaderValue(_ name: String) -> String

 

Function GetHeaderValue(name As String) As String

Parameters:

  • name: HTTP header name

GetSequence  virtual

 

method GetSequence: not nullable IEnumerable<HttpHeader>

 

IEnumerable<HttpHeader>! GetSequence()

 

func GetSequence() -> INSFastEnumeration<HttpHeader>

 

Function GetSequence() As IEnumerable<HttpHeader>

Initialize  protected virtual

Sets default values for properties MaxHeaderLines and MaxHeaderLinesEnabled.

 

method Initialize

 

void Initialize()

 

func Initialize()

 

Sub Initialize()

ParseFirstLine  virtual

Parses first HTTP header in the collection and sets properties corresponding to it (f.e. RequestType, RequestPath and RequestVersion).

 

method ParseFirstLine

 

void ParseFirstLine()

 

func ParseFirstLine()

 

Sub ParseFirstLine()

ReadHeader  virtual

Reads HTTP headers collection from the provided HTTP connection.

 

method ReadHeader(connection: Connection): Boolean

 

Boolean ReadHeader(Connection connection)

 

func ReadHeader(_ connection: Connection) -> Boolean

 

Function ReadHeader(connection As Connection) As Boolean

Parameters:

  • connection: HTTP connection

SetHeaderValue  virtual

Sets HTTP header value.

 

method SetHeaderValue(name: String; value: String)

 

void SetHeaderValue(String name, String value)

 

func SetHeaderValue(_ name: String, _ value: String)

 

Sub SetHeaderValue(name As String, value As String)

Parameters:

  • name: HTTP header name
  • value: HTTP header value

SetRequestHeader  virtual

Composes the 1st HTTP headers line based on the provided HTTP version, HTTP method and request path.

 

method SetRequestHeader(version: String; requestType: String; requestPath: String)

 

void SetRequestHeader(String version, String requestType, String requestPath)

 

func SetRequestHeader(_ version: String, _ requestType: String, _ requestPath: String)

 

Sub SetRequestHeader(version As String, requestType As String, requestPath As String)

Parameters:

  • version: HTTP version
  • requestType: HTTP method
  • requestPath: HTTP request path (w/o the server URL)

SetResponseHeader (String, Int32)  virtual obsolete

Composes the 1st HTTP headers line based on the provided HTTP version and HTTP response code.

 

method SetResponseHeader(version: String; code: Int32)

 

void SetResponseHeader(String version, Int32 code)

 

func SetResponseHeader(_ version: String, _ code: Int32)

 

Sub SetResponseHeader(version As String, code As Int32)

Parameters:

  • version: HTTP version
  • code: HTTP response code

SetResponseHeader (String, HttpStatusCode)  virtual

 

method SetResponseHeader(version: String; code: HttpStatusCode)

 

void SetResponseHeader(String version, HttpStatusCode code)

 

func SetResponseHeader(_ version: String, _ code: HttpStatusCode)

 

Sub SetResponseHeader(version As String, code As HttpStatusCode)

Parameters:

  • version:
  • code:

ToString  virtual

Converts HTTP headers collection to a string like

GET http://wiki.remobjects.com/wiki/HttpHeaders_Class HTTP/1.1 Host: wiki.remobjects.com Connection: keep-alive

 

method ToString: PlatformString

 

PlatformString ToString()

 

func ToString() -> String

 

Function ToString() As PlatformString

WriteHeader  virtual

Writes HTTP headers collection to the provided HTTP connection.

 

method WriteHeader(connection: Connection)

 

void WriteHeader(Connection connection)

 

func WriteHeader(_ connection: Connection)

 

Sub WriteHeader(connection As Connection)

Parameters:

  • connection: HTTP connection