HTTPs_RespBodySetParamStaticData
Set the parameters to specify some data in memory section as the body to the HTTP response to send.
This function will changed the following parameters of the HTTPs_CONN
structure object :
RespBodyDataType
RespContentType
DataPtr
DataLen
Flags
(theHTTPs_FLAG_RESP_CHUNKED
flag)
Files
http-s.h
/ http-s.c
Prototype
void HTTPs_RespBodySetParamStaticData (const HTTPs_INSTANCE *p_instance, HTTPs_CONN *p_conn, HTTP_CONTENT_TYPE content_type, void *p_data, CPU_INT32U data_len, CPU_BOOLEAN token_en, HTTPs_ERR *p_err);
Arguments
p_instance
Pointer to the HTTP server instance structure.
p_conn
Pointer to the connection structure.
content_type
Content type of the file. Unlike for a file, the Content Type MUST be set for static data.
See enumeration HTTP_CONTENT_TYPE
in http.h.
p_data
Pointer to the data that will be sent in the response body.
data_len
Length of the data.
token_en
DEF_YES
, if the file must be parse by the HTTP server for token to replace. The response body will be sent with the Chunked Transfer Encoding.DEF_NO
, otherwise. The response body will be sent the standard way (with the header Content-Length).
p_err
Pointer to variable that will receive the return error code.
Returned values
None.
Required Configuration
None.
Notes / Warnings
Must be called from a callback function only. Should be called by the function pointed by OnReqHook
or OnReqRdySignalHook
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.
Example Usage
See hook function example, section Response Body Data.