RHTTPHeaders Class Reference

class RHTTPHeaders

The collection of headers (or more correctly, header fields) associated with a message. Header (fields) can be created, read and modified. They may be composed of several parts (by repeated invocations of API methods, see below) and may be assigned one or more parameters. Individual field parts and parameters take values described using THTTPHdrVal. RHTTPMessage

THTTPHdrVal

Constructor & Destructor Documentation

RHTTPHeaders()

RHTTPHeaders()[inline]

Default constructor

Member Functions Documentation

FieldPartsL(RStringF)

IMPORT_C TIntFieldPartsL(RStringFaFieldName)const

Getter methods Methods for reading data. Obtain the number of parts in the named header field's value, Simple headers are created with a single part following one call to SetFieldL. Subsequent calls to SetFieldL create additional parts if the field exists already. leave

KErrNoMemory

The number of parts, or zero if the field does not exist.

Parameters

RStringF aFieldNameThe header name

Fields()

IMPORT_C THTTPHdrFieldIterFields()const

Access the fields within this header collection, via an iterator. Each application of the iterator returns the name of the next field type. This may then be accessed via RHTTPHeaders methods. The iterator.

GetField(RStringF, TInt, THTTPHdrVal &)

IMPORT_C TIntGetField(RStringFaFieldName,
TIntaPartIdx,
THTTPHdrVal &aHeaderValue
)const

Obtain the named header field's value. The index of a part within the field must be specified. Parts are indexed from 0 and fields with only one part return the entire field for index 0 An error condition. Returns KErrNotFound if there is not a field with the specifed field name

Parameters

RStringF aFieldNameThe header name
TInt aPartIdxThe index of the part
THTTPHdrVal & aHeaderValueThe header field value

GetParam(RStringF, RStringF, THTTPHdrVal &, TInt)

IMPORT_C TIntGetParam(RStringFaFieldName,
RStringFaParamName,
THTTPHdrVal &aReturn,
TIntaPartIdx = 0
)const

Obtain the value of a named parameter, associated with the named header field. An optional index to a part within the header field may be supplied, if not it is assumed that it is the first part. An error condition. Returns KErrNotFound if there is not a field with the specifed field name

Parameters

RStringF aFieldNameThe header name
RStringF aParamNameThe parameter name
THTTPHdrVal & aReturnThe returned value. Note that this must be Copy()d by the caller, if it wants to keep the value.
TInt aPartIdx = 0The optional index of the part

GetRawField(RStringF, TPtrC8 &)

IMPORT_C TIntGetRawField(RStringFaFieldName,
TPtrC8 &aRawFieldData
)const

Obtain an Raw representation of the named header field's value. Note that general client use of this method is strongly discouraged since it exposes the Raw representation of particular headers. However it may be needed for some cases where received headers could not be decoded by HTTP. It will normally be used internally when preparing header data to be transmitted with a request. Note that this API may not return the field values for all the headers. An error condition. Returns KErrNotFound if there is not a field with the specifed field name

Parameters

RStringF aFieldNameThe field name, e.g, 'Content-Type'
TPtrC8 & aRawFieldDataThe field's data content, in an appropriate Raw form

GetRawFieldL(RStringF, TPtrC8 &)

IMPORT_C voidGetRawFieldL(RStringFaFieldName,
TPtrC8 &aRawFieldData
)const

Parameters

RStringF aFieldName
TPtrC8 & aRawFieldData

RemoveAllFields()

IMPORT_C voidRemoveAllFields()

Remove all the fields of this header collection

RemoveField(RStringF)

IMPORT_C TIntRemoveField(RStringFaFieldName)

Remove, entirely, the named header field from the header collection. All its parts and associated parameters (where they exist) are also removed. KErrNone if the removal is successful; KErrNotFound if the field didn't exist within the headers.

Parameters

RStringF aFieldNameThe field name.

RemoveFieldPart(RStringF, TInt)

IMPORT_C TIntRemoveFieldPart(RStringFaFieldName,
TIntaIndex
)

Remove a single part of a header field. Just the part and any associated paramters are removed. If this results in no parts being present in the header then it will also be removed KErrNone if the removal is sucessful; KErrNotFound if the header didn't exist. No exception is raised if the particular value is not found as part of that header

Parameters

RStringF aFieldNameThe header name
TInt aIndexThe particular part of the field to be removed

SetField(RStringF, THTTPHdrVal)

IMPORT_C TIntSetField(RStringFaFieldName,
THTTPHdrValaFieldValue
)

Parameters

RStringF aFieldName
THTTPHdrVal aFieldValue

SetField(RStringF, THTTPHdrVal, RStringF, THTTPHdrVal)

IMPORT_C TIntSetField(RStringFaFieldName,
THTTPHdrValaFieldValue,
RStringFaParamName,
THTTPHdrValaParamValue
)

Parameters

RStringF aFieldName
THTTPHdrVal aFieldValue
RStringF aParamName
THTTPHdrVal aParamValue

SetFieldL(RStringF, THTTPHdrVal)

IMPORT_C voidSetFieldL(RStringFaFieldName,
THTTPHdrValaFieldValue
)

Setter Methods Methods for writing data. Set a named field in the header. On the first instance that this API method is used for a given field name, the first will be created. On subsequent calls, the same field will be extended to have several parts, with a new part created to hold the supplied value.

Parameters

RStringF aFieldNameThe field name, e.g, 'Content-Type'
THTTPHdrVal aFieldValueThe field value, e.g. 'text/html'

SetFieldL(RStringF, THTTPHdrVal, RStringF, THTTPHdrVal)

IMPORT_C voidSetFieldL(RStringFaFieldName,
THTTPHdrValaFieldValue,
RStringFaParamName,
THTTPHdrValaParamValue
)

Set a named field in the header, and associate with it the supplied parameter. If the field doesn't already exist it will be created along with a parameter; if it does exist, then a new part will be created along with the parameter.

Parameters

RStringF aFieldNameThe field name, e.g. 'Accept'
THTTPHdrVal aFieldValueThe field value. e.g. 'text/plain'
RStringF aParamNameThe parameter name, e.g. 'q'
THTTPHdrVal aParamValueThe parameter value, e.g. '0.3'

SetParamL(RStringF, RStringF, THTTPHdrVal, TInt)

IMPORT_C voidSetParamL(RStringFaFieldName,
RStringFaParamName,
THTTPHdrValaParamValue,
TIntaPartIdx
)

Set a parameter in an existing header. leave

KErrNotFoud if the field, or the part within the field doesn't exist

Parameters

RStringF aFieldNameThe field name, e.g. 'Accept'
RStringF aParamNameThe parameter name, e.g. 'q'
THTTPHdrVal aParamValueThe parameter value, e.g. '0.3'
TInt aPartIdxThe part of the header to add the parameter to

SetRawField(RStringF, const TDesC8 &, const TDesC8 &)

IMPORT_C TIntSetRawField(RStringFaFieldName,
const TDesC8 &aRawFieldData,
const TDesC8 &aFieldSeparator
)

Parameters

RStringF aFieldName
const TDesC8 & aRawFieldData
const TDesC8 & aFieldSeparator

SetRawFieldL(RStringF, const TDesC8 &, const TDesC8 &)

IMPORT_C voidSetRawFieldL(RStringFaFieldName,
const TDesC8 &aRawFieldData,
const TDesC8 &aFieldSeparator
)

Set a named field in the header to contain the supplied Raw header data. If the header already exists then a LF and the new data will be added to the existing data. This is used to indicate that there are multiple instances of this header

Note that general client use of this method is strongly discouraged since it exposes the raw representation of particular headers. However it may be needed for some cases where headers to be transmitted have no encoding known to HTTP. It will normally be used internally when receiving data from a service provider.

Parameters

RStringF aFieldNameThe field name, e.g, 'Content-Type'
const TDesC8 & aRawFieldDataThe field's data content, in a raw form
const TDesC8 & aFieldSeparatorThe header field separator

Member Data Documentation

CHeaders * iImplementation

CHeaders *iImplementation[private]