Host HTTP Requests Processing
162
SWRU455A – February 2017 – Revised March 2017
Copyright © 2017, Texas Instruments Incorporated
HTTP Server
Figure 9-13. Delayed Response
The following code implements a handler for a POST request. It sends an HTTP 200 OK response
immediately if the entire request was received, or sets the pending status and signals the user application
to handle the remaining of the request. It also parses the metadata in search for the content length field,
which represents the expected size of the payload, and extracts it. This field (similar to all other metadata)
is not generated by the SimpleLink device, but transferred as is, and must be validated by the user.
void
NetAppRequestHandler(
SlNetAppRequest_t *pNetAppRequest,
SlNetAppResponse_t *pNetAppResponse)
{
extern
_u16 gHandle;
switch
(pNetAppRequest->Type)
{
case
SL_NETAPP_REQUEST_HTTP_POST:
{
_u32 RequestFlags;
_u32 ContentLength;