1 #ifndef __HTTPD_STRUCTS_H__
2 #define __HTTPD_STRUCTS_H__
6 /** This string is passed in the HTTP header as "Server: " */
7 #ifndef HTTPD_SERVER_AGENT
8 #define HTTPD_SERVER_AGENT "lwIP/1.3.1 (http://savannah.nongnu.org/projects/lwip)"
11 /** Set this to 1 if you want to include code that creates HTTP headers
12 * at runtime. Default is off: HTTP headers are then created statically
13 * by the makefsdata tool. Static headers mean smaller code size, but
14 * the (readonly) fsdata will grow a bit as every file includes the HTTP
16 #ifndef LWIP_HTTPD_DYNAMIC_HEADERS
17 #define LWIP_HTTPD_DYNAMIC_HEADERS 0
21 #if LWIP_HTTPD_DYNAMIC_HEADERS
22 /** This struct is used for a list of HTTP header strings for various
23 * filename extensions. */
26 const char *extension;
30 /** A list of strings used in HTTP headers */
31 static const char * const g_psHTTPHeaderStrings[] =
33 "Content-type: text/html\r\n\r\n",
34 "Content-type: text/html\r\nExpires: Fri, 10 Apr 2008 14:00:00 GMT\r\nPragma: no-cache\r\n\r\n",
35 "Content-type: image/gif\r\n\r\n",
36 "Content-type: image/png\r\n\r\n",
37 "Content-type: image/jpeg\r\n\r\n",
38 "Content-type: image/bmp\r\n\r\n",
39 "Content-type: image/x-icon\r\n\r\n",
40 "Content-type: application/octet-stream\r\n\r\n",
41 "Content-type: application/x-javascript\r\n\r\n",
42 "Content-type: application/x-javascript\r\n\r\n",
43 "Content-type: text/css\r\n\r\n",
44 "Content-type: application/x-shockwave-flash\r\n\r\n",
45 "Content-type: text/xml\r\n\r\n",
46 "Content-type: text/plain\r\n\r\n",
47 "HTTP/1.0 200 OK\r\n",
48 "HTTP/1.0 404 File not found\r\n",
49 "HTTP/1.0 400 Bad Request\r\n",
50 "HTTP/1.0 501 Not Implemented\r\n",
51 "HTTP/1.1 200 OK\r\n",
52 "HTTP/1.1 404 File not found\r\n",
53 "HTTP/1.1 400 Bad Request\r\n",
54 "HTTP/1.1 501 Not Implemented\r\n",
56 "Connection: Close\r\n",
57 "Server: "HTTPD_SERVER_AGENT"\r\n",
58 "\r\n<html><body><h2>404: The requested file cannot be found.</h2></body></html>\r\n"
61 /* Indexes into the g_psHTTPHeaderStrings array */
62 #define HTTP_HDR_HTML 0 /* text/html */
63 #define HTTP_HDR_SSI 1 /* text/html Expires... */
64 #define HTTP_HDR_GIF 2 /* image/gif */
65 #define HTTP_HDR_PNG 3 /* image/png */
66 #define HTTP_HDR_JPG 4 /* image/jpeg */
67 #define HTTP_HDR_BMP 5 /* image/bmp */
68 #define HTTP_HDR_ICO 6 /* image/x-icon */
69 #define HTTP_HDR_APP 7 /* application/octet-stream */
70 #define HTTP_HDR_JS 8 /* application/x-javascript */
71 #define HTTP_HDR_RA 9 /* application/x-javascript */
72 #define HTTP_HDR_CSS 10 /* text/css */
73 #define HTTP_HDR_SWF 11 /* application/x-shockwave-flash */
74 #define HTTP_HDR_XML 12 /* text/xml */
75 #define HTTP_HDR_DEFAULT_TYPE 13 /* text/plain */
76 #define HTTP_HDR_OK 14 /* 200 OK */
77 #define HTTP_HDR_NOT_FOUND 15 /* 404 File not found */
78 #define HTTP_HDR_BAD_REQUEST 16 /* 400 Bad request */
79 #define HTTP_HDR_NOT_IMPL 17 /* 501 Not Implemented */
80 #define HTTP_HDR_OK_11 18 /* 200 OK */
81 #define HTTP_HDR_NOT_FOUND_11 19 /* 404 File not found */
82 #define HTTP_HDR_BAD_REQUEST_11 20 /* 400 Bad request */
83 #define HTTP_HDR_NOT_IMPL_11 21 /* 501 Not Implemented */
84 #define HTTP_HDR_CONTENT_LENGTH 22 /* Content-Length: (HTTP 1.1)*/
85 #define HTTP_HDR_CONN_CLOSE 23 /* Connection: Close (HTTP 1.1) */
86 #define HTTP_HDR_SERVER 24 /* Server: HTTPD_SERVER_AGENT */
87 #define DEFAULT_404_HTML 25 /* default 404 body */
89 /** A list of extension-to-HTTP header strings */
90 const static tHTTPHeader g_psHTTPHeaders[] =
92 { "html", HTTP_HDR_HTML},
93 { "htm", HTTP_HDR_HTML},
94 { "shtml",HTTP_HDR_SSI},
95 { "shtm", HTTP_HDR_SSI},
96 { "ssi", HTTP_HDR_SSI},
97 { "gif", HTTP_HDR_GIF},
98 { "png", HTTP_HDR_PNG},
99 { "jpg", HTTP_HDR_JPG},
100 { "bmp", HTTP_HDR_BMP},
101 { "ico", HTTP_HDR_ICO},
102 { "class",HTTP_HDR_APP},
103 { "cls", HTTP_HDR_APP},
104 { "js", HTTP_HDR_JS},
105 { "ram", HTTP_HDR_RA},
106 { "css", HTTP_HDR_CSS},
107 { "swf", HTTP_HDR_SWF},
108 { "xml", HTTP_HDR_XML}
111 #define NUM_HTTP_HEADERS (sizeof(g_psHTTPHeaders) / sizeof(tHTTPHeader))
113 #endif /* LWIP_HTTPD_DYNAMIC_HEADERS */
115 #endif /* __HTTPD_STRUCTS_H__ */