BadVPN – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | /** |
2 | * @file |
||
3 | * HTTP server options list |
||
4 | */ |
||
5 | |||
6 | /* |
||
7 | * Copyright (c) 2001-2003 Swedish Institute of Computer Science. |
||
8 | * All rights reserved. |
||
9 | * |
||
10 | * Redistribution and use in source and binary forms, with or without modification, |
||
11 | * are permitted provided that the following conditions are met: |
||
12 | * |
||
13 | * 1. Redistributions of source code must retain the above copyright notice, |
||
14 | * this list of conditions and the following disclaimer. |
||
15 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
||
16 | * this list of conditions and the following disclaimer in the documentation |
||
17 | * and/or other materials provided with the distribution. |
||
18 | * 3. The name of the author may not be used to endorse or promote products |
||
19 | * derived from this software without specific prior written permission. |
||
20 | * |
||
21 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED |
||
22 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
||
23 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT |
||
24 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
||
25 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT |
||
26 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
||
27 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
||
28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING |
||
29 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY |
||
30 | * OF SUCH DAMAGE. |
||
31 | * |
||
32 | * This file is part of the lwIP TCP/IP stack. |
||
33 | * |
||
34 | * Author: Adam Dunkels <adam@sics.se> |
||
35 | * |
||
36 | * This version of the file has been modified by Texas Instruments to offer |
||
37 | * simple server-side-include (SSI) and Common Gateway Interface (CGI) |
||
38 | * capability. |
||
39 | */ |
||
40 | |||
41 | #ifndef LWIP_HDR_APPS_HTTPD_OPTS_H |
||
42 | #define LWIP_HDR_APPS_HTTPD_OPTS_H |
||
43 | |||
44 | #include "lwip/opt.h" |
||
45 | #include "lwip/prot/iana.h" |
||
46 | |||
47 | /** |
||
48 | * @defgroup httpd_opts Options |
||
49 | * @ingroup httpd |
||
50 | * @{ |
||
51 | */ |
||
52 | |||
53 | /** Set this to 1 to support CGI (old style) */ |
||
54 | #if !defined LWIP_HTTPD_CGI || defined __DOXYGEN__ |
||
55 | #define LWIP_HTTPD_CGI 0 |
||
56 | #endif |
||
57 | |||
58 | /** Set this to 1 to support CGI (new style) */ |
||
59 | #if !defined LWIP_HTTPD_CGI_SSI || defined __DOXYGEN__ |
||
60 | #define LWIP_HTTPD_CGI_SSI 0 |
||
61 | #endif |
||
62 | |||
63 | /** Set this to 1 to support SSI (Server-Side-Includes) */ |
||
64 | #if !defined LWIP_HTTPD_SSI || defined __DOXYGEN__ |
||
65 | #define LWIP_HTTPD_SSI 0 |
||
66 | #endif |
||
67 | |||
68 | /** Set this to 1 to implement an SSI tag handler callback that gets a const char* |
||
69 | * to the tag (instead of an index into a pre-registered array of known tags) */ |
||
70 | #if !defined LWIP_HTTPD_SSI_RAW || defined __DOXYGEN__ |
||
71 | #define LWIP_HTTPD_SSI_RAW 0 |
||
72 | #endif |
||
73 | |||
74 | /** Set this to 1 to support HTTP POST */ |
||
75 | #if !defined LWIP_HTTPD_SUPPORT_POST || defined __DOXYGEN__ |
||
76 | #define LWIP_HTTPD_SUPPORT_POST 0 |
||
77 | #endif |
||
78 | |||
79 | /* The maximum number of parameters that the CGI handler can be sent. */ |
||
80 | #if !defined LWIP_HTTPD_MAX_CGI_PARAMETERS || defined __DOXYGEN__ |
||
81 | #define LWIP_HTTPD_MAX_CGI_PARAMETERS 16 |
||
82 | #endif |
||
83 | |||
84 | /** LWIP_HTTPD_SSI_MULTIPART==1: SSI handler function is called with 2 more |
||
85 | * arguments indicating a counter for insert string that are too long to be |
||
86 | * inserted at once: the SSI handler function must then set 'next_tag_part' |
||
87 | * which will be passed back to it in the next call. */ |
||
88 | #if !defined LWIP_HTTPD_SSI_MULTIPART || defined __DOXYGEN__ |
||
89 | #define LWIP_HTTPD_SSI_MULTIPART 0 |
||
90 | #endif |
||
91 | |||
92 | /* The maximum length of the string comprising the tag name */ |
||
93 | #if !defined LWIP_HTTPD_MAX_TAG_NAME_LEN || defined __DOXYGEN__ |
||
94 | #define LWIP_HTTPD_MAX_TAG_NAME_LEN 8 |
||
95 | #endif |
||
96 | |||
97 | /* The maximum length of string that can be returned to replace any given tag */ |
||
98 | #if !defined LWIP_HTTPD_MAX_TAG_INSERT_LEN || defined __DOXYGEN__ |
||
99 | #define LWIP_HTTPD_MAX_TAG_INSERT_LEN 192 |
||
100 | #endif |
||
101 | |||
102 | #if !defined LWIP_HTTPD_POST_MANUAL_WND || defined __DOXYGEN__ |
||
103 | #define LWIP_HTTPD_POST_MANUAL_WND 0 |
||
104 | #endif |
||
105 | |||
106 | /** This string is passed in the HTTP header as "Server: " */ |
||
107 | #if !defined HTTPD_SERVER_AGENT || defined __DOXYGEN__ |
||
108 | #define HTTPD_SERVER_AGENT "lwIP/" LWIP_VERSION_STRING " (http://savannah.nongnu.org/projects/lwip)" |
||
109 | #endif |
||
110 | |||
111 | /** Set this to 1 if you want to include code that creates HTTP headers |
||
112 | * at runtime. Default is off: HTTP headers are then created statically |
||
113 | * by the makefsdata tool. Static headers mean smaller code size, but |
||
114 | * the (readonly) fsdata will grow a bit as every file includes the HTTP |
||
115 | * header. */ |
||
116 | #if !defined LWIP_HTTPD_DYNAMIC_HEADERS || defined __DOXYGEN__ |
||
117 | #define LWIP_HTTPD_DYNAMIC_HEADERS 0 |
||
118 | #endif |
||
119 | |||
120 | #if !defined HTTPD_DEBUG || defined __DOXYGEN__ |
||
121 | #define HTTPD_DEBUG LWIP_DBG_OFF |
||
122 | #endif |
||
123 | |||
124 | /** Set this to 1 to use a memp pool for allocating |
||
125 | * struct http_state instead of the heap. |
||
126 | */ |
||
127 | #if !defined HTTPD_USE_MEM_POOL || defined __DOXYGEN__ |
||
128 | #define HTTPD_USE_MEM_POOL 0 |
||
129 | #endif |
||
130 | |||
131 | /** The server port for HTTPD to use */ |
||
132 | #if !defined HTTPD_SERVER_PORT || defined __DOXYGEN__ |
||
133 | #define HTTPD_SERVER_PORT LWIP_IANA_PORT_HTTP |
||
134 | #endif |
||
135 | |||
136 | /** The https server port for HTTPD to use */ |
||
137 | #if !defined HTTPD_SERVER_PORT_HTTPS || defined __DOXYGEN__ |
||
138 | #define HTTPD_SERVER_PORT_HTTPS LWIP_IANA_PORT_HTTPS |
||
139 | #endif |
||
140 | |||
141 | /** Enable https support? */ |
||
142 | #if !defined HTTPD_ENABLE_HTTPS || defined __DOXYGEN__ |
||
143 | #define HTTPD_ENABLE_HTTPS 0 |
||
144 | #endif |
||
145 | |||
146 | /** Maximum retries before the connection is aborted/closed. |
||
147 | * - number of times pcb->poll is called -> default is 4*500ms = 2s; |
||
148 | * - reset when pcb->sent is called |
||
149 | */ |
||
150 | #if !defined HTTPD_MAX_RETRIES || defined __DOXYGEN__ |
||
151 | #define HTTPD_MAX_RETRIES 4 |
||
152 | #endif |
||
153 | |||
154 | /** The poll delay is X*500ms */ |
||
155 | #if !defined HTTPD_POLL_INTERVAL || defined __DOXYGEN__ |
||
156 | #define HTTPD_POLL_INTERVAL 4 |
||
157 | #endif |
||
158 | |||
159 | /** Priority for tcp pcbs created by HTTPD (very low by default). |
||
160 | * Lower priorities get killed first when running out of memory. |
||
161 | */ |
||
162 | #if !defined HTTPD_TCP_PRIO || defined __DOXYGEN__ |
||
163 | #define HTTPD_TCP_PRIO TCP_PRIO_MIN |
||
164 | #endif |
||
165 | |||
166 | /** Set this to 1 to enable timing each file sent */ |
||
167 | #if !defined LWIP_HTTPD_TIMING || defined __DOXYGEN__ |
||
168 | #define LWIP_HTTPD_TIMING 0 |
||
169 | #endif |
||
170 | /** Set this to 1 to enable timing each file sent */ |
||
171 | #if !defined HTTPD_DEBUG_TIMING || defined __DOXYGEN__ |
||
172 | #define HTTPD_DEBUG_TIMING LWIP_DBG_OFF |
||
173 | #endif |
||
174 | |||
175 | /** Set this to one to show error pages when parsing a request fails instead |
||
176 | of simply closing the connection. */ |
||
177 | #if !defined LWIP_HTTPD_SUPPORT_EXTSTATUS || defined __DOXYGEN__ |
||
178 | #define LWIP_HTTPD_SUPPORT_EXTSTATUS 0 |
||
179 | #endif |
||
180 | |||
181 | /** Set this to 0 to drop support for HTTP/0.9 clients (to save some bytes) */ |
||
182 | #if !defined LWIP_HTTPD_SUPPORT_V09 || defined __DOXYGEN__ |
||
183 | #define LWIP_HTTPD_SUPPORT_V09 1 |
||
184 | #endif |
||
185 | |||
186 | /** Set this to 1 to enable HTTP/1.1 persistent connections. |
||
187 | * ATTENTION: If the generated file system includes HTTP headers, these must |
||
188 | * include the "Connection: keep-alive" header (pass argument "-11" to makefsdata). |
||
189 | */ |
||
190 | #if !defined LWIP_HTTPD_SUPPORT_11_KEEPALIVE || defined __DOXYGEN__ |
||
191 | #define LWIP_HTTPD_SUPPORT_11_KEEPALIVE 0 |
||
192 | #endif |
||
193 | |||
194 | /** Set this to 1 to support HTTP request coming in in multiple packets/pbufs */ |
||
195 | #if !defined LWIP_HTTPD_SUPPORT_REQUESTLIST || defined __DOXYGEN__ |
||
196 | #define LWIP_HTTPD_SUPPORT_REQUESTLIST 1 |
||
197 | #endif |
||
198 | |||
199 | #if LWIP_HTTPD_SUPPORT_REQUESTLIST |
||
200 | /** Number of rx pbufs to enqueue to parse an incoming request (up to the first |
||
201 | newline) */ |
||
202 | #if !defined LWIP_HTTPD_REQ_QUEUELEN || defined __DOXYGEN__ |
||
203 | #define LWIP_HTTPD_REQ_QUEUELEN 5 |
||
204 | #endif |
||
205 | |||
206 | /** Number of (TCP payload-) bytes (in pbufs) to enqueue to parse and incoming |
||
207 | request (up to the first double-newline) */ |
||
208 | #if !defined LWIP_HTTPD_REQ_BUFSIZE || defined __DOXYGEN__ |
||
209 | #define LWIP_HTTPD_REQ_BUFSIZE LWIP_HTTPD_MAX_REQ_LENGTH |
||
210 | #endif |
||
211 | |||
212 | /** Defines the maximum length of a HTTP request line (up to the first CRLF, |
||
213 | copied from pbuf into this a global buffer when pbuf- or packet-queues |
||
214 | are received - otherwise the input pbuf is used directly) */ |
||
215 | #if !defined LWIP_HTTPD_MAX_REQ_LENGTH || defined __DOXYGEN__ |
||
216 | #define LWIP_HTTPD_MAX_REQ_LENGTH LWIP_MIN(1023, (LWIP_HTTPD_REQ_QUEUELEN * PBUF_POOL_BUFSIZE)) |
||
217 | #endif |
||
218 | #endif /* LWIP_HTTPD_SUPPORT_REQUESTLIST */ |
||
219 | |||
220 | /** This is the size of a static buffer used when URIs end with '/'. |
||
221 | * In this buffer, the directory requested is concatenated with all the |
||
222 | * configured default file names. |
||
223 | * Set to 0 to disable checking default filenames on non-root directories. |
||
224 | */ |
||
225 | #if !defined LWIP_HTTPD_MAX_REQUEST_URI_LEN || defined __DOXYGEN__ |
||
226 | #define LWIP_HTTPD_MAX_REQUEST_URI_LEN 63 |
||
227 | #endif |
||
228 | |||
229 | /** Maximum length of the filename to send as response to a POST request, |
||
230 | * filled in by the application when a POST is finished. |
||
231 | */ |
||
232 | #if !defined LWIP_HTTPD_POST_MAX_RESPONSE_URI_LEN || defined __DOXYGEN__ |
||
233 | #define LWIP_HTTPD_POST_MAX_RESPONSE_URI_LEN 63 |
||
234 | #endif |
||
235 | |||
236 | /** Set this to 0 to not send the SSI tag (default is on, so the tag will |
||
237 | * be sent in the HTML page */ |
||
238 | #if !defined LWIP_HTTPD_SSI_INCLUDE_TAG || defined __DOXYGEN__ |
||
239 | #define LWIP_HTTPD_SSI_INCLUDE_TAG 1 |
||
240 | #endif |
||
241 | |||
242 | /** Set this to 1 to call tcp_abort when tcp_close fails with memory error. |
||
243 | * This can be used to prevent consuming all memory in situations where the |
||
244 | * HTTP server has low priority compared to other communication. */ |
||
245 | #if !defined LWIP_HTTPD_ABORT_ON_CLOSE_MEM_ERROR || defined __DOXYGEN__ |
||
246 | #define LWIP_HTTPD_ABORT_ON_CLOSE_MEM_ERROR 0 |
||
247 | #endif |
||
248 | |||
249 | /** Set this to 1 to kill the oldest connection when running out of |
||
250 | * memory for 'struct http_state' or 'struct http_ssi_state'. |
||
251 | * ATTENTION: This puts all connections on a linked list, so may be kind of slow. |
||
252 | */ |
||
253 | #if !defined LWIP_HTTPD_KILL_OLD_ON_CONNECTIONS_EXCEEDED || defined __DOXYGEN__ |
||
254 | #define LWIP_HTTPD_KILL_OLD_ON_CONNECTIONS_EXCEEDED 0 |
||
255 | #endif |
||
256 | |||
257 | /** Set this to 1 to send URIs without extension without headers |
||
258 | * (who uses this at all??) */ |
||
259 | #if !defined LWIP_HTTPD_OMIT_HEADER_FOR_EXTENSIONLESS_URI || defined __DOXYGEN__ |
||
260 | #define LWIP_HTTPD_OMIT_HEADER_FOR_EXTENSIONLESS_URI 0 |
||
261 | #endif |
||
262 | |||
263 | /** Default: Tags are sent from struct http_state and are therefore volatile */ |
||
264 | #if !defined HTTP_IS_TAG_VOLATILE || defined __DOXYGEN__ |
||
265 | #define HTTP_IS_TAG_VOLATILE(ptr) TCP_WRITE_FLAG_COPY |
||
266 | #endif |
||
267 | |||
268 | /* By default, the httpd is limited to send 2*pcb->mss to keep resource usage low |
||
269 | when http is not an important protocol in the device. */ |
||
270 | #if !defined HTTPD_LIMIT_SENDING_TO_2MSS || defined __DOXYGEN__ |
||
271 | #define HTTPD_LIMIT_SENDING_TO_2MSS 1 |
||
272 | #endif |
||
273 | |||
274 | /* Define this to a function that returns the maximum amount of data to enqueue. |
||
275 | The function have this signature: u16_t fn(struct altcp_pcb* pcb); |
||
276 | The best place to define this is the hooks file (@see LWIP_HOOK_FILENAME) */ |
||
277 | #if !defined HTTPD_MAX_WRITE_LEN || defined __DOXYGEN__ |
||
278 | #if HTTPD_LIMIT_SENDING_TO_2MSS |
||
279 | #define HTTPD_MAX_WRITE_LEN(pcb) ((u16_t)(2 * altcp_mss(pcb))) |
||
280 | #endif |
||
281 | #endif |
||
282 | |||
283 | /*------------------- FS OPTIONS -------------------*/ |
||
284 | |||
285 | /** Set this to 1 and provide the functions: |
||
286 | * - "int fs_open_custom(struct fs_file *file, const char *name)" |
||
287 | * Called first for every opened file to allow opening files |
||
288 | * that are not included in fsdata(_custom).c |
||
289 | * - "void fs_close_custom(struct fs_file *file)" |
||
290 | * Called to free resources allocated by fs_open_custom(). |
||
291 | */ |
||
292 | #if !defined LWIP_HTTPD_CUSTOM_FILES || defined __DOXYGEN__ |
||
293 | #define LWIP_HTTPD_CUSTOM_FILES 0 |
||
294 | #endif |
||
295 | |||
296 | /** Set this to 1 to support fs_read() to dynamically read file data. |
||
297 | * Without this (default=off), only one-block files are supported, |
||
298 | * and the contents must be ready after fs_open(). |
||
299 | */ |
||
300 | #if !defined LWIP_HTTPD_DYNAMIC_FILE_READ || defined __DOXYGEN__ |
||
301 | #define LWIP_HTTPD_DYNAMIC_FILE_READ 0 |
||
302 | #endif |
||
303 | |||
304 | /** Set this to 1 to include an application state argument per file |
||
305 | * that is opened. This allows to keep a state per connection/file. |
||
306 | */ |
||
307 | #if !defined LWIP_HTTPD_FILE_STATE || defined __DOXYGEN__ |
||
308 | #define LWIP_HTTPD_FILE_STATE 0 |
||
309 | #endif |
||
310 | |||
311 | /** HTTPD_PRECALCULATED_CHECKSUM==1: include precompiled checksums for |
||
312 | * predefined (MSS-sized) chunks of the files to prevent having to calculate |
||
313 | * the checksums at runtime. */ |
||
314 | #if !defined HTTPD_PRECALCULATED_CHECKSUM || defined __DOXYGEN__ |
||
315 | #define HTTPD_PRECALCULATED_CHECKSUM 0 |
||
316 | #endif |
||
317 | |||
318 | /** LWIP_HTTPD_FS_ASYNC_READ==1: support asynchronous read operations |
||
319 | * (fs_read_async returns FS_READ_DELAYED and calls a callback when finished). |
||
320 | */ |
||
321 | #if !defined LWIP_HTTPD_FS_ASYNC_READ || defined __DOXYGEN__ |
||
322 | #define LWIP_HTTPD_FS_ASYNC_READ 0 |
||
323 | #endif |
||
324 | |||
325 | /** Filename (including path) to use as FS data file */ |
||
326 | #if !defined HTTPD_FSDATA_FILE || defined __DOXYGEN__ |
||
327 | /* HTTPD_USE_CUSTOM_FSDATA: Compatibility with deprecated lwIP option */ |
||
328 | #if defined(HTTPD_USE_CUSTOM_FSDATA) && (HTTPD_USE_CUSTOM_FSDATA != 0) |
||
329 | #define HTTPD_FSDATA_FILE "fsdata_custom.c" |
||
330 | #else |
||
331 | #define HTTPD_FSDATA_FILE "fsdata.c" |
||
332 | #endif |
||
333 | #endif |
||
334 | |||
335 | /** |
||
336 | * @} |
||
337 | */ |
||
338 | |||
339 | #endif /* LWIP_HDR_APPS_HTTPD_OPTS_H */ |