This hook function is called by μC/HTTPs when receiving a POST method and that all key value pair has been received as shown in the figure Hook Functions. It allows the upper application to do whatever wanted with data received from an HTML form.
Prototype
Arguments
p_instance
Pointer to the instance structure (read only).
p_conn
Pointer to the connection structure.
p_data
Pointer to the first control key value pair.
Return Values
DEF_YES
If the CGI process is completed and the response can be called.
DEF_NO
If the CGI process is not completed and CGI Poll function must be called to know the end of processing.
Required Configuration
See Instance CGI / Form Submission Configuration.
Notes / Warnings
- The instance structure is for read-only. It must not be modified.
The following connection attributes can be accessed to analyze the connection (see HTTPs_CONN in Control Structures for further details on each parameters):
ClientAddr
Method
FileNamePtr
ReqHdrCtr
ReqHdrFirstPtr
ConnDataPtr
- In this hook function, only the under-mentioned connection parameters are allowed to be modified (see HTTPs_CONN in Control Structures for further details on each parameters):
StatusCode
FileNamePtr
FilePtr
FileType
FileLen
- If CGI data take a while to be processed:
- The processing should be done in a separate task and not in this callback function to avoid blocking other connections.
- The poll callback function should be used to allow the connection to poll periodically the upper application and verify if the CGI data processing has been completed.
Note that The
ConnDataPtr
attribute inside deHTTP_CONN
structure can be used to store a semaphore pointer related or anything else that can help to determine the completion of the CGI processing.
Example Template
The listing below is shown to demonstrate the µC/HTTPs module capabilities. That code analyses each key value pair in the list and try to find control name which is linked to led blinking functionality and change the document returned to display the led state using a data in memory as well.