ESP8266 ILI9341 display support code with printf sources, wire-frame viewer and custom fonts  1.0
ESP8266ILI9341DisplayProject
Macros | Functions | Variables
web.c File Reference

Small web server for esp8266. More...

#include "user_config.h"
#include <stdint.h>
#include <stdarg.h>
#include <string.h>
#include <math.h>
#include "display/ili9341.h"
#include "web/web.h"

Go to the source code of this file.

Macros

#define MAX_MSG   1024
 max size of ERROR/REDIRECT/STATUS Message buffer More...
 
#define CGI_TOKEN_SIZE   128
 max size of CGI token More...
 
#define BUFFER_SIZE   1000
 max size of read/write socket buffers Note: reducing this size below 1500 will slow down transfer a great deal More...
 

Functions

MEMSPACE void web_sep (void)
 printer seperator More...
 
MEMSPACE int wait_send (rwbuf_t *p)
 Wait for buffer to send for this connection If write_buffer sending flag is set then wait for it to clear. More...
 
MEMSPACE int write_buffer (rwbuf_t *p)
 Socket write buffer for this connection We wait for previous send to complete - then send any new data We do not wait for new data to finish sending - you use flush for that. More...
 
MEMSPACE int write_flush (rwbuf_t *p)
 Write all outstanding data and wait for it to send. More...
 
MEMSPACE int write_byte (rwbuf_t *p, int c)
 Write a byte (buffered) using the rwbuf_t socket buffers for this connection If the buffers are full the socket is written using write_flush. More...
 
MEMSPACE void led_on (int led)
 
MEMSPACE void led_off (int led)
 Turn off virtual LED. More...
 
static MEMSPACE void tcp_accept (espconn_t *esp_config, esp_tcp *esp_tcp_config, uint16_t port, void(*connect_callback)(struct espconn *))
 Accept an incomming connection, setup connect_callback. More...
 
MEMSPACE void rwbuf_rinit (rwbuf_t *p)
 Initialize socket read status and read index. More...
 
MEMSPACE void rwbuf_winit (rwbuf_t *p)
 Initialize socket send status and write index. More...
 
MEMSPACE void display_ipv4 (char *msg, uint8_t *ip, int port)
 Display IPV4 address. More...
 
MEMSPACE void rwbuf_delete (rwbuf_t *p)
 Delete socket read/write buffers. More...
 
MEMSPACE rwbuf_trwbuf_create ()
 Create socket read/write buffer for a connection. More...
 
MEMSPACE rwbuf_tfind_connection (espconn_t *conn, int *index, char *msg)
 Find a read/write socket buffer for an espconn connection. More...
 
MEMSPACE rwbuf_tcreate_connection (espconn_t *conn)
 Allocate read/write socket buffers and add it to the working pool. More...
 
MEMSPACE int delete_connection (rwbuf_t *p)
 Delete our main connection structure and connection buffers. More...
 
MEMSPACE void write_len (rwbuf_t *p, char *str, int len)
 Write data using buffered write_byte function. More...
 
MEMSPACE void write_str (rwbuf_t *p, char *str)
 Write string using buffered write_byte function. More...
 
static MEMSPACE void _write_byte_fn (struct _printf_t *pr, char c)
 low level vsock_printf function that calls socket write_byte More...
 
MEMSPACE int vsock_printf (rwbuf_t *p, const char *fmt, va_list va)
 vsock_printf function More...
 
MEMSPACE int sock_printf (rwbuf_t *p, const char *fmt,...)
 sock_printf function More...
 
MEMSPACE int html_msg (rwbuf_t *p, int status, char type, char *fmt,...)
 Send an HTML status message to socket. More...
 
MEMSPACE char * meminit (mem_t *p, char *ptr, int size)
 in memory memory gets function More...
 
MEMSPACE char * memgets (mem_t *p)
 Memory gets function We ASSUME we can replace any
with a \0. More...
 
MEMSPACE char * mime_type (int type)
 return strung pointer for mime type index More...
 
MEMSPACE int file_type (char *name)
 Determin mimetype using file name extension. More...
 
MEMSPACE char * html_status (int status)
 Convert html status into string using http_status table. More...
 
MEMSPACE void init_hinfo (hinfo_t *hi)
 
MEMSPACE int match_headers (char *str, char **p)
 Match GET/POST message headers. More...
 
MEMSPACE char * process_args (hinfo_t *hi, char *ptr)
 Process GET argments or POST message name/value data. HTML encoding is done in place often reducting the size of the result. Convert name=value pairs into null terminated strings. Names and values are each terminated with an EOS by replaceing '?', '&', '=' characters seen while scaning. More...
 
MEMSPACE char * first_arg (hinfo_t *hi)
 Find first POST/GET argument. More...
 
MEMSPACE char * next_arg (hinfo_t *hi)
 Find next POST/GET argument We have to skip a name and a value. More...
 
MEMSPACE char * arg_name (hinfo_t *hi)
 Return the argument name for current argument. More...
 
MEMSPACE char * arg_value (hinfo_t *hi)
 Return the argument value for current argument. More...
 
MEMSPACE char * http_value (hinfo_t *hi, char *str)
 Lookup and argument name and return its value. More...
 
MEMSPACE int is_header (char *str, char **p)
 Does the string look like a header token with a ':' ? More...
 
MEMSPACE char * nextbreak (char *ptr)
 Find next space or ? character. More...
 
MEMSPACE void u5toa (char *ptr, uint16_t num)
 Print a decimal number into a string without an EOS. More...
 
MEMSPACE void html_head (rwbuf_t *p, int status, char type, int len)
 Write HTTP Contenet-Type/Content-Length header. More...
 
MEMSPACE int parse_http_request (rwbuf_t *p, hinfo_t *hi)
 Get arguments for a GET or POST request. More...
 
static MEMSPACE void web_data_receive_callback (void *arg, char *data, unsigned short length)
 Network receive callback function. More...
 
static MEMSPACE void web_data_sent_callback (void *arg)
 Network sent callback function. More...
 
static MEMSPACE void web_data_disconnect_callback (void *arg)
 Network disconnect callback function. More...
 
static MEMSPACE void web_data_error_callback (void *arg, int8_t err)
 Network Error callback function. More...
 
static MEMSPACE void web_data_connect_callback (espconn_t *conn)
 incomming connection setup callbacks More...
 
MEMSPACE int is_cgitoken_char (int c)
 test to see if a character is a valid member of the CGI token character set CGI tokens have the following syntax @ They start with "@_" and end with "_@" "@_" must be first two characters of string May have upper and lower case letters, numbers and '-' More...
 
MEMSPACE int find_cgitoken_start (char *str)
 Find start of CGI token in a string CGI tokens have the following syntax @ They start with "@_" and end with "_@" "@_" must be first two characters of string May have upper and lower case letters, numbers and '-' param[in] *str: string to search. More...
 
MEMSPACE int is_cgitoken (char *str)
 Does the string have a CGI TOKEN at the beginning ? CGI tokens have the following syntax @ They start with "@_" and end with "_@" "@_" must be first two characters of string May have upper and lower case letters, numbers and '-'. More...
 
MEMSPACE int rewrite_cgi_token (rwbuf_t *p, char *src)
 Replace CGI token with CGI result CGI tokens have the following syntax @ They start with "@_" and end with "_@" "@_" must be first two characters of string May have upper and lower case letters, numbers and '-'. More...
 
static MEMSPACE void process_requests (rwbuf_t *p)
 Process an incoming HTTP request. More...
 
MEMSPACE void web_task ()
 Process ALL incoming HTTP requests. More...
 
MEMSPACE void web_init_connections ()
 
MEMSPACE void web_init (int port)
 Setup WEB server and accept connections. More...
 

Variables

int connections
 
windowwinmsg
 
windowwintop
 
rwbuf_tweb_connections [MAX_CONNECTIONS]
 socket buffers for this connection More...
 
espconn_t WebConn
 Master espconn structure of the web server. More...
 
static esp_tcp WebTcp
 Master network configuration for the web server. More...
 
header_t msg_headers []
 HTTP headers we understand. More...
 
char * http_status []
 HTTP status code messages. More...
 
mime_t mimes []
 MIME types. More...
 
static MEMSPACE _led = 0
 Turn on virtual LED. More...
 

Detailed Description

Small web server for esp8266.

Copyright © 2015 Mike Gore, GPL License
You are free to use this code under the terms of GPL
please retain a copy of this notice in any code you use it in.

This is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Definition in file web.c.

Macro Definition Documentation

#define BUFFER_SIZE   1000

max size of read/write socket buffers Note: reducing this size below 1500 will slow down transfer a great deal

Definition at line 43 of file web.c.

Referenced by rwbuf_create().

#define CGI_TOKEN_SIZE   128

max size of CGI token

Definition at line 40 of file web.c.

#define MAX_MSG   1024

max size of ERROR/REDIRECT/STATUS Message buffer

Definition at line 38 of file web.c.

Referenced by html_msg().

Function Documentation

static MEMSPACE void _write_byte_fn ( struct _printf_t pr,
char  c 
)
static

low level vsock_printf function that calls socket write_byte

Parameters
[in]*prprintf structure and user buffer for this socket
[in]ccharacter to write
Returns
void

Definition at line 790 of file web.c.

Referenced by vsock_printf().

MEMSPACE char* arg_name ( hinfo_t hi)

Return the argument name for current argument.

Parameters
[in]*hihinfo_t structure with arguments
Returns
argument name

Definition at line 1298 of file web.c.

Referenced by http_value(), and parse_http_request().

MEMSPACE char* arg_value ( hinfo_t hi)

Return the argument value for current argument.

Parameters
[in]*hihinfo_t structure with arguments
Returns
argument value

Definition at line 1346 of file web.c.

Referenced by http_value(), and parse_http_request().

MEMSPACE rwbuf_t* create_connection ( espconn_t conn)

Allocate read/write socket buffers and add it to the working pool.

Parameters
[in]connespconn pointer for this connection
Returns
rwbuf_t pointer to created structure

Definition at line 669 of file web.c.

Referenced by web_data_connect_callback().

MEMSPACE int delete_connection ( rwbuf_t p)

Delete our main connection structure and connection buffers.

Parameters
[in]prwbuf_t pointer

Definition at line 715 of file web.c.

Referenced by web_data_disconnect_callback().

MEMSPACE void display_ipv4 ( char *  msg,
uint8_t ip,
int  port 
)

Display IPV4 address.

Parameters
[in]msguser supplied message
[in]ipIP address as uint8_t [4]
[in]portPort number
Returns
void

Definition at line 470 of file web.c.

Referenced by delete_connection(), find_connection(), web_data_connect_callback(), web_data_disconnect_callback(), web_data_error_callback(), web_data_receive_callback(), and web_data_sent_callback().

MEMSPACE int file_type ( char *  name)

Determin mimetype using file name extension.

Parameters
[in]*namename to test
Returns
index into mimetype table

Definition at line 996 of file web.c.

MEMSPACE int find_cgitoken_start ( char *  str)

Find start of CGI token in a string CGI tokens have the following syntax @ They start with "@_" and end with "_@" "@_" must be first two characters of string May have upper and lower case letters, numbers and '-' param[in] *str: string to search.

Returns
offset of start of token, or -1 if not found

Definition at line 2024 of file web.c.

MEMSPACE rwbuf_t* find_connection ( espconn_t conn,
int *  index,
char *  msg 
)

Find a read/write socket buffer for an espconn connection.

Parameters
[in]connespconn pointer for this connection
[in]*indexreturn index into pool of rwbuf_t connections
[in]*msguser debug message
Returns
rwbuf_t pointer to found connection with *index set, or NULL with *index == -1 on failure

Definition at line 590 of file web.c.

Referenced by web_data_disconnect_callback(), web_data_error_callback(), web_data_receive_callback(), and web_data_sent_callback().

MEMSPACE char* first_arg ( hinfo_t hi)

Find first POST/GET argument.

Parameters
[in]*hihinfo_t structure with arguments
Returns
argument value pair

Definition at line 1235 of file web.c.

Referenced by http_value(), and parse_http_request().

MEMSPACE void html_head ( rwbuf_t p,
int  status,
char  type,
int  len 
)

Write HTTP Contenet-Type/Content-Length header.

Parameters
[in]*prwbuf_t pointer to socket buffer
[in]statushtml status message index
[in]typemimetype index
[in]lenlength of message
Returns
void

Definition at line 1518 of file web.c.

MEMSPACE int html_msg ( rwbuf_t p,
int  status,
char  type,
char *  fmt,
  ... 
)

Send an HTML status message to socket.

Parameters
[in]psocket buffer structure
[in]statusindex into http_status table
[in]typemime type index
[in]fmtprintf format string
[in]...list of arguments
Returns
bytes written, 0 on wrror

Definition at line 853 of file web.c.

MEMSPACE char* html_status ( int  status)

Convert html status into string using http_status table.

Parameters
[in]statushtml status number
Returns
http_status entry mathing status, or 500 Internal Server Error

Definition at line 1030 of file web.c.

Referenced by html_head(), and html_msg().

MEMSPACE char* http_value ( hinfo_t hi,
char *  str 
)

Lookup and argument name and return its value.

Parameters
[in]*hihinfo_t structure with arguments
[in]*strstring to lookup
Returns
argument value

Definition at line 1422 of file web.c.

MEMSPACE void init_hinfo ( hinfo_t hi)

Initilize hinfo_t structure

Parameters
[in]*hihinfo_t structure pointer to initialize
Returns
hinfo_t structure pointer to initialize

Definition at line 1055 of file web.c.

Referenced by parse_http_request().

MEMSPACE int is_cgitoken ( char *  str)

Does the string have a CGI TOKEN at the beginning ? CGI tokens have the following syntax @ They start with "@_" and end with "_@" "@_" must be first two characters of string May have upper and lower case letters, numbers and '-'.

/**

Returns
size of token or -1 on fail

Definition at line 2051 of file web.c.

MEMSPACE int is_cgitoken_char ( int  c)

test to see if a character is a valid member of the CGI token character set CGI tokens have the following syntax @ They start with "@_" and end with "_@" "@_" must be first two characters of string May have upper and lower case letters, numbers and '-'

Parameters
[in]ccharacter to test
Returns
1 if the character is a CGI token or 0 if not

Definition at line 1999 of file web.c.

MEMSPACE int is_header ( char *  str,
char **  p 
)

Does the string look like a header token with a ':' ?

Parameters
[in]*strstring to test
[in]**pstring pointer to set on match
Returns
1 if it looks like a header, otherwise 0

Definition at line 1451 of file web.c.

Referenced by parse_http_request().

MEMSPACE void led_off ( int  led)

Turn off virtual LED.

Parameters
[in]ledled to turn off
Returns
void

Definition at line 384 of file web.c.

MEMSPACE void led_on ( int  led)

Definition at line 374 of file web.c.

MEMSPACE int match_headers ( char *  str,
char **  p 
)

Match GET/POST message headers.

Parameters
[in]*strstring to patch
[in]**ppoints past matched string on sucess
Returns
header index or -1 on no match

Definition at line 1077 of file web.c.

Referenced by parse_http_request().

MEMSPACE char* memgets ( mem_t p)

Memory gets function We ASSUME we can replace any
with a \0.

Parameters
[in]pstructure with size and offset used by mem_gets()
Returns
pointer to string

Definition at line 952 of file web.c.

Referenced by parse_http_request().

MEMSPACE char* meminit ( mem_t p,
char *  ptr,
int  size 
)

in memory memory gets function

Parameters
[in]pstructure with size and offset used by mem_gets()
[in]ptrstart of memory area
[in]sizesize of memory area
Returns
pointer to start of memory area (ptr)

Definition at line 933 of file web.c.

Referenced by parse_http_request().

MEMSPACE char* mime_type ( int  type)

return strung pointer for mime type index

Parameters
[in]typeindex into mim_type table
Returns
pointer to string, if out of range uses index PTYPE_ERR

Definition at line 983 of file web.c.

Referenced by html_head(), and html_msg().

MEMSPACE char* next_arg ( hinfo_t hi)

Find next POST/GET argument We have to skip a name and a value.

Parameters
[in]*hihinfo_t structure with arguments
Returns
argument value pair

Definition at line 1247 of file web.c.

Referenced by http_value(), and parse_http_request().

MEMSPACE char* nextbreak ( char *  ptr)

Find next space or ? character.

Parameters
[in]*ptrstring to search
Returns
first space or ? character

Definition at line 1476 of file web.c.

Referenced by parse_http_request().

MEMSPACE int parse_http_request ( rwbuf_t p,
hinfo_t hi 
)

Get arguments for a GET or POST request.

Parameters
[in]*prwbuf_t pointer to socket buffer
[in]*hiheader structure of parsed result
Returns
0 on error, 1 on success

We must respond with Connection: keep-alive now

Definition at line 1535 of file web.c.

MEMSPACE char* process_args ( hinfo_t hi,
char *  ptr 
)

Process GET argments or POST message name/value data. HTML encoding is done in place often reducting the size of the result. Convert name=value pairs into null terminated strings. Names and values are each terminated with an EOS by replaceing '?', '&', '=' characters seen while scaning.

Parameters
[in]*hihinfo_t structure to fill
[in]*ptrGET arguments or PUT message body.
Returns
*ptr pointer that points to just past the header area.

Definition at line 1116 of file web.c.

Referenced by parse_http_request().

static MEMSPACE void process_requests ( rwbuf_t p)
static

Process an incoming HTTP request.

Parameters
[in]*prwbuf_t pointer to socket buffer
Returns
void

FIXME if we want to support keep-alive we have to change this

Definition at line 2137 of file web.c.

MEMSPACE int rewrite_cgi_token ( rwbuf_t p,
char *  src 
)

Replace CGI token with CGI result CGI tokens have the following syntax @ They start with "@_" and end with "_@" "@_" must be first two characters of string May have upper and lower case letters, numbers and '-'.

Parameters
[in]*psocket stream
[in]*strstring with token, example @
Returns
length of replaced text or 0 if no CGI handler was matched

Definition at line 2093 of file web.c.

MEMSPACE rwbuf_t* rwbuf_create ( void  )

Create socket read/write buffer for a connection.

Returns
void

Definition at line 526 of file web.c.

Referenced by create_connection().

MEMSPACE void rwbuf_delete ( rwbuf_t p)

Delete socket read/write buffers.

Parameters
[in]prwbuf_t pointer to buffer to delete
Returns
void

Definition at line 487 of file web.c.

Referenced by delete_connection(), and rwbuf_create().

MEMSPACE void rwbuf_rinit ( rwbuf_t p)

Initialize socket read status and read index.

Parameters
[in]prwbuf_t pointer
Returns
void

Definition at line 439 of file web.c.

Referenced by rwbuf_create(), rwbuf_delete(), and web_data_receive_callback().

MEMSPACE void rwbuf_winit ( rwbuf_t p)

Initialize socket send status and write index.

Parameters
[in]prwbuf_t pointer
Returns
void

Definition at line 453 of file web.c.

Referenced by rwbuf_create(), rwbuf_delete(), and web_data_sent_callback().

MEMSPACE int sock_printf ( rwbuf_t p,
const char *  fmt,
  ... 
)

sock_printf function

Parameters
[in]psocket buffer structure
[in]fmtprintf format string
[in]...list of arguments
Returns
bytes written

Definition at line 830 of file web.c.

Referenced by html_head().

static MEMSPACE void tcp_accept ( espconn_t esp_config,
esp_tcp *  esp_tcp_config,
uint16_t  port,
void(*)(struct espconn *)  connect_callback 
)
static

Accept an incomming connection, setup connect_callback.

Parameters
[in]*esp_configESP8266 network type an mode configuration structure
[in]*esp_tcp_confignetwork protocol structure
[in]portnetwork port to listen on
[in]connect_callbackconnection callback function pointer
Returns
void

Definition at line 400 of file web.c.

MEMSPACE void u5toa ( char *  ptr,
uint16_t  num 
)

Print a decimal number into a string without an EOS.

Parameters
[in]*ptrbuffer to write number to
[in]numnumber to convet
Returns
void

Definition at line 1497 of file web.c.

Referenced by html_msg().

MEMSPACE int vsock_printf ( rwbuf_t p,
const char *  fmt,
va_list  va 
)

vsock_printf function

Parameters
[in]psocket buffer structure
[in]fmtprintf format string
[in]vava_list of arguments
Returns
bytes written

Definition at line 808 of file web.c.

Referenced by sock_printf().

MEMSPACE int wait_send ( rwbuf_t p)

Wait for buffer to send for this connection If write_buffer sending flag is set then wait for it to clear.

Parameters
[in]*prwbuf_t pointer for this socket buffer
Returns
sent buffer size or -1 on error

Definition at line 195 of file web.c.

Referenced by write_buffer(), and write_flush().

static MEMSPACE void web_data_connect_callback ( espconn_t conn)
static

incomming connection setup callbacks

Parameters
[in]*connespconn structure pointer
Returns
void

Definition at line 1928 of file web.c.

static MEMSPACE void web_data_disconnect_callback ( void *  arg)
static

Network disconnect callback function.

Parameters
[in]*argconnection pointer

Definition at line 1854 of file web.c.

Referenced by web_data_connect_callback().

static MEMSPACE void web_data_error_callback ( void *  arg,
int8_t  err 
)
static

Network Error callback function.

Parameters
[in]*argconnection pointer FIXME TODO - we just disconnect on error

Definition at line 1895 of file web.c.

Referenced by web_data_connect_callback().

static MEMSPACE void web_data_receive_callback ( void *  arg,
char *  data,
unsigned short  length 
)
static

Network receive callback function.

Parameters
[in]*argconnection pointer
[in]*dataData received
[in]lengthLength of data received
Returns
void

Definition at line 1735 of file web.c.

Referenced by web_data_connect_callback().

static MEMSPACE void web_data_sent_callback ( void *  arg)
static

Network sent callback function.

Parameters
[in]*argconnection pointer
Returns
void

Definition at line 1810 of file web.c.

Referenced by web_data_connect_callback().

MEMSPACE void web_init ( int  port)

Setup WEB server and accept connections.

Parameters
[in]portport number to run web server on
Returns
void

Definition at line 2490 of file web.c.

Referenced by setup().

MEMSPACE void web_init_connections ( void  )

Definition at line 2475 of file web.c.

MEMSPACE void web_sep ( void  )

printer seperator

Returns
void

Definition at line 182 of file web.c.

Referenced by tcp_accept().

MEMSPACE void web_task ( void  )

Process ALL incoming HTTP requests.

See also
process_requests()
Returns
void

Definition at line 2441 of file web.c.

Referenced by loop_wrapper().

MEMSPACE int write_buffer ( rwbuf_t p)

Socket write buffer for this connection We wait for previous send to complete - then send any new data We do not wait for new data to finish sending - you use flush for that.

Parameters
[in]*prwbuf_t pointer for this socket buffer
Returns
size of data in buffer or -1 on error

Definition at line 266 of file web.c.

Referenced by write_flush().

MEMSPACE int write_byte ( rwbuf_t p,
int  c 
)

Write a byte (buffered) using the rwbuf_t socket buffers for this connection If the buffers are full the socket is written using write_flush.

Parameters
[in]*prwbuf_t pointer for this socket buffer
[in]1on success 0 on fail

Definition at line 339 of file web.c.

Referenced by _write_byte_fn(), write_len(), and write_str().

MEMSPACE int write_flush ( rwbuf_t p)

Write all outstanding data and wait for it to send.

Parameters
[in]*prwbuf_t pointer for this socket buffer
Returns
void

Definition at line 323 of file web.c.

Referenced by write_byte().

MEMSPACE void write_len ( rwbuf_t p,
char *  str,
int  len 
)

Write data using buffered write_byte function.

Parameters
[in]*prwbuf_t pointer for this socket buffer
[in]*strdata buffer to write
[in]lennumber of bytes to write
Returns
void

Definition at line 758 of file web.c.

Referenced by html_msg().

MEMSPACE void write_str ( rwbuf_t p,
char *  str 
)

Write string using buffered write_byte function.

Parameters
[in]*prwbuf_t pointer for this socket buffer
[in]*str0 terminated string to write
Returns
void

Definition at line 774 of file web.c.

Variable Documentation

MEMSPACE _led = 0
static

Turn on virtual LED.

Parameters
[in]ledled to turn on
Returns
void

Definition at line 372 of file web.c.

int connections
char* http_status[]

HTTP status code messages.

Definition at line 86 of file web.c.

Referenced by html_status().

mime_t mimes[]
Initial value:
= {
{ PTYPE_TEXT, "text/plain", ".text", ".txt" },
{ PTYPE_HTML, "text/html", ".htm", ".html" },
{ PTYPE_PDF, "application/pdf", ".pdf",NULL},
{ PTYPE_CSS, "text/css", ".css", NULL },
{ PTYPE_CGI, "text/html", ".cgi", NULL },
{ PTYPE_JS, "text/plain", ".js", NULL },
{ PTYPE_XML, "text/plain", ".xml", NULL },
{ PTYPE_ICO, "mage/vnd.microsoft.icon", ".ico", NULL },
{ PTYPE_GIF, "image/gif", ".gif", NULL },
{ PTYPE_JPEG, "image/jpeg", ".jpg", ".jpeg" },
{ PTYPE_MPEG, "video/mpeg", ".mpg", ".mpeg" },
{ PTYPE_FLASH, "application/x-shockwave-flash", ".swf", NULL },
{ PTYPE_ERR, "text/html", NULL , NULL }
}
Definition: web.h:122
Definition: web.h:120
Definition: web.h:130
Definition: web.h:123
#define NULL
Definition: cpu.h:55
Definition: web.h:121
Definition: web.h:125
Definition: web.h:126
Definition: web.h:124

MIME types.

Definition at line 160 of file web.c.

header_t msg_headers[]
Initial value:
= {
{ "GET", TOKEN_GET },
{ "PUT", TOKEN_PUT },
{ "POST", TOKEN_POST },
{ "HEAD", TOKEN_HEAD },
{ "Host:", TOKEN_HOST },
{ "User-Agent:", TOKEN_USER_AGENT },
{ "HTTPS:", TOKEN_HTTPS},
{ "DNT:", TOKEN_DNT},
{ "Accept:", TOKEN_ACCEPT },
{ "Accept-Language:", TOKEN_ACCEPT_LANGUAGE },
{ "Accept-Encoding:", TOKEN_ACCEPT_ENCODING },
{ "Connection:", TOKEN_CONNECTION },
{ "Referer:", TOKEN_REFERER },
{ "Content-Length:", TOKEN_CONTENT_LENGTH },
{ "Content-Type:", TOKEN_CONTENT_TYPE },
{ "Cache-Control:", TOKEN_CACHE_CONTROL },
{ NULL, -1}
}
Definition: web.h:70
Definition: web.h:73
Definition: web.h:76
Definition: web.h:72
Definition: web.h:69
#define NULL
Definition: cpu.h:55
Definition: web.h:71

HTTP headers we understand.

Definition at line 61 of file web.c.

rwbuf_t* web_connections[MAX_CONNECTIONS]

socket buffers for this connection

Definition at line 50 of file web.c.

espconn_t WebConn

Master espconn structure of the web server.

Definition at line 53 of file web.c.

Referenced by find_connection(), and rwbuf_delete().

esp_tcp WebTcp
static

Master network configuration for the web server.

Definition at line 55 of file web.c.

window* winmsg
window * wintop