From: [EMAIL PROTECTED] Operating system: Slackware 8 PHP version: 4.1.1 PHP Bug Type: Other web server Bug description: thttpd patching fails
Patching of the thttpd source fails when I try to compile php as a sapi thttpd module. Tried with thttpd versions 2.19, 2.20c, and 2.22beta4. Report contents apply to thttpd-2.20c (the latest stable version), but I think the error is the same for all. Details: unpackaged php-4.1.1 and thttpd into the same directory and cd to php-4.1.1. ./configure --with-thttpd=../thttpd-2.20c configure works fine. then do make install per the readme by Sascha gcc gets a workout and then Hunks 1 & 2 fail on fdwatch.c on lines 460 and 472 and Hunks 6 & 7 fail on libhttpd.c at lines 2349 and 3025 **************************************** contents of fdwatch.c.rej *************** *** 460,466 **** ridx = 0; for ( i = 0; i < npollfds; ++i ) - if ( pollfds[i].revents & ( POLLIN | POLLOUT ) ) poll_rfdidx[ridx++] = pollfds[i].fd; return r; --- 460,466 ---- ridx = 0; for ( i = 0; i < npollfds; ++i ) + if ( pollfds[i].revents & ( POLLIN | POLLOUT | POLLERR | POLLHUP | POLLNVAL ) ) poll_rfdidx[ridx++] = pollfds[i].fd; return r; *************** *** 472,479 **** { switch ( fd_rw[fd] ) { - case FDW_READ: return pollfds[poll_fdidx[fd]].revents & POLLIN; - case FDW_WRITE: return pollfds[poll_fdidx[fd]].revents & POLLOUT; default: return 0; } } --- 472,479 ---- { switch ( fd_rw[fd] ) { + case FDW_READ: return pollfds[poll_fdidx[fd]].revents & ( POLLIN | POLLERR | POLLHUP | POLLNVAL ); + case FDW_WRITE: return pollfds[poll_fdidx[fd]].revents & ( POLLOUT | POLLERR | POLLHUP | POLLNVAL ); default: return 0; } } ****************************** end contents of fdwatch.c.rej ****************************** contents of libhttpd.c.rej *************** *** 2341,2347 **** { make_log_entry( hc, nowP ); - if ( hc->file_address != (char*) 0 ) { mmc_unmap( hc->file_address, &(hc->sb), nowP ); hc->file_address = (char*) 0; --- 2349,2358 ---- { make_log_entry( hc, nowP ); + if ( hc->file_address == (char*) 1 ) + { + thttpd_closed_conn(hc->conn_fd); + } else if ( hc->file_address != (char*) 0 ) { mmc_unmap( hc->file_address, &(hc->sb), nowP ); hc->file_address = (char*) 0; *************** *** 3014,3024 **** post_post_garbage_hack( httpd_conn* hc ) { char buf[2]; - int r; - r = recv( hc->conn_fd, buf, sizeof(buf), MSG_PEEK ); - if ( r > 0 ) - (void) read( hc->conn_fd, buf, r ); } --- 3025,3033 ---- post_post_garbage_hack( httpd_conn* hc ) { char buf[2]; + fcntl(hc->conn_fd, F_SETFL, O_NONBLOCK); + (void) read( hc->conn_fd, buf, 2 ); } -- Edit bug report at http://bugs.php.net/?id=15583&edit=1 -- Fixed in CVS: http://bugs.php.net/fix.php?id=15583&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=15583&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=15583&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=15583&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=15583&r=support Expected behavior: http://bugs.php.net/fix.php?id=15583&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=15583&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=15583&r=submittedtwice