aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2007-08-14 16:50:01 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2007-08-14 16:50:01 +0000
commit0372f0f1999ace825a2265ad03b80be627b039fb (patch)
treedad5e396079ce4432219dfc3f26762040d23f5cb
parent3d17d2b430a6a68c967b789c990cc441154d695e (diff)
downloadbusybox-w32-0372f0f1999ace825a2265ad03b80be627b039fb.tar.gz
busybox-w32-0372f0f1999ace825a2265ad03b80be627b039fb.tar.bz2
busybox-w32-0372f0f1999ace825a2265ad03b80be627b039fb.zip
httpd: extend -p PORT to -p [IP[v6]:]PORT
httpd: comment out strange code which "closes connection properly" (isnt exit(0) good enough?) handle_incoming_and_exit - 2246 +2246 httpd_main 1116 1141 +25 getLine 75 77 +2 packed_usage 22827 22811 -16 parse_conf 1303 1284 -19 shutdown 32 - -32 handleIncoming 2578 - -2578 ------------------------------------------------------------------------------ (add/remove: 1/2 grow/shrink: 2/2 up/down: 2273/-2645) Total: -372 bytes text data bss dec hex filename 774704 1058 11092 786854 c01a6 busybox_old 774335 1058 11092 786485 c0035 busybox_unstripped
-rw-r--r--TODO_config_nommu1
-rw-r--r--include/usage.h24
-rw-r--r--networking/httpd.c219
-rw-r--r--scripts/defconfig1
4 files changed, 108 insertions, 137 deletions
diff --git a/TODO_config_nommu b/TODO_config_nommu
index bffe4f4f5..9f747a39d 100644
--- a/TODO_config_nommu
+++ b/TODO_config_nommu
@@ -606,7 +606,6 @@ CONFIG_APP_UDHCPD=y
606CONFIG_APP_DHCPRELAY=y 606CONFIG_APP_DHCPRELAY=y
607CONFIG_APP_DUMPLEASES=y 607CONFIG_APP_DUMPLEASES=y
608# CONFIG_APP_UDHCPC is not set 608# CONFIG_APP_UDHCPC is not set
609CONFIG_FEATURE_UDHCP_SYSLOG=y
610# CONFIG_FEATURE_UDHCP_DEBUG is not set 609# CONFIG_FEATURE_UDHCP_DEBUG is not set
611CONFIG_FEATURE_RFC3397=y 610CONFIG_FEATURE_RFC3397=y
612CONFIG_VCONFIG=y 611CONFIG_VCONFIG=y
diff --git a/include/usage.h b/include/usage.h
index 1d4459df1..41459e8c3 100644
--- a/include/usage.h
+++ b/include/usage.h
@@ -1352,21 +1352,21 @@
1352 " [-h home]" \ 1352 " [-h home]" \
1353 " [-d/-e string]" 1353 " [-d/-e string]"
1354#define httpd_full_usage \ 1354#define httpd_full_usage \
1355 "Listen for incoming http server requests" \ 1355 "Listen for incoming HTTP requests" \
1356 "\n\nOptions:\n" \ 1356 "\n\nOptions:" \
1357 " -c FILE Specifies configuration file. (default httpd.conf)\n" \ 1357 "\n -c FILE Configuration file (default httpd.conf)" \
1358 " -p PORT Server port (default 80)\n" \ 1358 "\n -p PORT Server port (default 80)" \
1359 " -i Assume that we are started from inetd\n" \ 1359 "\n -i Inetd mode" \
1360 " -f Do not daemonize\n" \ 1360 "\n -f Do not daemonize" \
1361 USE_FEATURE_HTTPD_SETUID( \ 1361 USE_FEATURE_HTTPD_SETUID( \
1362 " -u USER[:GRP] Set uid/gid after binding to port\n") \ 1362 "\n -u USER[:GRP] Set uid/gid after binding to port") \
1363 USE_FEATURE_HTTPD_BASIC_AUTH( \ 1363 USE_FEATURE_HTTPD_BASIC_AUTH( \
1364 " -r REALM Authentication Realm for Basic Authentication\n") \ 1364 "\n -r REALM Authentication Realm for Basic Authentication") \
1365 USE_FEATURE_HTTPD_AUTH_MD5( \ 1365 USE_FEATURE_HTTPD_AUTH_MD5( \
1366 " -m PASS Crypt PASS with md5 algorithm\n") \ 1366 "\n -m PASS Crypt PASS with md5 algorithm") \
1367 " -h HOME Specifies http HOME directory (default ./)\n" \ 1367 "\n -h HOME Home directory (default .)" \
1368 " -e STRING HTML encode STRING\n" \ 1368 "\n -e STRING HTML encode STRING" \
1369 " -d STRING URL decode STRING" 1369 "\n -d STRING URL decode STRING"
1370 1370
1371#define hwclock_trivial_usage \ 1371#define hwclock_trivial_usage \
1372 "[-r|--show] [-s|--hctosys] [-w|--systohc]" \ 1372 "[-r|--show] [-s|--hctosys] [-w|--systohc]" \
diff --git a/networking/httpd.c b/networking/httpd.c
index 9c02ad679..875b9d641 100644
--- a/networking/httpd.c
+++ b/networking/httpd.c
@@ -114,19 +114,19 @@ static const char httpd_conf[] ALIGN1 = "httpd.conf";
114//#define DEBUG 1 114//#define DEBUG 1
115#define DEBUG 0 115#define DEBUG 0
116 116
117#define MAX_MEMORY_BUFF 8192 /* IO buffer */ 117#define MAX_MEMORY_BUF 8192 /* IO buffer */
118 118
119typedef struct HT_ACCESS { 119typedef struct Htaccess {
120 char *after_colon; 120 char *after_colon;
121 struct HT_ACCESS *next; 121 struct Htaccess *next;
122 char before_colon[1]; /* really bigger, must last */ 122 char before_colon[1]; /* really bigger, must be last */
123} Htaccess; 123} Htaccess;
124 124
125typedef struct HT_ACCESS_IP { 125typedef struct Htaccess_IP {
126 unsigned ip; 126 unsigned ip;
127 unsigned mask; 127 unsigned mask;
128 int allow_deny; 128 int allow_deny;
129 struct HT_ACCESS_IP *next; 129 struct Htaccess_IP *next;
130} Htaccess_IP; 130} Htaccess_IP;
131 131
132struct globals { 132struct globals {
@@ -153,8 +153,9 @@ struct globals {
153#if ENABLE_FEATURE_HTTPD_CGI || DEBUG 153#if ENABLE_FEATURE_HTTPD_CGI || DEBUG
154 char *rmt_ip_str; /* for set env REMOTE_ADDR */ 154 char *rmt_ip_str; /* for set env REMOTE_ADDR */
155#endif 155#endif
156 unsigned tcp_port; /* server initial port and for 156 const char *bind_addr_or_port;
157 set env REMOTE_PORT */ 157 unsigned tcp_port; /* for set env REMOTE_PORT */
158
158#if ENABLE_FEATURE_HTTPD_BASIC_AUTH 159#if ENABLE_FEATURE_HTTPD_BASIC_AUTH
159 Htaccess *g_auth; /* config user:password lines */ 160 Htaccess *g_auth; /* config user:password lines */
160#endif 161#endif
@@ -164,7 +165,7 @@ struct globals {
164#if ENABLE_FEATURE_HTTPD_CONFIG_WITH_SCRIPT_INTERPR 165#if ENABLE_FEATURE_HTTPD_CONFIG_WITH_SCRIPT_INTERPR
165 Htaccess *script_i; /* config script interpreters */ 166 Htaccess *script_i; /* config script interpreters */
166#endif 167#endif
167 char iobuf[MAX_MEMORY_BUFF]; 168 char iobuf[MAX_MEMORY_BUF];
168}; 169};
169#define G (*ptr_to_globals) 170#define G (*ptr_to_globals)
170#define server_socket (G.server_socket ) 171#define server_socket (G.server_socket )
@@ -187,6 +188,7 @@ struct globals {
187#if ENABLE_FEATURE_HTTPD_CGI || DEBUG 188#if ENABLE_FEATURE_HTTPD_CGI || DEBUG
188#define rmt_ip_str (G.rmt_ip_str ) 189#define rmt_ip_str (G.rmt_ip_str )
189#endif 190#endif
191#define bind_addr_or_port (G.bind_addr_or_port)
190#define tcp_port (G.tcp_port ) 192#define tcp_port (G.tcp_port )
191#if ENABLE_FEATURE_HTTPD_BASIC_AUTH 193#if ENABLE_FEATURE_HTTPD_BASIC_AUTH
192#define g_auth (G.g_auth ) 194#define g_auth (G.g_auth )
@@ -201,7 +203,7 @@ struct globals {
201#define INIT_G() do { \ 203#define INIT_G() do { \
202 PTR_TO_GLOBALS = xzalloc(sizeof(G)); \ 204 PTR_TO_GLOBALS = xzalloc(sizeof(G)); \
203 USE_FEATURE_HTTPD_BASIC_AUTH(g_realm = "Web Server Authentication";) \ 205 USE_FEATURE_HTTPD_BASIC_AUTH(g_realm = "Web Server Authentication";) \
204 tcp_port = 80; \ 206 bind_addr_or_port = "80"; \
205 ContentLength = -1; \ 207 ContentLength = -1; \
206} while (0) 208} while (0)
207 209
@@ -771,7 +773,7 @@ static void setenv1(const char *name, const char *value)
771} 773}
772static void setenv_long(const char *name, long value) 774static void setenv_long(const char *name, long value)
773{ 775{
774 char buf[sizeof(value)*3 + 1]; 776 char buf[sizeof(value)*3 + 2];
775 sprintf(buf, "%ld", value); 777 sprintf(buf, "%ld", value);
776 setenv(name, buf, 1); 778 setenv(name, buf, 1);
777} 779}
@@ -849,33 +851,27 @@ static void decodeBase64(char *Data)
849#if BB_MMU 851#if BB_MMU
850static int openServer(void) 852static int openServer(void)
851{ 853{
852 int fd; 854 int n = bb_strtou(bind_addr_or_port, NULL, 10);
853 855 if (!errno && n && n <= 0xffff)
854 /* create the socket right now */ 856 n = create_and_bind_stream_or_die(NULL, n);
855 fd = create_and_bind_stream_or_die(NULL, tcp_port); 857 else
856 xlisten(fd, 9); 858 n = create_and_bind_stream_or_die(bind_addr_or_port, 80);
857 return fd; 859 xlisten(n, 9);
860 return n;
858} 861}
859#endif 862#endif
860 863
861/**************************************************************************** 864/*
862 * 865 * Create and send HTTP response headers.
863 > $Function: sendHeaders() 866 * The arguments are combined and sent as one write operation. Note that
864 * 867 * IE will puke big-time if the headers are not sent in one packet and the
865 * $Description: Create and send HTTP response headers. 868 * second packet is delayed for any reason.
866 * The arguments are combined and sent as one write operation. Note that 869 * responseNum - the result code to send.
867 * IE will puke big-time if the headers are not sent in one packet and the 870 * Return result of write().
868 * second packet is delayed for any reason. 871 */
869 *
870 * $Parameter:
871 * (HttpResponseNum) responseNum . . . The result code to send.
872 *
873 * $Return: (int) . . . . writing errors
874 *
875 ****************************************************************************/
876static int sendHeaders(HttpResponseNum responseNum) 872static int sendHeaders(HttpResponseNum responseNum)
877{ 873{
878 char *buf = iobuf; 874 char *const buf = iobuf; // dont really need it?
879 const char *responseString = ""; 875 const char *responseString = "";
880 const char *infoString = 0; 876 const char *infoString = 0;
881 const char *mime_type; 877 const char *mime_type;
@@ -937,33 +933,29 @@ static int sendHeaders(HttpResponseNum responseNum)
937 return full_write(i, buf, len); 933 return full_write(i, buf, len);
938} 934}
939 935
940/**************************************************************************** 936/*
941 * 937 * Read from the socket until '\n' or EOF. '\r' chars are removed.
942 > $Function: getLine() 938 * Return number of characters read or -1 if nothing is read.
943 * 939 * Data is returned in iobuf.
944 * $Description: Read from the socket until an end of line char found. 940 */
945 *
946 * Characters are read one at a time until an eol sequence is found.
947 *
948 * $Return: (int) . . . . number of characters read. -1 if error.
949 *
950 ****************************************************************************/
951static int getLine(void) 941static int getLine(void)
952{ 942{
953 int count = 0; 943 int count = 0;
954 char *buf = iobuf;
955 944
956 while (read(accepted_socket, buf + count, 1) == 1) { 945 /* We must not read extra chars. Reading byte-by-byte... */
957 if (buf[count] == '\r') continue; 946 while (read(accepted_socket, iobuf + count, 1) == 1) {
958 if (buf[count] == '\n') { 947 if (iobuf[count] == '\r')
959 buf[count] = 0; 948 continue;
949 if (iobuf[count] == '\n') {
950 iobuf[count] = '\0';
960 return count; 951 return count;
961 } 952 }
962 if (count < (MAX_MEMORY_BUFF-1)) /* check overflow */ 953 if (count < (MAX_MEMORY_BUF - 1)) /* check overflow */
963 count++; 954 count++;
964 } 955 }
965 if (count) return count; 956 if (count)
966 else return -1; 957 return count;
958 return -1;
967} 959}
968 960
969#if ENABLE_FEATURE_HTTPD_CGI 961#if ENABLE_FEATURE_HTTPD_CGI
@@ -1255,8 +1247,8 @@ static int sendCgi(const char *url,
1255 } 1247 }
1256 1248
1257#define PIPESIZE PIPE_BUF 1249#define PIPESIZE PIPE_BUF
1258#if PIPESIZE >= MAX_MEMORY_BUFF 1250#if PIPESIZE >= MAX_MEMORY_BUF
1259# error "PIPESIZE >= MAX_MEMORY_BUFF" 1251# error "PIPESIZE >= MAX_MEMORY_BUF"
1260#endif 1252#endif
1261 if (FD_ISSET(inFd, &readSet)) { 1253 if (FD_ISSET(inFd, &readSet)) {
1262 /* There is something to read from CGI */ 1254 /* There is something to read from CGI */
@@ -1408,7 +1400,7 @@ static int sendFile(const char *url)
1408 1400
1409 fallback: 1401 fallback:
1410#endif 1402#endif
1411 while ((count = full_read(f, iobuf, MAX_MEMORY_BUFF)) > 0) { 1403 while ((count = full_read(f, iobuf, MAX_MEMORY_BUF)) > 0) {
1412 if (full_write(fd, iobuf, count) != count) 1404 if (full_write(fd, iobuf, count) != count)
1413 break; 1405 break;
1414 } 1406 }
@@ -1532,33 +1524,25 @@ set_remoteuser_var:
1532 1524
1533#endif /* FEATURE_HTTPD_BASIC_AUTH */ 1525#endif /* FEATURE_HTTPD_BASIC_AUTH */
1534 1526
1535/**************************************************************************** 1527/*
1536 * 1528 * Handle timeouts
1537 > $Function: handle_sigalrm() 1529 */
1538 *
1539 * $Description: Handle timeouts
1540 *
1541 ****************************************************************************/
1542
1543static void handle_sigalrm(int sig) 1530static void handle_sigalrm(int sig)
1544{ 1531{
1545 sendHeaders(HTTP_REQUEST_TIMEOUT); 1532 sendHeaders(HTTP_REQUEST_TIMEOUT);
1546 alarm_signaled = 1; 1533 alarm_signaled = 1;
1547} 1534}
1548 1535
1549/**************************************************************************** 1536/*
1550 * 1537 * Handle an incoming http request and exit.
1551 > $Function: handleIncoming() 1538 */
1552 * 1539static void handle_incoming_and_exit(void) ATTRIBUTE_NORETURN;
1553 * $Description: Handle an incoming http request. 1540static void handle_incoming_and_exit(void)
1554 *
1555 ****************************************************************************/
1556static void handleIncoming(void)
1557{ 1541{
1558 char *buf = iobuf; 1542 char *buf = iobuf;
1559 char *url; 1543 char *url;
1560 char *purl; 1544 char *purl;
1561 int blank = -1; 1545 int blank = -1;
1562 char *test; 1546 char *test;
1563 struct stat sb; 1547 struct stat sb;
1564 int ip_allowed; 1548 int ip_allowed;
@@ -1568,9 +1552,6 @@ static void handleIncoming(void)
1568 char *cookie = 0; 1552 char *cookie = 0;
1569 char *content_type = 0; 1553 char *content_type = 0;
1570#endif 1554#endif
1571 fd_set s_fd;
1572 struct timeval tv;
1573 int retval;
1574 struct sigaction sa; 1555 struct sigaction sa;
1575 1556
1576#if ENABLE_FEATURE_HTTPD_BASIC_AUTH 1557#if ENABLE_FEATURE_HTTPD_BASIC_AUTH
@@ -1582,10 +1563,12 @@ static void handleIncoming(void)
1582 sa.sa_flags = 0; /* no SA_RESTART */ 1563 sa.sa_flags = 0; /* no SA_RESTART */
1583 sigaction(SIGALRM, &sa, NULL); 1564 sigaction(SIGALRM, &sa, NULL);
1584 1565
1566 /* It's not a real loop (it ends with while(0)).
1567 * Break from this "loop" jumps to exit(0) */
1585 do { 1568 do {
1586 int count; 1569 int count;
1587 1570
1588 (void) alarm(TIMEOUT); 1571 alarm(TIMEOUT);
1589 if (getLine() <= 0) 1572 if (getLine() <= 0)
1590 break; /* closed */ 1573 break; /* closed */
1591 1574
@@ -1696,8 +1679,7 @@ static void handleIncoming(void)
1696 /* read until blank line for HTTP version specified, else parse immediate */ 1679 /* read until blank line for HTTP version specified, else parse immediate */
1697 while (1) { 1680 while (1) {
1698 alarm(TIMEOUT); 1681 alarm(TIMEOUT);
1699 count = getLine(); 1682 if (getLine() <= 0)
1700 if (count <= 0)
1701 break; 1683 break;
1702 1684
1703 if (DEBUG) 1685 if (DEBUG)
@@ -1831,52 +1813,48 @@ static void handleIncoming(void)
1831 bail_out: 1813 bail_out:
1832#endif 1814#endif
1833 1815
1816 exit(0);
1817
1818#if 0 /* Is this needed? Why? */
1834 if (DEBUG) 1819 if (DEBUG)
1835 fprintf(stderr, "closing socket\n\n"); 1820 fprintf(stderr, "closing socket\n");
1836#if ENABLE_FEATURE_HTTPD_CGI 1821#if ENABLE_FEATURE_HTTPD_CGI
1837 free(cookie); 1822 free(cookie);
1838 free(content_type); 1823 free(content_type);
1839 free(referer); 1824 free(referer);
1840 referer = NULL; 1825 referer = NULL;
1841# if ENABLE_FEATURE_HTTPD_BASIC_AUTH 1826#if ENABLE_FEATURE_HTTPD_BASIC_AUTH
1842 free(remoteuser); 1827 free(remoteuser);
1843 remoteuser = NULL; 1828 remoteuser = NULL;
1844# endif
1845#endif 1829#endif
1846 shutdown(accepted_socket, SHUT_WR); 1830#endif
1847
1848 /* Properly wait for remote to closed */ 1831 /* Properly wait for remote to closed */
1849 FD_ZERO(&s_fd); 1832 int retval;
1850 FD_SET(accepted_socket, &s_fd); 1833 shutdown(accepted_socket, SHUT_WR);
1851
1852 do { 1834 do {
1835 fd_set s_fd;
1836 struct timeval tv;
1837 FD_ZERO(&s_fd);
1838 FD_SET(accepted_socket, &s_fd);
1853 tv.tv_sec = 2; 1839 tv.tv_sec = 2;
1854 tv.tv_usec = 0; 1840 tv.tv_usec = 0;
1855 retval = select(accepted_socket + 1, &s_fd, NULL, NULL, &tv); 1841 retval = select(accepted_socket + 1, &s_fd, NULL, NULL, &tv);
1856 } while (retval > 0 && read(accepted_socket, buf, sizeof(iobuf) > 0)); 1842 } while (retval > 0 && read(accepted_socket, buf, sizeof(iobuf) > 0));
1857
1858 shutdown(accepted_socket, SHUT_RD); 1843 shutdown(accepted_socket, SHUT_RD);
1859 /* In inetd case, we close fd 1 (stdout) here. We will exit soon anyway */
1860 close(accepted_socket); 1844 close(accepted_socket);
1845 exit(0);
1846#endif
1861} 1847}
1862 1848
1863#if BB_MMU 1849#if BB_MMU
1864/**************************************************************************** 1850/*
1865 * 1851 * The main http server function.
1866 > $Function: miniHttpd() 1852 * Given an open socket, listen for new connections and farm out
1867 * 1853 * the processing as a forked process.
1868 * $Description: The main http server function. 1854 * Never returns.
1869 * 1855 */
1870 * Given an open socket fildes, listen for new connections and farm out 1856static void mini_httpd(int server) ATTRIBUTE_NORETURN;
1871 * the processing as a forked process. 1857static void mini_httpd(int server)
1872 *
1873 * $Parameters:
1874 * (int) server. . . The server socket fildes.
1875 *
1876 * $Return: (int) . . . . Always 0.
1877 *
1878 ****************************************************************************/
1879static int miniHttpd(int server)
1880{ 1858{
1881 fd_set readfd, portfd; 1859 fd_set readfd, portfd;
1882 1860
@@ -1926,24 +1904,23 @@ static int miniHttpd(int server)
1926 /* set the KEEPALIVE option to cull dead connections */ 1904 /* set the KEEPALIVE option to cull dead connections */
1927 setsockopt(s, SOL_SOCKET, SO_KEEPALIVE, &const_int_1, sizeof(const_int_1)); 1905 setsockopt(s, SOL_SOCKET, SO_KEEPALIVE, &const_int_1, sizeof(const_int_1));
1928 1906
1929 if (DEBUG || fork() == 0) { 1907 if (fork() == 0) {
1930 /* child */ 1908 /* child */
1931#if ENABLE_FEATURE_HTTPD_RELOAD_CONFIG_SIGHUP 1909#if ENABLE_FEATURE_HTTPD_RELOAD_CONFIG_SIGHUP
1932 /* protect reload config, may be confuse checking */ 1910 /* Do not reload config on HUP */
1933 signal(SIGHUP, SIG_IGN); 1911 signal(SIGHUP, SIG_IGN);
1934#endif 1912#endif
1935 handleIncoming(); 1913 handle_incoming_and_exit();
1936 if (!DEBUG)
1937 exit(0);
1938 } 1914 }
1939 close(s); 1915 close(s);
1940 } /* while (1) */ 1916 } /* while (1) */
1941 return 0; 1917 /* return 0; - never reached */
1942} 1918}
1943#endif 1919#endif
1944 1920
1945/* from inetd */ 1921/* from inetd */
1946static int miniHttpd_inetd(void) 1922static void mini_httpd_inetd(void) ATTRIBUTE_NORETURN;
1923static void mini_httpd_inetd(void)
1947{ 1924{
1948 union { 1925 union {
1949 struct sockaddr sa; 1926 struct sockaddr sa;
@@ -1969,8 +1946,7 @@ static int miniHttpd_inetd(void)
1969 tcp_port = ntohs(fromAddr.sin6.sin6_port); 1946 tcp_port = ntohs(fromAddr.sin6.sin6_port);
1970 } 1947 }
1971#endif 1948#endif
1972 handleIncoming(); 1949 handle_incoming_and_exit();
1973 return 0;
1974} 1950}
1975 1951
1976#if ENABLE_FEATURE_HTTPD_RELOAD_CONFIG_SIGHUP 1952#if ENABLE_FEATURE_HTTPD_RELOAD_CONFIG_SIGHUP
@@ -2017,7 +1993,6 @@ int httpd_main(int argc, char **argv)
2017 unsigned opt; 1993 unsigned opt;
2018 char *url_for_decode; 1994 char *url_for_decode;
2019 USE_FEATURE_HTTPD_ENCODE_URL_STR(const char *url_for_encode;) 1995 USE_FEATURE_HTTPD_ENCODE_URL_STR(const char *url_for_encode;)
2020 const char *s_port;
2021 USE_FEATURE_HTTPD_SETUID(const char *s_ugid = NULL;) 1996 USE_FEATURE_HTTPD_SETUID(const char *s_ugid = NULL;)
2022 USE_FEATURE_HTTPD_SETUID(struct bb_uidgid_t ugid;) 1997 USE_FEATURE_HTTPD_SETUID(struct bb_uidgid_t ugid;)
2023 USE_FEATURE_HTTPD_AUTH_MD5(const char *pass;) 1998 USE_FEATURE_HTTPD_AUTH_MD5(const char *pass;)
@@ -2043,7 +2018,7 @@ int httpd_main(int argc, char **argv)
2043 USE_FEATURE_HTTPD_BASIC_AUTH(, &g_realm) 2018 USE_FEATURE_HTTPD_BASIC_AUTH(, &g_realm)
2044 USE_FEATURE_HTTPD_AUTH_MD5(, &pass) 2019 USE_FEATURE_HTTPD_AUTH_MD5(, &pass)
2045 USE_FEATURE_HTTPD_SETUID(, &s_ugid) 2020 USE_FEATURE_HTTPD_SETUID(, &s_ugid)
2046 , &s_port 2021 , &bind_addr_or_port
2047 ); 2022 );
2048 if (opt & OPT_DECODE_URL) { 2023 if (opt & OPT_DECODE_URL) {
2049 printf("%s", decodeString(url_for_decode, 1)); 2024 printf("%s", decodeString(url_for_decode, 1));
@@ -2061,8 +2036,6 @@ int httpd_main(int argc, char **argv)
2061 return 0; 2036 return 0;
2062 } 2037 }
2063#endif 2038#endif
2064 if (opt & OPT_PORT)
2065 tcp_port = xatou16(s_port);
2066 2039
2067#if ENABLE_FEATURE_HTTPD_SETUID 2040#if ENABLE_FEATURE_HTTPD_SETUID
2068 if (opt & OPT_SETUID) { 2041 if (opt & OPT_SETUID) {
@@ -2111,14 +2084,14 @@ int httpd_main(int argc, char **argv)
2111 parse_conf(default_path_httpd_conf, FIRST_PARSE); 2084 parse_conf(default_path_httpd_conf, FIRST_PARSE);
2112#endif 2085#endif
2113 2086
2114 if (opt & OPT_INETD)
2115 return miniHttpd_inetd();
2116
2117#if BB_MMU 2087#if BB_MMU
2088 if (opt & OPT_INETD)
2089 mini_httpd_inetd();
2118 if (!(opt & OPT_FOREGROUND)) 2090 if (!(opt & OPT_FOREGROUND))
2119 bb_daemonize(0); /* don't change current directory */ 2091 bb_daemonize(0); /* don't change current directory */
2120 return miniHttpd(server_socket); 2092 mini_httpd(server_socket); /* never returns */
2121#else 2093#else
2122 return 0; /* not reached */ 2094 mini_httpd_inetd(); /* never returns */
2095 /* return 0; */
2123#endif 2096#endif
2124} 2097}
diff --git a/scripts/defconfig b/scripts/defconfig
index f24fe9586..c97cfa5b3 100644
--- a/scripts/defconfig
+++ b/scripts/defconfig
@@ -619,7 +619,6 @@ CONFIG_APP_UDHCPD=y
619CONFIG_APP_DHCPRELAY=y 619CONFIG_APP_DHCPRELAY=y
620CONFIG_APP_DUMPLEASES=y 620CONFIG_APP_DUMPLEASES=y
621CONFIG_APP_UDHCPC=y 621CONFIG_APP_UDHCPC=y
622CONFIG_FEATURE_UDHCP_SYSLOG=y
623# CONFIG_FEATURE_UDHCP_DEBUG is not set 622# CONFIG_FEATURE_UDHCP_DEBUG is not set
624CONFIG_FEATURE_RFC3397=y 623CONFIG_FEATURE_RFC3397=y
625CONFIG_VCONFIG=y 624CONFIG_VCONFIG=y