Request Body Data

The µC/HTTP-server has the capacity to parse form received in a POST request body when the Form feature is enabled on the server instance. For more information, see section Form.

Forms are the only body parsing integrated in the server core. For your application to retrieve the body data of other requests (or even form's data when the feature is disabled) the server offers a hook function: On Request Body Received Hook.


CPU_BOOLEAN  HTTPs_ReqBodyRxHook (const  HTTPs_INSTANCE  *p_instance,
                                         HTTPs_CONN      *p_conn,
                                  const  void            *p_hook_cfg,
                                         void            *p_buf,
                                  const  CPU_SIZE_T       buf_size,
                                         CPU_SIZE_T      *p_buf_size_used);

This hook, if defined, will be called by the HTTP server each time new data is received in the server internal buffer. With this hook function, the application has the liberty to copy the data received or to read it directly in the HTTP buffer to retrieve only the information needed. The application has not the obligation to read all the data contained in the buffer. It MUST return the length of the data that was read (p_buf_size_used) and therefore, the next time around, the data not read will still be in the reception buffer. If the application doesn't want to receive more data, it can return DEF_NO at any time and data received afterward will be dropped by the server.