HTTP Header Configuration

HTTP headers can be added to HTTP request and response messages to specify additional parameters for the HTTP transaction. See section Headers for more details on HTTP headers.

µC/HTTP-server supports both reception and transmission of additional headers. However, notes that some header fields are already taken care of by the µC/HTTP-server stack and must therefore not be added by the application :

  • Host
  • Content-Type
  • Content-Length
  • Transfer-Encoding
  • Connection
  • Location

Two distinct structures are available to configure the request and response part. Therefore, header fields received have their own configuration as the headers fields to transmit in HTTP response. This allows more flexibility in customizing your own HTTP server application. For example your server can be more interested in receiving many headers from clients and not adding any headers of its own in HTTP response.

The Header configurations are part of the HTTP server Instance configuration and must be included in the HTTPs_CFG object (see section Parameters Configuration).

Header Configuration Structures

const  HTTPs_HDR_RX_CFG  HTTPs_HdrRxCfg = {
    15,										/* .NbrPerConnMax   */
    18										/* .DataLenMax		*/
};

const  HTTPs_HDR_TX_CFG  HTTPs_HdrTxCfg = {
    15,										/* .NbrPerConnMax   */
    18										/* .DataLenMax		*/
};


Fields Description

Structure FieldTypeDescriptionPossible Values
NbrPerConnMax
CPU_INT16UMaximum number of headers for each HTTP request or response.

SHOULD be >= 1
LIB_MEM_BLK_QTY_UNLIMITED to set an unlimited pool.

DataLenMax
CPU_INT16UMaximum length of the header field value accepted by the HTTP server.SHOULD be >= 1

Since the HTTP server only process an HTTP Transaction at a time on a given Connection, the NbrPerConnMax parameter set the number of headers available for an HTTP transaction and connection.