summaryrefslogtreecommitdiff
path: root/networking
diff options
context:
space:
mode:
authorEric Andersen2004-02-24 07:28:38 +0000
committerEric Andersen2004-02-24 07:28:38 +0000
commitd8746cdc40b619f14223893f0e9401c4357352be (patch)
tree2b70dc4cff3ea3a6b1ff7e469ad09bf179e85929 /networking
parent60be069d581224b2242cfa8297377a6c11b02b52 (diff)
downloadbusybox-d8746cdc40b619f14223893f0e9401c4357352be.zip
busybox-d8746cdc40b619f14223893f0e9401c4357352be.tar.gz
Joe.C, joe at numa dot com dot tw writes:
Hi, When downloading files over slow network (e.g. wireless/ internet) using IE, sometimes it will stop downloading and show error message 'connection closed' when the download is almost complete. This is because IE can't handle server close connection properly. Apache http_main.c fix this problem by close the connection after client close the connection. This patch do exactly the same thing. Please consider include this patch. Joe.C
Diffstat (limited to 'networking')
-rw-r--r--networking/httpd.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/networking/httpd.c b/networking/httpd.c
index 9b36101..6374e67 100644
--- a/networking/httpd.c
+++ b/networking/httpd.c
@@ -1499,6 +1499,9 @@ static void handleIncoming(void)
char *test;
struct stat sb;
int ip_allowed;
+ fd_set s_fd ;
+ struct timeval tv ;
+ int retval;
#ifdef CONFIG_FEATURE_HTTPD_BASIC_AUTH
int credentials = -1; /* if not requred this is Ok */
@@ -1717,6 +1720,17 @@ FORBIDDEN: /* protect listing /cgi-bin */
#endif
# endif
shutdown(a_c_w, SHUT_WR);
+
+ /* Properly wait for remote to closed */
+ FD_ZERO (&s_fd) ;
+ FD_SET (a_c_w, &s_fd) ;
+
+ do {
+ tv.tv_sec = 2 ;
+ tv.tv_usec = 0 ;
+ retval = select (a_c_w + 1, &s_fd, NULL, NULL, &tv);
+ } while (retval > 0 && (read (a_c_w, buf, sizeof (config->buf)) > 0));
+
shutdown(a_c_r, SHUT_RD);
close(config->accepted_socket);
#endif /* CONFIG_FEATURE_HTTPD_USAGE_FROM_INETD_ONLY */