Embedded TCP/IP stack
4.1.0
|
HTTP server API
Detailed Description
The current version of the FNET HTTP Server supports:
- HTTP/0.9 or HTTP/1.0 protocol responces.
- GET and POST (enabled by FNET_CFG_HTTP_POST) HTTP requests.
- Server Side Includes (SSI).
SSI directives have the following format:<!--#command [parameter(s)]--> - Common Gateway Interface (CGI).
- Basic Access Authentication (enabled by FNET_CFG_HTTP_AUTHENTICATION_BASIC).
- FNET File System Interface.
After the FNET HTTP server is initialized by calling the fnet_http_init() function, the user application should call the main service polling function fnet_service_poll() periodically in background.
For HTTP server usage example, refer to FNET demo application source code.
Configuration parameters:
- FNET_CFG_HTTP
- FNET_CFG_HTTP_VERSION_MAJOR
- FNET_CFG_HTTP_SESSION_MAX
- FNET_CFG_HTTP_SSI
- FNET_CFG_HTTP_CGI
- FNET_CFG_HTTP_POST
- FNET_CFG_HTTP_AUTHENTICATION_BASIC
- FNET_CFG_HTTP_PORT
- FNET_CFG_HTTP_REQUEST_SIZE_MAX
- FNET_CFG_HTTP_TLS
- FNET_CFG_HTTP_TLS_PORT
Data Structures | |
struct | fnet_http_tls_params |
HTTP over TLS (HTTPS) input parameters for fnet_http_init(). More... | |
struct | fnet_http_params |
Input parameters for fnet_http_init(). More... | |
struct | fnet_http_auth |
HTTP Authentication table. More... | |
struct | fnet_http_cgi |
CGI callback function table. More... | |
struct | fnet_http_post |
POST-method callback function table. More... | |
struct | fnet_http_ssi |
SSI callback function table. More... | |
Macros | |
#define | FNET_HTTP_VERSION_MAJOR |
The major version number of HTTP protocol supported by the HTTP server. More... | |
#define | FNET_HTTP_VERSION_MINOR |
The minor version number of HTTP protocol supported by the HTTP server. More... | |
#define | FNET_HTTP_CGI_EXTENSION "cgi" |
CGI file extension. All HTTP requests to the files that have this extension will be handled by the CGI handler. . More... | |
#define | FNET_HTTP_SSI_EXTENSION "shtml" |
SSI file extension. All files that have this extension will be parsed by the SSI parser. . More... | |
Typedefs | |
typedef fnet_int32_t | fnet_http_desc_t |
HTTP server descriptor. More... | |
typedef fnet_int32_t | fnet_http_session_t |
HTTP session handle. More... | |
typedef fnet_return_t(* | fnet_http_cgi_handle_t) (fnet_http_session_t session, fnet_char_t *query, fnet_uint32_t *cookie) |
Callback function prototype of the CGI query handler. More... | |
typedef fnet_size_t(* | fnet_http_cgi_send_t) (fnet_uint8_t *buffer, fnet_size_t buffer_size, fnet_bool_t *eof, fnet_uint32_t *cookie) |
Callback function prototype of the CGI response function. More... | |
typedef fnet_return_t(* | fnet_http_post_handle_t) (fnet_http_session_t session, fnet_char_t *query, fnet_uint32_t *cookie) |
Callback function prototype of the POST-method query handler. More... | |
typedef fnet_return_t(* | fnet_http_post_receive_t) (fnet_http_session_t session, fnet_uint8_t *buffer, fnet_size_t buffer_size, fnet_uint32_t *cookie) |
Callback function prototype of the POST-method receive function. More... | |
typedef fnet_size_t(* | fnet_http_post_send_t) (fnet_uint8_t *buffer, fnet_size_t buffer_size, fnet_bool_t *eof, fnet_uint32_t *cookie) |
Callback function prototype of the POST-method response function. More... | |
typedef fnet_return_t(* | fnet_http_ssi_handle_t) (fnet_char_t *query, fnet_uint32_t *cookie) |
Callback function prototype of the SSI parameters handler. More... | |
typedef fnet_size_t(* | fnet_http_ssi_send_t) (fnet_uint8_t *buffer, fnet_size_t buffer_size, fnet_bool_t *eof, fnet_uint32_t *cookie) |
Callback function prototype of the SSI include function. More... | |
Enumerations |
Functions | |
fnet_http_desc_t | fnet_http_init (struct fnet_http_params *params) |
Initializes the HTTP Server service. More... | |
void | fnet_http_release (fnet_http_desc_t desc) |
Releases the HTTP Server service. More... | |
fnet_bool_t | fnet_http_is_enabled (fnet_http_desc_t desc) |
Detects if the HTTP Server service is enabled or disabled. More... | |
void | fnet_http_query_unencode (fnet_uint8_t *dest, fnet_uint8_t *src) |
Converts escaped string to an original format. More... | |
void | fnet_http_set_response_status_code (fnet_http_session_t session, fnet_http_status_code_t status_code) |
Sets status code in HTTP response status-line. More... | |
void | fnet_http_set_response_content_length (fnet_http_session_t session, fnet_size_t content_length) |
Sets content length in HTTP response header. More... | |
void | fnet_http_set_response_no_header (fnet_http_session_t session) |
Disables sending of HTTP response status-code and header. More... | |
© 2005-2018 by Andrey Butok. http://fnet.sourceforge.net