aboutsummaryrefslogtreecommitdiff
path: root/networking/httpd.c
diff options
context:
space:
mode:
authorSergey Ponomarev <stokito@gmail.com>2021-08-25 23:12:37 +0300
committerDenys Vlasenko <vda.linux@googlemail.com>2021-09-09 21:42:48 +0200
commit82c5eb8e4681ba345500e5c368fb54741bb0c450 (patch)
treec07e755a12962fab796bb06d351caa0227a3fd4c /networking/httpd.c
parent857800c65584d544242c54eb873129c23ba20265 (diff)
downloadbusybox-w32-82c5eb8e4681ba345500e5c368fb54741bb0c450.tar.gz
busybox-w32-82c5eb8e4681ba345500e5c368fb54741bb0c450.tar.bz2
busybox-w32-82c5eb8e4681ba345500e5c368fb54741bb0c450.zip
httpd,telnetd: make default port configurable
BusyBox on Termux can't use ports less than 1024 it's patched to change default port for httpd to 8080 and telnetd to 8023. https://github.com/termux/termux-packages/blob/master/packages/busybox/0011-networking-telnetd-default-port.patch https://github.com/termux/termux-packages/blob/master/packages/busybox/0010-networking-httpd-default-port.patch To avoid such patches we can make port configurable. function old new delta packed_usage 33920 33914 -6 Signed-off-by: Sergey Ponomarev <stokito@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'networking/httpd.c')
-rw-r--r--networking/httpd.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/networking/httpd.c b/networking/httpd.c
index 56ab85b82..9972a5378 100644
--- a/networking/httpd.c
+++ b/networking/httpd.c
@@ -102,6 +102,11 @@
102//config: help 102//config: help
103//config: HTTP server. 103//config: HTTP server.
104//config: 104//config:
105//config:config FEATURE_HTTPD_PORT_DEFAULT
106//config: int "Default port"
107//config: default 80
108//config: range 1 65535
109//config:
105//config:config FEATURE_HTTPD_RANGES 110//config:config FEATURE_HTTPD_RANGES
106//config: bool "Support 'Ranges:' header" 111//config: bool "Support 'Ranges:' header"
107//config: default y 112//config: default y
@@ -270,7 +275,7 @@
270//usage: "\n -i Inetd mode" 275//usage: "\n -i Inetd mode"
271//usage: "\n -f Don't daemonize" 276//usage: "\n -f Don't daemonize"
272//usage: "\n -v[v] Verbose" 277//usage: "\n -v[v] Verbose"
273//usage: "\n -p [IP:]PORT Bind to IP:PORT (default *:80)" 278//usage: "\n -p [IP:]PORT Bind to IP:PORT (default *:"STR(CONFIG_FEATURE_HTTPD_PORT_DEFAULT)")"
274//usage: IF_FEATURE_HTTPD_SETUID( 279//usage: IF_FEATURE_HTTPD_SETUID(
275//usage: "\n -u USER[:GRP] Set uid/gid after binding to port") 280//usage: "\n -u USER[:GRP] Set uid/gid after binding to port")
276//usage: IF_FEATURE_HTTPD_BASIC_AUTH( 281//usage: IF_FEATURE_HTTPD_BASIC_AUTH(
@@ -316,6 +321,9 @@
316 321
317#define HEADER_READ_TIMEOUT 60 322#define HEADER_READ_TIMEOUT 60
318 323
324#define STR1(s) #s
325#define STR(s) STR1(s)
326
319static const char DEFAULT_PATH_HTTPD_CONF[] ALIGN1 = "/etc"; 327static const char DEFAULT_PATH_HTTPD_CONF[] ALIGN1 = "/etc";
320static const char HTTPD_CONF[] ALIGN1 = "httpd.conf"; 328static const char HTTPD_CONF[] ALIGN1 = "httpd.conf";
321static const char HTTP_200[] ALIGN1 = "HTTP/1.1 200 OK\r\n"; 329static const char HTTP_200[] ALIGN1 = "HTTP/1.1 200 OK\r\n";
@@ -542,7 +550,7 @@ enum {
542 SET_PTR_TO_GLOBALS(xzalloc(sizeof(G))); \ 550 SET_PTR_TO_GLOBALS(xzalloc(sizeof(G))); \
543 IF_FEATURE_HTTPD_BASIC_AUTH(g_realm = "Web Server Authentication";) \ 551 IF_FEATURE_HTTPD_BASIC_AUTH(g_realm = "Web Server Authentication";) \
544 IF_FEATURE_HTTPD_RANGES(range_start = -1;) \ 552 IF_FEATURE_HTTPD_RANGES(range_start = -1;) \
545 bind_addr_or_port = "80"; \ 553 bind_addr_or_port = STR(CONFIG_FEATURE_HTTPD_PORT_DEFAULT); \
546 index_page = index_html; \ 554 index_page = index_html; \
547 file_size = -1; \ 555 file_size = -1; \
548} while (0) 556} while (0)