[PATCH] broken inetd support in busybox httpd
Mathias Jeschke
busybox at gmj.cjb.net
Thu Jan 11 01:18:47 PST 2007
* Bernhard Fischer <rep.nop at aon.at> wrote:
>> I send this patch to fix the inetd support for the httpd in busybox
> I can't seem to find the attached patch?
Sorry, due to your mailing list policy I had to resend the mail after
subscription and I forgot to attach the file.
Regards,
Mathias
-------------- next part --------------
--- busybox-1.3.1-orig/networking/httpd.c 2007-01-10 17:30:19.000000000 +0100
+++ busybox-1.3.1/networking/httpd.c 2007-01-10 18:17:11.000000000 +0100
@@ -163,6 +163,7 @@
int server_socket;
int accepted_socket;
+ int accepted_write_socket;
volatile int alarm_signaled;
#if ENABLE_FEATURE_HTTPD_CONFIG_WITH_SCRIPT_INTERPR
@@ -911,7 +912,7 @@
}
if (DEBUG)
fprintf(stderr, "headers: '%s'\n", buf);
- return full_write(config->accepted_socket, buf, len);
+ return full_write(config->accepted_write_socket, buf, len);
}
/****************************************************************************
@@ -1286,7 +1287,7 @@
sendHeaders(HTTP_OK);
/* TODO: sendfile() */
while ((count = full_read(f, buf, MAX_MEMORY_BUFF)) > 0) {
- if (full_write(config->accepted_socket, buf, count) != count)
+ if (full_write(config->accepted_write_socket, buf, count) != count)
break;
}
close(f);
@@ -1305,8 +1306,10 @@
/* This could stand some work */
for (cur = config->ip_a_d; cur; cur = cur->next) {
+#if ENABLE_FEATURE_HTTPD_CGI || DEBUG
if (DEBUG)
fprintf(stderr, "checkPermIP: '%s' ? ", config->rmt_ip_str);
+#endif
if (DEBUG)
fprintf(stderr, "'%u.%u.%u.%u/%u.%u.%u.%u'\n",
(unsigned char)(cur->ip >> 24),
@@ -1690,7 +1693,9 @@
config->ContentLength = -1;
} while (0);
+#if ENABLE_FEATURE_HTTPD_CGI
bail_out:
+#endif
if (DEBUG)
fprintf(stderr, "closing socket\n\n");
@@ -1760,6 +1765,7 @@
if (s < 0)
continue;
config->accepted_socket = s;
+ config->accepted_write_socket = s;
config->rmt_ip = ntohl(fromAddr.sin_addr.s_addr);
#if ENABLE_FEATURE_HTTPD_CGI || DEBUG
sprintf(config->rmt_ip_str, "%u.%u.%u.%u",
@@ -1961,6 +1967,10 @@
parse_conf(default_path_httpd_conf, FIRST_PARSE);
#endif
+ /* Initialise read & write fds (for inetd mode) */
+ config->accepted_socket = 0;
+ config->accepted_write_socket = 1;
+
if (opt & OPT_INETD)
return miniHttpd_inetd();
More information about the busybox
mailing list