Versions Compared

Key

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

...

Code Block
languagecpp
titleListing - Header 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);
}

...