Commit Graph

164 Commits

Author SHA1 Message Date
Denis Vlasenko
fc21305892 httpd: fix bug where we did chdir("") if CGI path had only one "/".
httpd: fix bug 2004: wrong argv when interpreter is invoked

+8 bytes growth
2008-02-11 16:26:22 +00:00
Denis Vlasenko
7dbf1b4d9e httpd: add a bit of error logging; a few code simplifications. +29 bytes. 2008-02-08 15:21:55 +00:00
Bernhard Reutner-Fischer
8c69afd992 - be C99 friendly. Anonymous unions are a GNU extension. This change is
size-neutral WRT -std=gnu99 and fixes several compilation errors for strict
  C99 mode.
2008-01-29 10:33:34 +00:00
Denis Vlasenko
fb0eba706c libbb: introduce and use safe_waitpid (loops in EINTR)
*: use more approproate (shorter) versions of wait()

function                                             old     new   delta
safe_waitpid                                           -      48     +48
wait_any_nohang                                        -      17     +17
send_tree                                            365     369      +4
processorstop                                        432     435      +3
text_yank                                            110     108      -2
make_human_readable_str                              202     200      -2
crond_main                                          1368    1366      -2
handle_sigchld                                        49      43      -6
reapchild                                            166     159      -7
custom                                               260     250     -10
checkscript                                          191     177     -14
wait_nohang                                           17       -     -17
wait_pid                                              43       -     -43
------------------------------------------------------------------------------
(add/remove: 2/2 grow/shrink: 2/7 up/down: 72/-103)           Total: -31 bytes
2008-01-02 19:55:04 +00:00
Denis Vlasenko
fcd878efcd httpd: support for "I:index.xml" syntax (Peter Korsgaard <jacmet@uclibc.org>)
function                                             old     new   delta
parse_conf                                          1481    1507     +26
handle_incoming_and_exit                            2650    2663     +13
httpd_main                                           749     759     +10
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/0 up/down: 49/0)               Total: 49 bytes
2007-12-29 02:16:23 +00:00
Denis Vlasenko
78ee7c853a httpd: fix trivial bug (spotted by Alex Landau) 2007-10-21 23:24:42 +00:00
Denis Vlasenko
34cd7afc49 httpd: free big buffer after use; improve grep-ability of 'headers' variable 2007-10-18 13:01:22 +00:00
Denis Vlasenko
f74194e942 xatonum.h: add comment
lineedit: fix typo in comment
httpd: support for proxying connection to other http server
(by Alex Landau <landau_alex@yahoo.com>)
2007-10-18 12:54:39 +00:00
Denis Vlasenko
3f5fdc7572 remove trailing whitespace 2007-10-14 04:55:59 +00:00
Denis Vlasenko
4a4575686e httpd: fix bug where we were trying to read more POSTDATA than content-length 2007-10-14 02:34:20 +00:00
Denis Vlasenko
9b49a5ed85 add -fvisibility=hidden to CC flags, mark XXX_main functions
EXTERNALLY_VISIBLE. 5% size reduction of libbusybox.so
2007-10-11 10:05:36 +00:00
Denis Vlasenko
0c97c9d437 'simple' error message functions by Loic Grenie <loic.grenie@gmail.com>.
263 bytes saved.
2007-10-01 11:58:38 +00:00
Denis Vlasenko
3d2a9217a7 httpd: trivial simplification 2007-09-28 22:35:29 +00:00
Denis Vlasenko
5d61e71c3a introduce safe_poll (fixes a problem in top)
function                                             old     new   delta
safe_poll                                              -      77     +77
svlogd_main                                         1470    1466      -4
zcip_main                                           1530    1524      -6
forkexec                                            1345    1338      -7
decode_format_string                                 795     788      -7
collect_blk                                          474     467      -7
buffer_pread                                         540     532      -8
tftp                                                1182    1172     -10
microcom_main                                        763     749     -14
arpping                                              441     424     -17
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/9 up/down: 77/-80)             Total: -3 bytes
   text    data     bss     dec     hex filename
 770162    1034   10404  781600   bed20 busybox_old
 770158    1034   10404  781596   bed1c busybox_unstripped
2007-09-27 10:09:59 +00:00
Denis Vlasenko
35465a3f00 httpd: small auth and IPv6 fixes (Kim B. Heino <Kim.Heino@bluegiga.com>) 2007-09-25 11:58:33 +00:00
Denis Vlasenko
32a471e4db httpd: simplify CGI i/o loop. -200 bytes. 2007-09-23 13:56:57 +00:00
Denis Vlasenko
f431017535 httpd: optional support for partial downloads 2007-09-21 22:35:18 +00:00
Denis Vlasenko
2535f12cf2 httpd: do not clear environment
mount: mount helpers support (by Vladimir Dronnikov <dronnikov@gmail.ru>)
2007-09-15 13:28:30 +00:00
Denis Vlasenko
72b6a65b2f httpd: fix buglet in hex conversion. Remove alloca NULL checks
(never happens, app just crashes if stack overflows)
svlogd: cosmetic messages and style fixes
2007-08-21 11:18:25 +00:00
Denis Vlasenko
e58e8d9444 httpd: add optional support for error pages
(by Pierre Metras <genepi@sympatico.ca>)
2007-08-21 10:26:55 +00:00
Denis Vlasenko
63db27f9f4 removed stray debugging comments 2007-08-19 21:24:37 +00:00
Denis Vlasenko
d867f32a7a httpd: explain IP/mask parsing, and simplify it a bit.
parse_conf                                          1258    1247     -11
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-11)             Total: -11 bytes
   text    data     bss     dec     hex filename
 772602    1058   11092  784752   bf970 busybox_old
 772594    1058   11092  784744   bf968 busybox_unstripped
2007-08-19 21:15:42 +00:00
Denis Vlasenko
921799da4e httpd: reinstate (much lighter) paranoid connection close code
allegedly needed for some versions of IE. +45 bytes.
2007-08-19 19:28:09 +00:00
Denis Vlasenko
37c3316fd7 httpd: get rid of rmt_port and setenv_log 2007-08-19 18:54:22 +00:00
Denis Vlasenko
52e15dc50b httpd: get rid of sscanf usage. Rename some variables. 2007-08-19 18:53:43 +00:00
Denis Vlasenko
fe7cd642b0 don't pass argc in getopt32, it's superfluous
(add/remove: 0/0 grow/shrink: 12/131 up/down: 91/-727) Total: -636 bytes
   text    data     bss     dec     hex filename
 773469    1058   11092  785619   bfcd3 busybox_old
 772644    1058   11092  784794   bf99a busybox_unstripped
2007-08-18 15:32:12 +00:00
Denis Vlasenko
d6cd9d7fe9 httpd: stop reading headers using 1-byte read()
get_line                                              73     105     +32
httpd_main                                           769     766      -3
send_cgi_and_exit                                   1583    1577      -6
send_headers                                         449     432     -17
handle_incoming_and_exit                            2217    2172     -45
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/4 up/down: 32/-71)            Total: -39 bytes
2007-08-18 14:22:09 +00:00
Denis Vlasenko
367960ba9a make standalone httpd work on NOMMU machines 2007-08-18 14:20:21 +00:00
Denis Vlasenko
9611cb1215 get rid of server_ and accepted_socket globals.
get_line                                              74      73      -1
log_and_exit                                          33      32      -1
send_headers                                         457     449      -8
httpd_main                                           906     892     -14
handle_incoming_and_exit                            2136    2113     -23
send_cgi_and_exit                                   1743    1583    -160
2007-08-18 14:18:43 +00:00
Denis Vlasenko
b98c26ad68 httpd shrink and logging update, part 7 of 7
text    data     bss     dec     hex filename
   9836       0       0    9836    266c busybox.t1/networking/httpd.o.orig
   9724       0       0    9724    25fc busybox.t2/networking/httpd.o
   9657       0       0    9657    25b9 busybox.t3/networking/httpd.o
   9342       0       0    9342    247e busybox.t4/networking/httpd.o
   9342       0       0    9342    247e busybox.t5/networking/httpd.o
   9262       0       0    9262    242e busybox.t6/networking/httpd.o
   9283       0       0    9283    2443 busybox.t7/networking/httpd.o
   9334       0       0    9334    2476 busybox.t8/networking/httpd.o
2007-08-17 19:21:12 +00:00
Denis Vlasenko
feac3ce8c0 httpd shrink and logging update, part 6 of 7
text    data     bss     dec     hex filename
   9836       0       0    9836    266c busybox.t1/networking/httpd.o.orig
   9724       0       0    9724    25fc busybox.t2/networking/httpd.o
   9657       0       0    9657    25b9 busybox.t3/networking/httpd.o
   9342       0       0    9342    247e busybox.t4/networking/httpd.o
   9342       0       0    9342    247e busybox.t5/networking/httpd.o
   9262       0       0    9262    242e busybox.t6/networking/httpd.o
   9283       0       0    9283    2443 busybox.t7/networking/httpd.o
   9334       0       0    9334    2476 busybox.t8/networking/httpd.o
2007-08-17 19:20:39 +00:00
Denis Vlasenko
073214f894 httpd shrink and logging update, part 5 of 7
text    data     bss     dec     hex filename
   9836       0       0    9836    266c busybox.t1/networking/httpd.o.orig
   9724       0       0    9724    25fc busybox.t2/networking/httpd.o
   9657       0       0    9657    25b9 busybox.t3/networking/httpd.o
   9342       0       0    9342    247e busybox.t4/networking/httpd.o
   9342       0       0    9342    247e busybox.t5/networking/httpd.o
   9262       0       0    9262    242e busybox.t6/networking/httpd.o
   9283       0       0    9283    2443 busybox.t7/networking/httpd.o
   9334       0       0    9334    2476 busybox.t8/networking/httpd.o
2007-08-17 19:20:07 +00:00
Denis Vlasenko
91adf7d587 httpd shrink and logging update, part 4 of 7
text    data     bss     dec     hex filename
   9836       0       0    9836    266c busybox.t1/networking/httpd.o.orig
   9724       0       0    9724    25fc busybox.t2/networking/httpd.o
   9657       0       0    9657    25b9 busybox.t3/networking/httpd.o
   9342       0       0    9342    247e busybox.t4/networking/httpd.o
   9342       0       0    9342    247e busybox.t5/networking/httpd.o
   9262       0       0    9262    242e busybox.t6/networking/httpd.o
   9283       0       0    9283    2443 busybox.t7/networking/httpd.o
   9334       0       0    9334    2476 busybox.t8/networking/httpd.o
2007-08-17 19:19:42 +00:00
Denis Vlasenko
e45af73dc2 httpd shrink and logging update, part 3 of 7
text    data     bss     dec     hex filename
   9836       0       0    9836    266c busybox.t1/networking/httpd.o.orig
   9724       0       0    9724    25fc busybox.t2/networking/httpd.o
   9657       0       0    9657    25b9 busybox.t3/networking/httpd.o
   9342       0       0    9342    247e busybox.t4/networking/httpd.o
   9342       0       0    9342    247e busybox.t5/networking/httpd.o
   9262       0       0    9262    242e busybox.t6/networking/httpd.o
   9283       0       0    9283    2443 busybox.t7/networking/httpd.o
   9334       0       0    9334    2476 busybox.t8/networking/httpd.o
2007-08-17 19:19:15 +00:00
Denis Vlasenko
241b1567ad httpd shrink and logging update, part 2 of 7
text    data     bss     dec     hex filename
   9836       0       0    9836    266c busybox.t1/networking/httpd.o.orig
   9724       0       0    9724    25fc busybox.t2/networking/httpd.o
   9657       0       0    9657    25b9 busybox.t3/networking/httpd.o
   9342       0       0    9342    247e busybox.t4/networking/httpd.o
   9342       0       0    9342    247e busybox.t5/networking/httpd.o
   9262       0       0    9262    242e busybox.t6/networking/httpd.o
   9283       0       0    9283    2443 busybox.t7/networking/httpd.o
   9334       0       0    9334    2476 busybox.t8/networking/httpd.o
2007-08-17 19:18:47 +00:00
Denis Vlasenko
6a2f7f41cf whitespace fixes, no code changes 2007-08-16 10:35:17 +00:00
Denis Vlasenko
384b1d12f9 httpd: add -v[v]: prints client addresses, HTTP codes returned [and URLs]
get_line                                               -      70     +70
packed_usage                                       22811   22863     +52
handle_incoming_and_exit                            2246    2277     +31
httpd_main                                          1141    1155     +14
sendHeaders                                          489     482      -7
getLine                                               77       -     -77
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 3/1 up/down: 167/-84)            Total: 83 bytes
   text    data     bss     dec     hex filename
 774335    1058   11092  786485   c0035 busybox_old
 774447    1058   11092  786597   c00a5 busybox_unstripped
2007-08-14 16:55:01 +00:00
Denis Vlasenko
0372f0f199 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
2007-08-14 16:50:01 +00:00
Denis Vlasenko
319f8ebef8 httpd: round down sendfile byte count to 64k
*: style fixes
2007-08-13 11:09:30 +00:00
Denis Vlasenko
1b9064d535 httpd: sendfile support 2007-08-12 21:05:49 +00:00
Denis Vlasenko
6ca409e0e4 trylink: produce even more info about final link stage
trylink: explain how to modify link and drastically decrease amount
  of padding (unfortunately, needs hand editing ATM).
*: add ALIGN1 / ALIGN2 to global strings and arrays of bytes and shorts

size saving: 0.5k
2007-08-12 20:58:27 +00:00
Denis Vlasenko
4185548984 httpd: CGI Status: header fix 2007-08-11 20:26:02 +00:00
Denis Vlasenko
1ec15cd818 httpd: add support for Status: CGI header 2007-08-11 20:20:43 +00:00
Denis Vlasenko
e5d37ccb6e httpd: fix CGI handling bug (we were closing wrong fd). 2007-08-11 20:20:02 +00:00
Denis Vlasenko
82bd9ee645 fix typo in last commit 2007-07-21 15:07:22 +00:00
Denis Vlasenko
6cd84dac84 Three patches from FreeWRT people 2007-07-21 14:57:54 +00:00
Denis Vlasenko
dc757aa16c introduce and use bb_basename()
function                                             old     new   delta
bb_basename                                            -      26     +26
sv_main                                             1226    1225      -1
passwd_main                                         1985    1983      -2
showdirs                                             482     478      -4
sendCgi                                             1811    1807      -4
make_device                                         1354    1350      -4
handleIncoming                                      2443    2439      -4
func_name                                             82      78      -4
service_name                                        2292    2285      -7
main                                                 909     901      -8
cmp_main                                             555     547      -8
test_main                                            434     422     -12
act                                                  228     216     -12
find_pair                                            180     164     -16
rmmod_main                                           298     280     -18
find_pid_by_name                                     156     134     -22
modprobe_main                                       1606    1576     -30
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/16 up/down: 26/-156)         Total: -130 bytes
   text    data     bss     dec     hex filename
 734933    3028   14400  752361   b7ae9 busybox_old
 734801    3028   14400  752229   b7a65 busybox_unstripped
2007-06-30 08:04:05 +00:00
Denis Vlasenko
80b8b39899 Consolidate ARRAY_SIZE macro; remove one unneeded global var (walter harms <wharms@bfs.de>) 2007-06-25 10:55:35 +00:00
Denis Vlasenko
56258b688c httpd: NOMMU fixes by Alex Landau <landau_alex@yahoo.com> 2007-06-23 23:14:02 +00:00
Denis Vlasenko
77e44d60e6 httpd: move data off bss.
httpd: do not realpath() for SCRIPT_FILENAME - it resolves symlinks
but it should not:

-                /* SCRIPT_FILENAME required by PHP in CGI mode */
-               if (!realpath(purl + 1, realpath_buff))
-                       goto error_execing_cgi;
-               setenv1("SCRIPT_FILENAME", realpath_buff);
+
+               /* SCRIPT_FILENAME required by PHP in CGI mode */
+               fullpath = concat_path_file(home_httpd, purl);
+               setenv1("SCRIPT_FILENAME", fullpath);
2007-06-09 23:49:05 +00:00