2011-03-19 22:04:13 +01:00
|
|
|
/****************************************************************************
|
2021-06-11 12:06:42 +02:00
|
|
|
* apps/netutils/thttpd/config.h
|
2011-03-19 22:04:13 +01:00
|
|
|
*
|
2021-06-11 06:22:42 +02:00
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed with
|
|
|
|
* this work for additional information regarding copyright ownership. The
|
|
|
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
|
|
|
* "License"); you may not use this file except in compliance with the
|
|
|
|
* License. You may obtain a copy of the License at
|
2011-03-19 22:04:13 +01:00
|
|
|
*
|
2021-06-11 06:22:42 +02:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
2011-03-19 22:04:13 +01:00
|
|
|
*
|
2021-06-11 06:22:42 +02:00
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
|
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
|
|
* License for the specific language governing permissions and limitations
|
|
|
|
* under the License.
|
2011-03-19 22:04:13 +01:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2022-01-16 03:31:55 +01:00
|
|
|
#ifndef __APPS_NETUTILS_THTTPD_CONFIG_H
|
|
|
|
#define __APPS_NETUTILS_THTTPD_CONFIG_H
|
2011-03-19 22:04:13 +01:00
|
|
|
|
|
|
|
/****************************************************************************
|
2021-06-11 12:06:42 +02:00
|
|
|
* Included Files
|
2011-03-19 22:04:13 +01:00
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#include <nuttx/config.h>
|
|
|
|
#include <nuttx/compiler.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Pre-processor Definitions
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/* Make sure that the system is configured to handle THTTPD */
|
|
|
|
|
|
|
|
#undef CONFIG_THTTPD
|
|
|
|
#if defined(CONFIG_NET) && defined(CONFIG_NET_TCP) && \
|
2022-01-31 16:45:25 +01:00
|
|
|
defined(CONFIG_NET_TCPBACKLOG) && !defined(CONFIG_DISABLE_ENVIRON)
|
2011-03-19 22:04:13 +01:00
|
|
|
|
|
|
|
# define CONFIG_THTTPD 1
|
|
|
|
|
|
|
|
/* Check all THTTPD configuration settings. Complain on any that should have
|
|
|
|
* been defined but were not. Supply some kind of reasonable value for all
|
|
|
|
* undefined settings.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* Server port number */
|
|
|
|
|
|
|
|
# ifndef CONFIG_THTTPD_PORT
|
|
|
|
# define CONFIG_THTTPD_PORT 80
|
|
|
|
# endif
|
|
|
|
|
|
|
|
/* Server IP address (no host name) */
|
|
|
|
|
|
|
|
# ifndef CONFIG_THTTPD_IPADDR
|
|
|
|
# ifdef CONFIG_CPP_HAVE_WARNING
|
|
|
|
# warning "CONFIG_THTTPD_IPADDR not defined"
|
|
|
|
# endif
|
|
|
|
# define CONFIG_THTTPD_IPADDR (10<<24|0<<16|0<<8|2)
|
|
|
|
# endif
|
|
|
|
|
|
|
|
/* SERVER_ADDRESS: response */
|
|
|
|
|
|
|
|
# ifndef CONFIG_THTTPD_SERVER_ADDRESS
|
|
|
|
# define CONFIG_THTTPD_SERVER_ADDRESS "http://www.nuttx.org"
|
|
|
|
# endif
|
|
|
|
|
|
|
|
/* SERVER_SOFTWARE: response */
|
|
|
|
|
|
|
|
# ifndef CONFIG_THTTPD_SERVER_SOFTWARE
|
|
|
|
# define CONFIG_THTTPD_SERVER_SOFTWARE "thttpd/2.25b 29dec2003-NuttX"
|
|
|
|
# endif
|
|
|
|
|
|
|
|
# ifndef CONFIG_THTTPD_PATH
|
|
|
|
# ifdef CONFIG_CPP_HAVE_WARNING
|
|
|
|
# warning "CONFIG_THTTPD_PATH not defined"
|
|
|
|
# endif
|
|
|
|
# define CONFIG_THTTPD_PATH "/mnt/www"
|
|
|
|
# endif
|
|
|
|
|
|
|
|
# ifndef CONFIG_THTTPD_CGI_PATH
|
|
|
|
# ifdef CONFIG_CPP_HAVE_WARNING
|
|
|
|
# warning "CONFIG_THTTPD_CGI_PATH not defined"
|
|
|
|
# endif
|
|
|
|
# define CONFIG_THTTPD_CGI_PATH "/mnt/www/cgi-bin"
|
|
|
|
# endif
|
|
|
|
|
2021-06-11 12:06:42 +02:00
|
|
|
/* Only CGI programs whose fully expanded paths match this pattern will be
|
|
|
|
* executed. In fact, if this value is not defined then no CGI logic will
|
|
|
|
* be built.
|
2011-03-19 22:04:13 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
# ifndef CONFIG_THTTPD_CGI_PATTERN
|
|
|
|
# define CONFIG_THTTPD_CGI_PATTERN "/mnt/www/cgi-bin/*"
|
|
|
|
# endif
|
|
|
|
|
2021-06-11 12:06:42 +02:00
|
|
|
/* These provide the priority and stack size of the CGI child tasks
|
|
|
|
*/
|
2011-03-19 22:04:13 +01:00
|
|
|
|
|
|
|
# ifndef CONFIG_THTTPD_CGI_PRIORITY
|
|
|
|
# define CONFIG_THTTPD_CGI_PRIORITY 50
|
|
|
|
# endif
|
|
|
|
|
|
|
|
# ifndef CONFIG_THTTPD_CGI_STACKSIZE
|
|
|
|
# define CONFIG_THTTPD_CGI_STACKSIZE 2048
|
|
|
|
# endif
|
|
|
|
|
2021-06-11 12:06:42 +02:00
|
|
|
/* Byte output limit for CGI tasks
|
|
|
|
*/
|
2011-03-19 22:04:13 +01:00
|
|
|
|
|
|
|
# ifndef CONFIG_THTTPD_CGI_BYTECOUNT
|
|
|
|
# define CONFIG_THTTPD_CGI_BYTECOUNT 200000
|
|
|
|
# endif
|
|
|
|
|
2021-06-11 12:06:42 +02:00
|
|
|
/* How many seconds to allow CGI programs to run before killing them.
|
|
|
|
*/
|
2011-03-19 22:04:13 +01:00
|
|
|
|
|
|
|
# ifndef CONFIG_THTTPD_CGI_TIMELIMIT
|
|
|
|
# define CONFIG_THTTPD_CGI_TIMELIMIT 0 /* No time limit */
|
|
|
|
# endif
|
|
|
|
|
2021-06-11 12:06:42 +02:00
|
|
|
/* The default character set name to use with text MIME types.
|
|
|
|
*/
|
2011-03-19 22:04:13 +01:00
|
|
|
|
|
|
|
# ifndef CONFIG_THTTPD_CHARSET
|
|
|
|
# define CONFIG_THTTPD_CHARSET "iso-8859-1"
|
|
|
|
# endif
|
|
|
|
|
2021-06-11 12:06:42 +02:00
|
|
|
/* Initial buffer size, buffer reallocation increment, maximum buffer size
|
|
|
|
*/
|
2011-03-19 22:04:13 +01:00
|
|
|
|
|
|
|
# ifndef CONFIG_THTTPD_IOBUFFERSIZE
|
|
|
|
# define CONFIG_THTTPD_IOBUFFERSIZE 256
|
|
|
|
# endif
|
|
|
|
|
|
|
|
# ifndef CONFIG_THTTPD_MINSTRSIZE
|
|
|
|
# define CONFIG_THTTPD_MINSTRSIZE 64
|
|
|
|
# endif
|
|
|
|
|
|
|
|
# ifndef CONFIG_THTTPD_REALLOCINCR
|
|
|
|
# define CONFIG_THTTPD_REALLOCINCR 64
|
|
|
|
# endif
|
|
|
|
|
|
|
|
# ifndef CONFIG_THTTPD_MAXREALLOC
|
|
|
|
# define CONFIG_THTTPD_MAXREALLOC 4096
|
|
|
|
# endif
|
|
|
|
|
|
|
|
# ifndef CONFIG_THTTPD_CGIINBUFFERSIZE
|
2013-02-26 17:28:30 +01:00
|
|
|
# define CONFIG_THTTPD_CGIINBUFFERSIZE 512 /* Size of buffer to interpose input */
|
2011-03-19 22:04:13 +01:00
|
|
|
# endif
|
|
|
|
|
|
|
|
# ifndef CONFIG_THTTPD_CGIOUTBUFFERSIZE
|
2013-02-26 17:28:30 +01:00
|
|
|
# define CONFIG_THTTPD_CGIOUTBUFFERSIZE 512 /* Size of buffer to interpose output */
|
2011-03-19 22:04:13 +01:00
|
|
|
# endif
|
|
|
|
|
|
|
|
# if CONFIG_THTTPD_IOBUFFERSIZE > 65535
|
|
|
|
# error "Can't use uint16_t for buffer size"
|
|
|
|
# endif
|
|
|
|
|
2021-06-11 12:06:42 +02:00
|
|
|
/* A list of index filenames to check.
|
|
|
|
* The files are searched for in this order.
|
|
|
|
*/
|
2011-03-19 22:04:13 +01:00
|
|
|
|
|
|
|
# ifndef CONFIG_THTTPD_INDEX_NAMES
|
|
|
|
# define CONFIG_THTTPD_INDEX_NAMES "index.html", "index.htm", "index.cgi"
|
|
|
|
# endif
|
|
|
|
|
2021-06-11 12:06:42 +02:00
|
|
|
/* CONFIG_AUTH_FILE - The file to use for authentication. If this is defined
|
|
|
|
* then thttpd checks for this file in the local directory before every
|
|
|
|
* fetch. If the file exists then authentication is done, otherwise the
|
|
|
|
* fetch proceeds as usual.
|
|
|
|
* If you leave this undefined then thttpd will not implement
|
|
|
|
* authentication at all and will not check for auth files, which saves a
|
|
|
|
* bit of CPU time. A typical value is ".htpasswd"
|
2011-03-19 22:04:13 +01:00
|
|
|
*/
|
|
|
|
|
2021-06-11 12:06:42 +02:00
|
|
|
/* The listen() backlog queue length.
|
|
|
|
*/
|
2011-03-19 22:04:13 +01:00
|
|
|
|
|
|
|
# ifndef CONFIG_THTTPD_LISTEN_BACKLOG
|
|
|
|
# define CONFIG_THTTPD_LISTEN_BACKLOG 8
|
|
|
|
# endif
|
|
|
|
|
2021-06-11 12:06:42 +02:00
|
|
|
/* How many milliseconds to leave a connection open while doing a lingering
|
|
|
|
* close
|
|
|
|
*/
|
2011-03-19 22:04:13 +01:00
|
|
|
|
|
|
|
# ifndef CONFIG_THTTPD_LINGER_MSEC
|
|
|
|
# define CONFIG_THTTPD_LINGER_MSEC 500
|
|
|
|
# endif
|
|
|
|
|
2021-06-11 12:06:42 +02:00
|
|
|
/* How often to run the occasional cleanup job.
|
|
|
|
*/
|
2011-03-19 22:04:13 +01:00
|
|
|
|
|
|
|
# ifndef CONFIG_THTTPD_OCCASIONAL_MSEC
|
|
|
|
# define CONFIG_THTTPD_OCCASIONAL_MSEC 120 /* Two minutes */
|
|
|
|
# endif
|
|
|
|
|
2021-06-11 12:06:42 +02:00
|
|
|
/* How many seconds to allow for reading the initial request on a new
|
|
|
|
* connection.
|
|
|
|
*/
|
2011-03-19 22:04:13 +01:00
|
|
|
|
|
|
|
# ifndef CONFIG_THTTPD_IDLE_READ_LIMIT_SEC
|
|
|
|
# define CONFIG_THTTPD_IDLE_READ_LIMIT_SEC 300
|
|
|
|
# endif
|
|
|
|
|
2021-06-11 12:06:42 +02:00
|
|
|
/* How many seconds before an idle connection gets closed.
|
|
|
|
*/
|
2011-03-19 22:04:13 +01:00
|
|
|
|
|
|
|
# ifndef CONFIG_THTTPD_IDLE_SEND_LIMIT_SEC
|
|
|
|
# define CONFIG_THTTPD_IDLE_SEND_LIMIT_SEC 300
|
|
|
|
# endif
|
|
|
|
|
2021-06-11 12:06:42 +02:00
|
|
|
/* Memory debug instrumentation depends on other debug options
|
|
|
|
*/
|
2011-03-19 22:04:13 +01:00
|
|
|
|
2016-06-11 22:13:39 +02:00
|
|
|
# if (!defined(CONFIG_DEBUG_FEATURES) || !defined(CONFIG_DEBUG_NET)) && defined(CONFIG_THTTPD_MEMDEBUG)
|
2015-06-02 23:19:17 +02:00
|
|
|
# undef CONFIG_THTTPD_MEMDEBUG
|
|
|
|
# endif
|
2011-03-19 22:04:13 +01:00
|
|
|
|
2021-06-11 12:06:42 +02:00
|
|
|
/* Tilde mapping.
|
|
|
|
* Many URLs use ~username to indicate a user's home directory.
|
|
|
|
* thttpd provides two options for mapping this construct to an actual
|
|
|
|
* filename.
|
2011-03-19 22:04:13 +01:00
|
|
|
*
|
2021-06-11 12:06:42 +02:00
|
|
|
* 1) Map ~username to <prefix>/username. This is the recommended choice.
|
|
|
|
* Each user gets a subdirectory in the main web tree, and the tilde
|
|
|
|
* construct points there.
|
2011-03-19 22:04:13 +01:00
|
|
|
* The prefix could be something like "users", or it could be empty.
|
2021-06-11 12:06:42 +02:00
|
|
|
* 2) Map ~username to <user's homedir>/<postfix>. The postfix would be
|
|
|
|
* the name of a subdirectory off of the user's actual home dir, something
|
|
|
|
* like "public_html".
|
2011-03-19 22:04:13 +01:00
|
|
|
*
|
2021-06-11 12:06:42 +02:00
|
|
|
* You can also leave both options undefined, and thttpd will not do anything
|
|
|
|
* special about tildes. Enabling both options is an error.
|
2011-03-19 22:04:13 +01:00
|
|
|
*
|
2021-06-11 12:06:42 +02:00
|
|
|
* Typical values, if they're defined, are "users" for
|
|
|
|
* CONFIG_THTTPD_TILDE_MAP1 and "public_html" for CONFIG_THTTPD_TILDE_MAP2.
|
2011-03-19 22:04:13 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
# if defined(CONFIG_THTTPD_TILDE_MAP1) && defined(CONFIG_THTTPD_TILDE_MAP2)
|
2013-02-26 17:28:30 +01:00
|
|
|
# error "Both CONFIG_THTTPD_TILDE_MAP1 and CONFIG_THTTPD_TILDE_MAP2 are defined"
|
2011-03-19 22:04:13 +01:00
|
|
|
# endif
|
|
|
|
|
2021-06-11 12:06:42 +02:00
|
|
|
/* If CONFIG_THTTPD_URLPATTERN is defined, then it will be used to match and
|
|
|
|
* verify referrers.
|
2011-03-19 22:04:13 +01:00
|
|
|
*/
|
|
|
|
|
2022-01-16 03:31:55 +01:00
|
|
|
#else /* Dependencies not provided */
|
2011-03-19 22:04:13 +01:00
|
|
|
# ifdef CONFIG_CPP_HAVE_WARNING
|
|
|
|
# warning "THTTPD not built because dependencies not selected in configuration"
|
|
|
|
# endif
|
2020-01-31 16:18:05 +01:00
|
|
|
#endif /* Dependencies not provided */
|
2011-03-19 22:04:13 +01:00
|
|
|
|
2022-01-16 03:31:55 +01:00
|
|
|
#endif /* __APPS_NETUTILS_THTTPD_CONFIG_H */
|