Network Dual-Stack Component  Version 7.0 (Beta)
MDK-Professional Middleware for IP Networking
 All Data Structures Files Functions Enumerations Groups Pages
Control Interface

Functions to work with the HTTP server. More...

Functions to work with the HTTP server.

Like all services, the HTTP server is normally started automatically if NET_START_SERVICE is set to 1 in the Net_Config.c configuration file. If it is set to 0, the HTTP server needs to be started manually in the user application using netHTTPs_Start. At runtime, it is always possible to stop the HTTP server using the function netHTTPs_Stop. The user application can check for a running server using the netHTTPs_Running function.

To change the port of the HTTP server at runtime, first call netHTTPs_Stop (if the server is running) and then use the netHTTPs_SetPort function. Afterwards, the HTTP server needs to be (re-)started by the application calling netHTTPs_Start.

The HTTP server supports a built-in user account if the HTTP_SERVER_AUTH_ADMIN is set to 1. In this case, the user specified by HTTP_SERVER_AUTH_USER is created and the password HTTP_SERVER_AUTH_PASS is used for this user. The HTTP server control interface provides functions to work with this built-in account. To retrieve the username in the application, use netHTTPs_GetUsername. To change this username at runtime, use netHTTPs_SetUsername. The same pair of functions is available for managing the password (netHTTPs_GetPassword/netHTTPs_SetPassword).

It is also possible to check if this login is active (netHTTPs_LoginActive) and to enable or disable it at runtime using netHTTPs_LoginOnOff. Please note that the function netHTTPs_LoginOnOff is only available at runtime if the define HTTP_SERVER_AUTH_ENABLE is set to 1 in the Net_Config_HTTP_Server.h file. Otherwise, this command will not be compiled into the project to save resources. For more complex account management, use the Access and Multi-User Interface.

For some of the Dynamic Web Content you need information from the client/browser that is connected to the HTTP server. To retrieve the IP address and port number of the connected client, use netHTTPs_GetClient. For the current session number you are working with, use netHTTPs_GetSession. To display web sites in the correct language, you can examine the preferred language used by the browser with netHTTPs_GetLanguage. netHTTPs_GetContentType returns the content-type HTML header for further processing.