Receive Request Header Field
This hook function, if defined, is called by μC/HTTP-server during the parsing of request message as shown in the figure Hook Functions. It allows the upper application to choose which header field must be stored to be read and use later in other hook functions.
Prototype
void HTTPs_ReqHdrRxHook (const HTTPs_INSTANCE *p_instance, const HTTPs_CONN *p_conn, const void *p_hook_cfg, HTTP_HDR_FIELD hdr_field);
Arguments
p_instance
Pointer to the instance structure (read only).
p_conn
Pointer to the connection structure (read only).
p_hook_cfg
Pointer to hook application data.
hdr_field
Header field type received.
Return Values
DEF_YES
The header field must be processed and the value stored.
DEF_NO
The header field must be discarded.
Required Configuration
HTTPs_CFG_HDR_EN
configuration must be enabled in http-s_cfg.h. See section Module Configuration.
The header feature must also be enabled in the Instance configuration (see section Instance Parameters Configuration).
See section Hook Configuration.
Notes / Warnings
- The instance structure is for read-only. It must not be modified.
- Connection structure should not be modified by this function it should be only read to determine if the header type must be stored.
Example Template
The listing bellow is shown to demonstrate the µC/HTTP-server module capabilities. That code simply make sure that cookies header are stored.
static CPU_BOOLEAN HTTPs_ReqHdrRxHook (const HTTPs_INSTANCE *p_instance, const HTTPs_CONN *p_conn, const void *p_hook_cfg, HTTP_HDR_FIELD hdr_field) { switch (hdr_field) { case HTTPs_HDR_FIELD_COOKIE: case HTTPs_HDR_FIELD_COOKIE2: return(DEF_YES); default: return(DEF_NO); } return (DEF_NO); }