[PATCH] httpd: Support configurable start page

Denys Vlasenko vda.linux at googlemail.com
Wed Oct 17 10:42:16 PDT 2007


On Wednesday 17 October 2007 12:45, Alex Landau wrote:
> > I am attaching modified httpd.c, please base your further work on it.
> > 
> 
> Ditto.

                        *c++ = '\0';
                        if (strncmp(c, "http://", 7) == 0)
                                c += 7;
                        host_port = c;
                        if (host_port == NULL) {
                                bb_error_msg("config error '%s' in '%s'", buf, cf);
                                continue;
                        }

host_port cannot be NULL. What do you really want to test there?


index.cgi support broke. I understand that now I need to supply
a config file for it, but it still doesn't work:

./busybox httpd -c httpd.conf -f -vvv -p 8888

httpd.conf
==========
S:cgi-bin/index.cgi

cgi-bin/index.cgi is a binary I built from httpd_indexcgi.c
(you may find it alongside httpd.c in busybox source).

strace:

[pid  3509] chdir("/path/to/cgi-bin") = 0
[pid  3509] execve("/path/to/cgi-bin/index.cgi", ["index.cgi"], [/* 66 vars */]) = 0
[pid  3509] chdir("..")                 = 0
[pid  3509] chdir("cgi-bin/index.cgi")  = -1 ENOTDIR (Not a directory)  <====================== ???
[pid  3509] _exit(1)                    = ?
Process 3509 detached
[pid  3508] <... poll resumed> [{fd=0, events=0}, {fd=3, events=POLLIN, revents=POLLHUP}, {fd=0, events=0}], 3, -1) = 1
[pid  3508] read(3, "", 4088)           = 0
[pid  3508] shutdown(1, 1 /* send */)   = 0
[pid  3508] fcntl64(0, F_GETFL)         = 0x2 (flags O_RDWR)
[pid  3508] fcntl64(0, F_SETFL, O_RDWR|O_NONBLOCK) = 0
[pid  3508] read(0, "", 8192)           = 0
[pid  3508] write(2, "172.28.3.151:45324: closed\n", 27172.28.3.151:45324: closed
) = 27
[pid  3508] exit_group(0)               = ?
Process 3508 detached

Obviously you pass different QUERY_STRING now, and this doesn't work
in httpd_indexcgi.c anymore:

        if (chdir("..")
         || (QUERY_STRING[1] && chdir(QUERY_STRING + 1))
        ) {
                return 1;
        }

See attached httpd.c
--
vda
-------------- next part --------------
A non-text attachment was scrubbed...
Name: httpd.c.bz2
Type: application/x-bzip2
Size: 19271 bytes
Desc: not available
Url : http://busybox.net/lists/busybox/attachments/20071017/82f11cd0/attachment-0001.bin 


More information about the busybox mailing list