Host HTTP Requests Processing
157
SWRU455A – February 2017 – Revised March 2017
Copyright © 2017, Texas Instruments Incorporated
HTTP Server
9.7.2 GET Processing
When the HTTP server receives an HTTP GET request for a resource which is not a ROM or user page,
the HTTP handler (as shown in the preceeding example) is invoked with
SL_NETAPP_REQUEST_HTTP_GET as the request type. The handler function must parse the HTTP
metadata, extract the resource name and any other fields of interest, and generate a response. The host
may choose to respond immediately by filling all response fields in the handler function. Alternatively, the
host can fill the status field to “pending”, and return, which means another part of the user application
must complete the response using the sl_NetAppSend API (as shown in the examples that follow).
9.7.2.1
Fragmentation
The host may choose to send the resource as a single chunk as part of the response from the handler
(the payload fields in the ResponseData structure), or split it across multiple fragments. Fragmentation
must be used to transfer resources larger than 1500 bytes (this is also the maximal size of a single
fragment). Without fragmentation, the entire resource data is sent as part of the response from the
handler. With fragmentation, the handler does not return anything but the pending status, while the
fragments of the response are sent using the sl_NetAppSend API. Each fragment may be a different size
(but smaller than 1500 bytes). While there are more fragments to send, the
SL_NETAPP_REQUEST_RESPONSE_FLAGS_CONTINUATION bit must be set in the flags parameter of
the API. On the last fragment, this bit must be zero. The first call to sl_NetAppSend API must carry the
metadata (HTTP headers) of the response. For that, the
SL_NETAPP_REQUEST_RESPONSE_FLAGS_METADATA bit must be set in the flags parameter of the
API.
demonstrates the handling of a GET request without (1) and with (2) fragmentation.
Figure 9-11. GET Request With and Without Fragmentation