Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The parameter HTTPc_PARAM_TYPE_REQ_HDR_HOOK must be set up using the function HTTPc_ReqSetParam() for the hook function to be called.

Prototype

Code Block
          CPU_BOOLEAN  HTTPc_ReqHdrHook (HTTPc_CONN_OBJ   *p_conn_obj,
                                         HTTPc_REQ_OBJ    *p_req_obj,
                                         HTTP_HDR        **p_hdr);

Arguments

...

Example Template

Code Block
languagecpp
titleListing - Request Header Callback Function Example Code
linenumberstrue
#define  HTTPc_HDR_VAL_LEN_MAX          10

HTTPc_HDR  HTTPc_ReqHdr;
CPU_CHAR   HTTPc_ReqHdrValStr[HTTPc_HDR_VAL_LEN_MAX];


static  CPU_BOOLEAN  HTTPc_ReqHdrHook (HTTPc_CONN_OBJ   *p_conn,
                                       HTTPc_REQ_OBJ    *p_req,
                                       HTTPc_HDR       **p_hdr)
{
	HTTPc_HDR  *p_hdr_tmp;


    p_hdr_tmp         = &HTTPc_ReqHdr;
    p_hdr_tmp->ValPtr = &HTTPc_ReqHdrValStr[0];

    p_hdr_tmp->HdrField = HTTP_HDR_FIELD_COOKIE;
    Str_Copy_N(p_hdr_tmp->ValPtr, "ID=234668", HTTPc_HDR_VAL_LEN_MAX);
    p_hdr_tmp->ValLen   = Str_Len_N(p_hdr_tmp->ValPtr, HTTPc_HDR_VAL_LEN_MAX);

   *p_hdr = p_hdr_tmp;

    return (DEF_YES);
}

...