On Monday 04 February 2008 13:52, Andrew Gatt wrote:
> Florian Brandner wrote:
> > Zitat von Andrew Gatt <[EMAIL PROTECTED]>:
> >
> >> All my scripts are executable for everyone. If i drop in the busybox
> >> 1.4.1 executable it works fine, if i change it for the 1.8.2, i get the
> >> 404 messages. I've checked and CGI is enabled in the make file.
> >
> > How do you start the httpd? From inetd? Then you need the -i option.
> > Can you start it from a console? Make sure to stop any running httpd 
> > as well as inetd. Just to make sure that no other httpd is running.
> > Then try "httpd -vv -f -h <web_root>" to see httpds output. Maybe its 
> > printing something useful...
> > Are static pages in <webroot> loaded correctly? Is maybe the directory 
> > cgi-bin not set to executable (744 or something)?
> >
> I tried the verbose output but it just gave me this.
> 
> # sbin/httpd -vv -f -h <web_root>/
> 192.168.1.78:59031: url:/cgi-bin/control.cgi
> 192.168.1.78:59031: response:404

You found that verbose logging is not verbose enough.
Please try attached patch, it should fix it
and show you where the problem is.
--
vda
diff -d -urpN busybox.3/networking/httpd.c busybox.4/networking/httpd.c
--- busybox.3/networking/httpd.c	2008-02-07 13:29:32.000000000 +0000
+++ busybox.4/networking/httpd.c	2008-02-08 15:06:10.000000000 +0000
@@ -1419,8 +1419,9 @@ static void send_cgi_and_exit(
 
 		/* script must have absolute path */
 		script = strrchr(fullpath, '/');
-		if (!script)
-			goto error_execing_cgi;
+		//fullpath is a result of concat_path_file and always has '/'
+		//if (!script)
+		//	goto error_execing_cgi;
 		*script = '\0';
 		/* chdiring to script's dir */
 		if (chdir(fullpath) == 0) {
@@ -1441,16 +1442,19 @@ static void send_cgi_and_exit(
 #endif
 			*script = '/';
 			/* set argv[0] to name without path */
-			argv[0] = (char*)bb_basename(purl);
+			argv[0] = script + 1;
 			argv[1] = NULL;
 #if ENABLE_FEATURE_HTTPD_CONFIG_WITH_SCRIPT_INTERPR
 			if (interpr)
-				execv(interpr, argv);
-			else
+				fullpath = interpr;
 #endif
-				execv(fullpath, argv);
+			execv(fullpath, argv);
+			if (verbose)
+				bb_perror_msg("exec %s", fullpath);
+		} else if (verbose) {
+			bb_perror_msg("chdir %s", fullpath);
 		}
- error_execing_cgi:
+ //error_execing_cgi:
 		/* send to stdout
 		 * (we are CGI here, our stdout is pumped to the net) */
 		send_headers_and_exit(HTTP_NOT_FOUND);
_______________________________________________
busybox mailing list
[email protected]
http://busybox.net/cgi-bin/mailman/listinfo/busybox

Reply via email to