HTTPs_RespHdrGet

Acquire a new response header field block:

  • Acquire response header block.
  • Acquire data buffer block depending on the value data type.
  • Update response header block list.
  • Initialize header block parameters.

Files

http-s.h / http-s.c

Prototype

          HTTPs_HDR_BLK  HTTPs_RespHdrGet (const  HTTPs_INSTANCE      *p_instance,
                                                  HTTPs_CONN          *p_conn,
                                                  HTTP_HDR_FIELD       hdr_field
                                                  HTTPs_HDR_VAL_TYPE   val_type,
                                                  HTTPs_ERR           *p_err);


Arguments

p_instance

Pointer to the HTTP server instance structure.

p_conn

Pointer to the connection structure.

hdr_field

Type of the response header field:

See enumeration HTTP_HDR_FIELD in http.h.

val_type

Data type of the response header field value:

See enumeration HTTPs_HDR_VAL_TYPE in http-s.h.

p_err

Pointer to variable that will receive the return error code.

Returned values

Pointer to the response header field block, if no errors;

NULL pointer, otherwise.

Required Configuration

Available only if HTTPs_CFG_HDR_EN is enabled (see section Module Configuration).

Notes / Warnings

Must be called from a callback function only. Should be called by the function pointed by OnRespHdrTxHook in the Hook Configuration of the instance configuration. The instance lock must be acquired before calling this function. It is why this function must be called from a callback function.

The header block is automatically added to the header blocks list. Thus, the caller has not to add the block to the list. Only filling the value and value length should be required by the caller.

Example Usage

See hook function example, section Add Response Header Field.