LPCOpen Platform  v1.03
LPCOpen Platform for NXP LPC Microcontrollers
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
httpd_structs.h
Go to the documentation of this file.
1 #ifndef __HTTPD_STRUCTS_H__
2 #define __HTTPD_STRUCTS_H__
3 
4 #include "httpd.h"
5 
7 #ifndef HTTPD_SERVER_AGENT
8 #define HTTPD_SERVER_AGENT "lwIP/1.3.1 (http://savannah.nongnu.org/projects/lwip)"
9 #endif
10 
16 #ifndef LWIP_HTTPD_DYNAMIC_HEADERS
17 #define LWIP_HTTPD_DYNAMIC_HEADERS 0
18 #endif
19 
20 
21 #if LWIP_HTTPD_DYNAMIC_HEADERS
22 
24 typedef struct
25 {
26  const char *extension;
27  int headerIndex;
28 } tHTTPHeader;
29 
31 static const char * const g_psHTTPHeaderStrings[] =
32 {
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",
55  "Content-Length: ",
56  "Connection: Close\r\n",
57  "Connection: keep-alive\r\n",
58  "Server: "HTTPD_SERVER_AGENT"\r\n",
59  "\r\n<html><body><h2>404: The requested file cannot be found.</h2></body></html>\r\n"
60 };
61 
62 /* Indexes into the g_psHTTPHeaderStrings array */
63 #define HTTP_HDR_HTML 0 /* text/html */
64 #define HTTP_HDR_SSI 1 /* text/html Expires... */
65 #define HTTP_HDR_GIF 2 /* image/gif */
66 #define HTTP_HDR_PNG 3 /* image/png */
67 #define HTTP_HDR_JPG 4 /* image/jpeg */
68 #define HTTP_HDR_BMP 5 /* image/bmp */
69 #define HTTP_HDR_ICO 6 /* image/x-icon */
70 #define HTTP_HDR_APP 7 /* application/octet-stream */
71 #define HTTP_HDR_JS 8 /* application/x-javascript */
72 #define HTTP_HDR_RA 9 /* application/x-javascript */
73 #define HTTP_HDR_CSS 10 /* text/css */
74 #define HTTP_HDR_SWF 11 /* application/x-shockwave-flash */
75 #define HTTP_HDR_XML 12 /* text/xml */
76 #define HTTP_HDR_DEFAULT_TYPE 13 /* text/plain */
77 #define HTTP_HDR_OK 14 /* 200 OK */
78 #define HTTP_HDR_NOT_FOUND 15 /* 404 File not found */
79 #define HTTP_HDR_BAD_REQUEST 16 /* 400 Bad request */
80 #define HTTP_HDR_NOT_IMPL 17 /* 501 Not Implemented */
81 #define HTTP_HDR_OK_11 18 /* 200 OK */
82 #define HTTP_HDR_NOT_FOUND_11 19 /* 404 File not found */
83 #define HTTP_HDR_BAD_REQUEST_11 20 /* 400 Bad request */
84 #define HTTP_HDR_NOT_IMPL_11 21 /* 501 Not Implemented */
85 #define HTTP_HDR_CONTENT_LENGTH 22 /* Content-Length: (HTTP 1.1)*/
86 #define HTTP_HDR_CONN_CLOSE 23 /* Connection: Close (HTTP 1.1) */
87 #define HTTP_HDR_CONN_KEEPALIVE 24 /* Connection: keep-alive (HTTP 1.1) */
88 #define HTTP_HDR_SERVER 25 /* Server: HTTPD_SERVER_AGENT */
89 #define DEFAULT_404_HTML 26 /* default 404 body */
90 
92 const static tHTTPHeader g_psHTTPHeaders[] =
93 {
94  { "html", HTTP_HDR_HTML},
95  { "htm", HTTP_HDR_HTML},
96  { "shtml",HTTP_HDR_SSI},
97  { "shtm", HTTP_HDR_SSI},
98  { "ssi", HTTP_HDR_SSI},
99  { "gif", HTTP_HDR_GIF},
100  { "png", HTTP_HDR_PNG},
101  { "jpg", HTTP_HDR_JPG},
102  { "bmp", HTTP_HDR_BMP},
103  { "ico", HTTP_HDR_ICO},
104  { "class",HTTP_HDR_APP},
105  { "cls", HTTP_HDR_APP},
106  { "js", HTTP_HDR_JS},
107  { "ram", HTTP_HDR_RA},
108  { "css", HTTP_HDR_CSS},
109  { "swf", HTTP_HDR_SWF},
110  { "xml", HTTP_HDR_XML},
111  { "xsl", HTTP_HDR_XML}
112 };
113 
114 #define NUM_HTTP_HEADERS (sizeof(g_psHTTPHeaders) / sizeof(tHTTPHeader))
115 
116 #endif /* LWIP_HTTPD_DYNAMIC_HEADERS */
117 
118 #if LWIP_HTTPD_SSI
119 static const char * const g_pcSSIExtensions[] = {
120  ".shtml", ".shtm", ".ssi", ".xml"
121 };
122 #define NUM_SHTML_EXTENSIONS (sizeof(g_pcSSIExtensions) / sizeof(const char *))
123 #endif /* LWIP_HTTPD_SSI */
124 
125 #endif /* __HTTPD_STRUCTS_H__ */