diff -urN thttpd-2.21-19/libhttpd.c thttpd-2.21-20/libhttpd.c --- thttpd-2.21-19/libhttpd.c Wed Jan 30 12:48:50 2002 +++ thttpd-2.21-20/libhttpd.c Tue Feb 26 17:48:13 2002 @@ -599,8 +599,6 @@ void httpd_write_response( httpd_conn* hc ) { - /* First turn off NDELAY mode. */ - clear_ndelay( hc ); /* And send it, if necessary. */ if ( hc->responselen > 0 ) { @@ -618,7 +616,7 @@ there is a bug somewhere, it tries to read from nonblocking socket... so as a temporary measure, I disable it here - maniax */ - return; + flags = fcntl( hc->conn_fd, F_GETFL, 0 ); if ( flags != -1 ) { @@ -3330,6 +3328,8 @@ default: title = "Something"; break; } (void) my_snprintf( buf, sizeof(buf), "HTTP/1.0 %d %s\r\n", status, title ); + /* Clear O_NONBLOCK, so we won't cut the output stream too early in write() */ + clear_ndelay(hc); (void) write( hc->conn_fd, buf, strlen( buf ) ); /* Write the saved headers. */