Other
165
SWRU455A – February 2017 – Revised March 2017
Copyright © 2017, Texas Instruments Incorporated
HTTP Server
unsigned char
ServerKeyFileName[] = "server-key.der";
unsigned char
SecurityMode[] = {0x1};
unsigned char
HttpsPort[] = {0xBB, 0x01};
// 0x1BB = 443
unsigned char
SecondaryPort[] = {0x50, 0x00};
// 0x050 = 80
unsigned char
SecondaryPortEnable[] = {0x1};
// Set the file names used for SSL key exchange.
sl_NetAppSet(SL_NETAPP_HTTP_SERVER_ID,
SL_NETAPP_HTTP_DEVICE_CERTIFICATE_FILENAME,
sizeof
(ServerCertificateFileName),
ServerCertificateFileName);
sl_NetAppSet(SL_NETAPP_HTTP_SERVER_ID,
SL_NETAPP_HTTP_PRIVATE_KEY_FILENAME,
sizeof
(ServerKeyFileName),
ServerKeyFileName);
// Activate SSL security on primary HTTP port and change it to // 443 (standard HTTPS port)
sl_NetAppSet(SL_NETAPP_HTTP_SERVER_ID,
SL_NETAPP_HTTP_PRIMARY_PORT_SECURITY_MODE,
sizeof
(SecurityMode),
SecurityMode);
sl_NetAppSet(SL_NETAPP_HTTP_SERVER_ID,
SL_NETAPP_HTTP_PRIMARY_PORT_NUMBER,
sizeof
(HttpsPort),
HttpsPort);
// Enable secondary HTTP port (can only be used for redirecting // connections to the secure
primary port).
sl_NetAppSet(SL_NETAPP_HTTP_SERVER_ID,
SL_NETAPP_HTTP_SECONDARY_PORT_NUMBER,
sizeof
(SecondaryPort),
SecondaryPort);
sl_NetAppSet(SL_NETAPP_HTTP_SERVER_ID,
SL_NETAPP_HTTP_SECONDARY_PORT_ENABLE,
sizeof
(SecondaryPortEnable),
SecondaryPortEnable);
// Restart HTTP server for new configuration to take effect.
sl_NetAppStop(SL_NETAPP_HTTP_SERVER_ID);
sl_NetAppStart(SL_NETAPP_HTTP_SERVER_ID);
It is also possible to require client authentication by providing a Root CA file using the
SL_NETAPP_HTTP_CA_CERTIFICATE_FILE_NAME option. If provided, all client connections are
verified, and those failing the test are not accepted. SSL client verification is described in more detail in
.
9.9
Other
9.9.1 Processing of Parallel Requests
Each HTTP request is handled over a single TCP connection. The client initiates a connection, and sends
the request. The server processes the request and sends the response over the same connection, closing
it once sent. The server then waits to accept a new connection. Even though only one request can be
processed at any given time, many clients can initiate TCP connections to the server simultaneously, and
each request is handled in order.