summaryrefslogtreecommitdiff
path: root/apps/netutils
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2013-02-26 16:28:30 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2013-02-26 16:28:30 +0000
commitd681635b85e4a498dafd8822af19e0d5cd7f8f2f (patch)
tree1a01cc6fb1877f89a28b64b2d1576a1cd38fbffd /apps/netutils
parent8fd4abf5ec0512bcdc43a3909bb3d691aa328e53 (diff)
downloadnuttx-d681635b85e4a498dafd8822af19e0d5cd7f8f2f.tar.gz
nuttx-d681635b85e4a498dafd8822af19e0d5cd7f8f2f.tar.bz2
nuttx-d681635b85e4a498dafd8822af19e0d5cd7f8f2f.zip
Add a THTTPD configuratin for zkit-arm-1769
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5675 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'apps/netutils')
-rw-r--r--apps/netutils/thttpd/Kconfig147
-rw-r--r--apps/netutils/thttpd/config.h6
-rw-r--r--apps/netutils/thttpd/libhttpd.c5
-rw-r--r--apps/netutils/thttpd/thttpd_cgi.c2
4 files changed, 116 insertions, 44 deletions
diff --git a/apps/netutils/thttpd/Kconfig b/apps/netutils/thttpd/Kconfig
index aa3751839..d181ec886 100644
--- a/apps/netutils/thttpd/Kconfig
+++ b/apps/netutils/thttpd/Kconfig
@@ -133,16 +133,26 @@ config THTTPD_INDEX_NAMES
A list of index filenames to check. The files are searched for
in this order. Default: "\"index.html\", \"index.htm\", \"index.cgi\""
+config THTTPD_USE_AUTH_FILE
+ bool "Use authentication file"
+ default n
+ ---help---
+ Select to define an authentication file that thttpd will check 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.
+
config AUTH_FILE
string "Authorization file"
-# default ".htpasswd"
+ default ".htpasswd"
+ depends on THTTPD_USE_AUTH_FILE
---help---
- 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"
+ The file to use for authentication. 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. A
+ typical value is ".htpasswd"
config THTTPD_LISTEN_BACKLOG
int "Listen backlog"
@@ -185,56 +195,117 @@ config THTTPD_IDLE_SEND_LIMIT_SEC
How many seconds before an idle connection gets closed.
Default: 300
-config THTTPD_TILDE_MAP1
- string "Tilde mapping"
+choice
+ prompt "Tilde Mapping"
+ default THTTPD_TILDE_MAP_NONE
---help---
- Tilde mapping.
+ 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.
- Many URLs use ~username to indicate a user's home directory. thttpd
- provides two options for mapping this construct to an actual filename.
+ 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.
+
+ The prefix could be something like "users", or it could be empty.
- 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. The prefix could be something like "users",
- or it could be empty.
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".
+ the name of a subdirectory off of the user's actual home dir,
+ something like "public_html".
- You can also leave both options undefined, and thttpd will not do
- anything special about tildes. Enabling both options is an error.
- Typical values, if they're defined, are "users" for
- config THTTPD_TILDE_MAP1 and "public_html" for THTTPD_TILDE_MAP2.
+ 3) Niether. You can also leave both options undefined, and thttpd
+ will not do anything special about tildes. Enabling both options
+ is an error.
-config THTTPD_TILDE_MAP2
- string "Tilde mapping"
+ Typical values, if they're defined, are "users" for THTTPD_TILDE_MAP1
+ and "public_html" for THTTPD_TILDE_MAP2.
+
+config THTTPD_USE_TILDE_MAP1
+ bool "Tilde mapping 1"
---help---
- Tilde mapping.
+ 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. Choose this option for the first mapping:
- Many URLs use ~username to indicate a user's home directory. thttpd
- provides two options for mapping this construct to an actual filename.
+ 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.
+
+ The prefix could be something like "users", or it could be empty.
+
+config THTTPD_USE_TILDE_MAP2
+ bool "Tilde mapping 2"
+ ---help---
+ 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. Choose this option for the second mapping:
- 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. The prefix could be something like "users",
- or it could be empty.
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".
+ the name of a subdirectory off of the user's actual home dir,
+ something like "public_html".
- You can also leave both options undefined, and thttpd will not do
- anything special about tildes. Enabling both options is an error.
- Typical values, if they're defined, are "users" for
- config THTTPD_TILDE_MAP1 and "public_html" for THTTPD_TILDE_MAP2.
+ The typical value THTTPD_TILDE_MAP2 is "public_html".
+
+config THTTPD_TILDE_MAP_NONE
+ bool "No tilde mapping"
+ ---help---
+ 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. Choose this option to omit tilde mapping: thttpd
+ will not do anything special about tildes.
+
+endchoice
+
+config THTTPD_TILDE_MAP1
+ string "Tilde mapping 1"
+ default "user"
+ depends on THTTPD_USE_TILDE_MAP1
+ ---help---
+ 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. Choose this option defines the <prefix> string
+ for the first mapping:
+
+ 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.
+
+ The prefix could be something like "users", or it could be empty.
+
+config THTTPD_TILDE_MAP2
+ string "Tilde mapping 2"
+ default "public_html"
+ depends on THTTPD_USE_TILDE_MAP2
+ ---help---
+ 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. Choose this option defines the <postfix> string
+ for the second mapping:
+
+ 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".
+
+ The typical value THTTPD_TILDE_MAP2 is "public_html".
config THTTPD_GENERATE_INDICES
bool "Generate name indices"
default n
---help---
+config THTTPD_USE_URLPATTERN
+ bool "Use URL pattern"
+ default n
+ ---help---
+ Select to define a URL pattern that will be used to match and verify
+ referrers.
+
config THTTPD_URLPATTERN
string "URL pattern"
+ default ""
+ depends on THTTPD_USE_URLPATTERN
---help---
- If defined, then it will be used to match and verify referrers.
+ This string defines the UARL pattern that will be used to match and
+ verify referrers.
endif
diff --git a/apps/netutils/thttpd/config.h b/apps/netutils/thttpd/config.h
index d238fabd8..32908cc16 100644
--- a/apps/netutils/thttpd/config.h
+++ b/apps/netutils/thttpd/config.h
@@ -158,11 +158,11 @@
# endif
# ifndef CONFIG_THTTPD_CGIINBUFFERSIZE
-# define CONFIG_THTTPD_CGIINBUFFERSIZE 512 /* Size of buffer to interpose input */
+# define CONFIG_THTTPD_CGIINBUFFERSIZE 512 /* Size of buffer to interpose input */
# endif
# ifndef CONFIG_THTTPD_CGIOUTBUFFERSIZE
-# define CONFIG_THTTPD_CGIOUTBUFFERSIZE 512 /* Size of buffer to interpose output */
+# define CONFIG_THTTPD_CGIOUTBUFFERSIZE 512 /* Size of buffer to interpose output */
# endif
# if CONFIG_THTTPD_IOBUFFERSIZE > 65535
@@ -236,7 +236,7 @@
*/
# if defined(CONFIG_THTTPD_TILDE_MAP1) && defined(CONFIG_THTTPD_TILDE_MAP2)
-# error "Both CONFIG_THTTPD_TILDE_MAP1 andCONFIG_THTTPD_TILDE_MAP2 are defined"
+# error "Both CONFIG_THTTPD_TILDE_MAP1 and CONFIG_THTTPD_TILDE_MAP2 are defined"
# endif
/* If CONFIG_THTTPD_URLPATTERN is defined, then it will be used to match and verify
diff --git a/apps/netutils/thttpd/libhttpd.c b/apps/netutils/thttpd/libhttpd.c
index 9bb4e242f..34f829a28 100644
--- a/apps/netutils/thttpd/libhttpd.c
+++ b/apps/netutils/thttpd/libhttpd.c
@@ -2,7 +2,7 @@
* netutils/thttpd/libhttpd.c
* HTTP Protocol Library
*
- * Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2009, 2011, 2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Derived from the file of the same name in the original THTTPD package:
@@ -1913,8 +1913,9 @@ static int check_referer(httpd_conn *hc)
/* Are we doing referer checking at all? */
#ifdef CONFIG_THTTPD_URLPATTERN
- int r;
char *cp;
+ int r;
+ int child;
child = really_check_referer(hc);
diff --git a/apps/netutils/thttpd/thttpd_cgi.c b/apps/netutils/thttpd/thttpd_cgi.c
index 32aae5526..9e63b25b4 100644
--- a/apps/netutils/thttpd/thttpd_cgi.c
+++ b/apps/netutils/thttpd/thttpd_cgi.c
@@ -856,7 +856,7 @@ static int cgi_child(int argc, char **argv)
/* Run the CGI program. */
nllvdbg("Starting CGI: %s\n", hc->expnfilename);
- child = exec(hc->expnfilename, (FAR const char **)argp, g_thttpdsymtab, g_thttpdnsymbols);
+ child = exec(hc->expnfilename, (FAR char * const *)argp, g_thttpdsymtab, g_thttpdnsymbols);
if (child < 0)
{
/* Something went wrong. */