[BusyBox-cvs] busybox/networking httpd.c,1.22,1.23

Erik Andersen andersen at busybox.net
Tue Feb 24 07:28:40 UTC 2004


Update of /var/cvs/busybox/networking
In directory nail:/tmp/cvs-serv6195/networking

Modified Files:
	httpd.c 
Log Message:
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



Index: httpd.c
===================================================================
RCS file: /var/cvs/busybox/networking/httpd.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- a/httpd.c	4 Feb 2004 11:10:28 -0000	1.22
+++ b/httpd.c	24 Feb 2004 07:28:38 -0000	1.23
@@ -1499,6 +1499,9 @@
   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 @@
 #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 */




More information about the busybox-cvs mailing list