1#ifndef LWIP_HTTPD_STRUCTS_H
2#define LWIP_HTTPD_STRUCTS_H
6#if LWIP_HTTPD_DYNAMIC_HEADERS
10 const char *extension;
16static const char *
const g_psHTTPHeaderStrings[] = {
17 "HTTP/1.0 200 OK\r\n",
18 "HTTP/1.0 404 File not found\r\n",
19 "HTTP/1.0 400 Bad Request\r\n",
20 "HTTP/1.0 501 Not Implemented\r\n",
21 "HTTP/1.1 200 OK\r\n",
22 "HTTP/1.1 404 File not found\r\n",
23 "HTTP/1.1 400 Bad Request\r\n",
24 "HTTP/1.1 501 Not Implemented\r\n",
26 "Connection: Close\r\n",
27 "Connection: keep-alive\r\n",
28 "Connection: keep-alive\r\nContent-Length: ",
30 "\r\n<html><body><h2>404: The requested file cannot be found.</h2></body></html>\r\n"
31#if LWIP_HTTPD_SUPPORT_11_KEEPALIVE
32 ,
"Connection: keep-alive\r\nContent-Length: 77\r\n\r\n<html><body><h2>404: The requested file cannot be found.</h2></body></html>\r\n"
38#define HTTP_HDR_NOT_FOUND 1
39#define HTTP_HDR_BAD_REQUEST 2
40#define HTTP_HDR_NOT_IMPL 3
41#define HTTP_HDR_OK_11 4
42#define HTTP_HDR_NOT_FOUND_11 5
43#define HTTP_HDR_BAD_REQUEST_11 6
44#define HTTP_HDR_NOT_IMPL_11 7
45#define HTTP_HDR_CONTENT_LENGTH 8
46#define HTTP_HDR_CONN_CLOSE 9
47#define HTTP_HDR_CONN_KEEPALIVE 10
48#define HTTP_HDR_KEEPALIVE_LEN 11
49#define HTTP_HDR_SERVER 12
50#define DEFAULT_404_HTML 13
51#if LWIP_HTTPD_SUPPORT_11_KEEPALIVE
52#define DEFAULT_404_HTML_PERSISTENT 14
55#define HTTP_CONTENT_TYPE(contenttype) "Content-Type: "contenttype"\r\n\r\n"
56#define HTTP_CONTENT_TYPE_ENCODING(contenttype, encoding) "Content-Type: "contenttype"\r\nContent-Encoding: "encoding"\r\n\r\n"
58#define HTTP_HDR_HTML HTTP_CONTENT_TYPE("text/html")
59#define HTTP_HDR_SSI HTTP_CONTENT_TYPE("text/html\r\nExpires: Fri, 10 Apr 2008 14:00:00 GMT\r\nPragma: no-cache")
60#define HTTP_HDR_GIF HTTP_CONTENT_TYPE("image/gif")
61#define HTTP_HDR_PNG HTTP_CONTENT_TYPE("image/png")
62#define HTTP_HDR_JPG HTTP_CONTENT_TYPE("image/jpeg")
63#define HTTP_HDR_BMP HTTP_CONTENT_TYPE("image/bmp")
64#define HTTP_HDR_ICO HTTP_CONTENT_TYPE("image/x-icon")
65#define HTTP_HDR_APP HTTP_CONTENT_TYPE("application/octet-stream")
66#define HTTP_HDR_JS HTTP_CONTENT_TYPE("application/javascript")
67#define HTTP_HDR_RA HTTP_CONTENT_TYPE("application/javascript")
68#define HTTP_HDR_CSS HTTP_CONTENT_TYPE("text/css")
69#define HTTP_HDR_SWF HTTP_CONTENT_TYPE("application/x-shockwave-flash")
70#define HTTP_HDR_XML HTTP_CONTENT_TYPE("text/xml")
71#define HTTP_HDR_PDF HTTP_CONTENT_TYPE("application/pdf")
72#define HTTP_HDR_JSON HTTP_CONTENT_TYPE("application/json")
73#define HTTP_HDR_CSV HTTP_CONTENT_TYPE("text/csv")
74#define HTTP_HDR_TSV HTTP_CONTENT_TYPE("text/tsv")
75#define HTTP_HDR_SVG HTTP_CONTENT_TYPE("image/svg+xml")
76#define HTTP_HDR_SVGZ HTTP_CONTENT_TYPE_ENCODING("image/svg+xml", "gzip")
78#define HTTP_HDR_DEFAULT_TYPE HTTP_CONTENT_TYPE("text/plain")
83static const tHTTPHeader g_psHTTPHeaders[] = {
84 {
"html", HTTP_HDR_HTML},
85 {
"htm", HTTP_HDR_HTML},
86 {
"shtml", HTTP_HDR_SSI},
87 {
"shtm", HTTP_HDR_SSI},
88 {
"ssi", HTTP_HDR_SSI},
89 {
"gif", HTTP_HDR_GIF},
90 {
"png", HTTP_HDR_PNG},
91 {
"jpg", HTTP_HDR_JPG},
92 {
"bmp", HTTP_HDR_BMP},
93 {
"ico", HTTP_HDR_ICO},
94 {
"class", HTTP_HDR_APP},
95 {
"cls", HTTP_HDR_APP},
97 {
"ram", HTTP_HDR_RA},
98 {
"css", HTTP_HDR_CSS},
99 {
"swf", HTTP_HDR_SWF},
100 {
"xml", HTTP_HDR_XML},
101 {
"xsl", HTTP_HDR_XML},
102 {
"pdf", HTTP_HDR_PDF},
103 {
"json", HTTP_HDR_JSON}
104#ifdef HTTPD_ADDITIONAL_CONTENT_TYPES
108 , HTTPD_ADDITIONAL_CONTENT_TYPES
112#define NUM_HTTP_HEADERS LWIP_ARRAYSIZE(g_psHTTPHeaders)
116#if LWIP_HTTPD_SSI && LWIP_HTTPD_SSI_BY_FILE_EXTENSION
117static const char *
const g_pcSSIExtensions[] = {
120#define NUM_SHTML_EXTENSIONS LWIP_ARRAYSIZE(g_pcSSIExtensions)
#define LWIP_HTTPD_SSI_EXTENSIONS
#define HTTPD_SERVER_AGENT