
Host HTTP Requests Processing
164
SWRU455A – February 2017 – Revised March 2017
Copyright © 2017, Texas Instruments Incorporated
HTTP Server
(short)(0x0000ffff & Flags);
}
/* Process the received fragment here.
FragmentLen contains the actual fragment size. */
}
while
(Flags & NETAPP_REQUEST_RESPONSE_FLAGS_CONTINUATION);
/* Send response OK */
MetadataBuff = (_u8*) malloc(128);
pMetadata = MetadataBuff;
*pMetadata = (_u8) SL_NETAPP_REQUEST_METADATA_TYPE_STATUS;
pM+;
*(_u16 *)pMetadata = (_u16) 2;
pM=2;
*(_u16 *)pMetadata = (_u16) SL_NETAPP_HTTP_RESPONSE_200_OK;
pM=2;
MetadataLen = 5;
Flags = SL_NETAPP_REQUEST_RESPONSE_FLAGS_METADATA;
sl_NetAppSend (gHandle, MetadataLen, MetadataBuff, Flags);
There is no way to return payload data as part of the response, only HTTP headers as part of the meta-
data.
9.7.4 PUT Processing
PUT requests are similar to POST requests. The only difference (aside from the command type received)
is that there is no processing of RESTful APIs; all requests are transferred directly to the host. As in
POST, the response cannot contain any payload, only HTTP headers.
9.7.5 DELETE Processing
DELETE requests are similar to POST requests. The only difference (aside from the command type
received) is that there is no processing of RESTful APIs; all requests are transferred directly to the host.
As in POST, the response cannot contain any payload, only HTTP headers.
9.8
Security
9.8.1 Authentication
When authentication is enabled (see
), the client must provide a username and password
before the HTTP server processes any requests. Both user name and password are limited to 20
characters, and both are case sensitive.
9.8.1.1
HTTP Realm
A realm in HTTP context is a group of resources protected by the same username and password.
Therefore, it is relevant only when authentication is enabled. All resources served by the SimpleLink HTTP
server (including those residing in the host) belong to one realm. The name of this realm can be set as
described in
. The realm name is presented in the client browser when it prompts for username
and password.
9.8.2 Secure Connection
The HTTP server can accept connections over a secure socket (SSL). When enabled, the primary server
port accepts only secure connections, and unsecure connection requests are rejected. The secondary port
can be enabled to redirect nonsecure connection attempts to the primary (secure) port. This scheme is
commonly used to redirect browsers, which by default initiate a nonsecure connection on port 80. When
the secure connection is enabled, a server certificate and a private key must be placed on the file system
in PEM or DER format, and their names must be configured in the HTTP server. The following example
shows how to enable the secure socket and use the secondary socket for redirection.
unsigned char
ServerCertificateFileName[] = "server-cert.der";