Simple Http server. More...
#include "http.h"#include "hw/hw_sd.h"#include "hw/hw_http.h"#include "cfg/cfg_http.h"#include <cfg/log.h>#include <stdio.h>#include <stdlib.h>#include <string.h>Go to the source code of this file.
Functions | |
| int | http_getValue (char *tolenized_buf, size_t tolenized_buf_len, const char *key, char *value, size_t len) |
| Get key value from tokenized buffer. | |
| int | http_tokenizeGetRequest (char *raw_buf, size_t raw_len) |
| tokenize a buffer | |
| void | http_sendOk (struct netconn *client, int content_type) |
| Send on. | |
| void | http_sendFileNotFound (struct netconn *client, int content_type) |
| Send on. | |
| void | http_sendInternalErr (struct netconn *client, int content_type) |
| Send on. | |
| void | http_poll (struct netconn *server) |
| Http polling function. | |
| void | http_init (http_handler_t default_callback, struct HttpCGI *table) |
| Init the http server. | |
Detailed Description
Simple Http server.
This simple web server read the site's pages from SD card, and manage the cases where SD is not present or page not found, using embedded pages. Quering from browser the /status page, the server return a json dictionary where are store some board status info, like board temperature, up-time, etc.
Definition in file http.c.
Function Documentation
| void http_init | ( | http_handler_t | default_callback, |
| struct HttpCGI * | table | ||
| ) |
Init the http server.
The simply http server call for each client request the default_callback function. The user should define this callback to manage the client request, i.e. reading site's page from SD card. The user can define the cgi_table, where associate one callback to the user string. In this way the user could filter some client request and redirect they to custom callback, i.e. the client could request status of the device only loading the particular page name.
- Parameters:
-
default_callback fuction that server call for all request, that does'nt match cgi table. table of callcack to call when client request a particular page.
| void http_poll | ( | struct netconn * | server | ) |
| void http_sendFileNotFound | ( | struct netconn * | client, |
| int | content_type | ||
| ) |
| void http_sendInternalErr | ( | struct netconn * | client, |
| int | content_type | ||
| ) |
![(please configure the [header_logo] section in trac.ini)](/chrome/site/bertos_logo.png)