From: Sascha Schumann Date: Thu, 13 Feb 2003 02:30:54 +0000 (+0000) Subject: MFH X-Git-Tag: php-4.3.2RC1~240 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=69a24f699d3274543478acb26628dfc6654d4e72;p=php MFH --- diff --git a/sapi/thttpd/thttpd_patch b/sapi/thttpd/thttpd_patch index 2a239f3923..404686c13c 100644 --- a/sapi/thttpd/thttpd_patch +++ b/sapi/thttpd/thttpd_patch @@ -1,6 +1,6 @@ diff -ur thttpd-2.21b/Makefile.in thttpd-2.21b-cool/Makefile.in --- thttpd-2.21b/Makefile.in Thu Mar 29 20:36:21 2001 -+++ thttpd-2.21b-cool/Makefile.in Tue Feb 11 01:56:18 2003 ++++ thttpd-2.21b-cool/Makefile.in Thu Feb 13 03:27:55 2003 @@ -46,13 +46,15 @@ # You shouldn't need to edit anything below here. @@ -49,7 +49,7 @@ diff -ur thttpd-2.21b/Makefile.in thttpd-2.21b-cool/Makefile.in @name=`sed -n -e '/SERVER_SOFTWARE/!d' -e 's,.*thttpd/,thttpd-,' -e 's, .*,,p' version.h` ; \ diff -ur thttpd-2.21b/config.h thttpd-2.21b-cool/config.h --- thttpd-2.21b/config.h Mon Apr 9 23:57:36 2001 -+++ thttpd-2.21b-cool/config.h Tue Feb 11 01:56:18 2003 ++++ thttpd-2.21b-cool/config.h Thu Feb 13 03:27:55 2003 @@ -82,6 +82,11 @@ */ #define IDLE_READ_TIMELIMIT 60 @@ -73,7 +73,7 @@ diff -ur thttpd-2.21b/config.h thttpd-2.21b-cool/config.h ** index pages for directories that don't have an explicit index file. diff -ur thttpd-2.21b/configure thttpd-2.21b-cool/configure --- thttpd-2.21b/configure Sat Apr 21 02:07:14 2001 -+++ thttpd-2.21b-cool/configure Tue Feb 11 01:56:18 2003 ++++ thttpd-2.21b-cool/configure Thu Feb 13 03:27:55 2003 @@ -1021,7 +1021,7 @@ fi echo "$ac_t""$CPP" 1>&6 @@ -85,7 +85,7 @@ diff -ur thttpd-2.21b/configure thttpd-2.21b-cool/configure echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 diff -ur thttpd-2.21b/configure.in thttpd-2.21b-cool/configure.in --- thttpd-2.21b/configure.in Sat Apr 21 02:06:23 2001 -+++ thttpd-2.21b-cool/configure.in Tue Feb 11 01:56:18 2003 ++++ thttpd-2.21b-cool/configure.in Thu Feb 13 03:27:55 2003 @@ -64,7 +64,7 @@ AC_MSG_RESULT(no) fi @@ -97,7 +97,7 @@ diff -ur thttpd-2.21b/configure.in thttpd-2.21b-cool/configure.in diff -ur thttpd-2.21b/fdwatch.c thttpd-2.21b-cool/fdwatch.c --- thttpd-2.21b/fdwatch.c Fri Apr 13 07:36:08 2001 -+++ thttpd-2.21b-cool/fdwatch.c Tue Feb 11 01:56:18 2003 ++++ thttpd-2.21b-cool/fdwatch.c Thu Feb 13 03:27:55 2003 @@ -460,7 +460,7 @@ ridx = 0; @@ -120,7 +120,7 @@ diff -ur thttpd-2.21b/fdwatch.c thttpd-2.21b-cool/fdwatch.c } diff -ur thttpd-2.21b/libhttpd.c thttpd-2.21b-cool/libhttpd.c --- thttpd-2.21b/libhttpd.c Tue Apr 24 00:42:40 2001 -+++ thttpd-2.21b-cool/libhttpd.c Tue Feb 11 01:56:18 2003 ++++ thttpd-2.21b-cool/libhttpd.c Thu Feb 13 03:27:55 2003 @@ -56,6 +56,10 @@ #include #include @@ -621,7 +621,7 @@ diff -ur thttpd-2.21b/libhttpd.c thttpd-2.21b-cool/libhttpd.c diff -ur thttpd-2.21b/libhttpd.h thttpd-2.21b-cool/libhttpd.h --- thttpd-2.21b/libhttpd.h Tue Apr 24 00:36:50 2001 -+++ thttpd-2.21b-cool/libhttpd.h Tue Feb 11 01:56:18 2003 ++++ thttpd-2.21b-cool/libhttpd.h Thu Feb 13 03:27:55 2003 @@ -69,6 +69,8 @@ char* server_hostname; int port; @@ -674,7 +674,7 @@ diff -ur thttpd-2.21b/libhttpd.h thttpd-2.21b-cool/libhttpd.h ** mallocced strings. diff -ur thttpd-2.21b/mime_encodings.txt thttpd-2.21b-cool/mime_encodings.txt --- thttpd-2.21b/mime_encodings.txt Wed May 10 03:22:28 2000 -+++ thttpd-2.21b-cool/mime_encodings.txt Tue Feb 11 01:56:18 2003 ++++ thttpd-2.21b-cool/mime_encodings.txt Thu Feb 13 03:27:55 2003 @@ -3,6 +3,6 @@ # A list of file extensions followed by the corresponding MIME encoding. # Extensions not found in the table proceed to the mime_types table. @@ -686,7 +686,7 @@ diff -ur thttpd-2.21b/mime_encodings.txt thttpd-2.21b-cool/mime_encodings.txt uu x-uuencode diff -ur thttpd-2.21b/mime_types.txt thttpd-2.21b-cool/mime_types.txt --- thttpd-2.21b/mime_types.txt Sat Apr 14 04:53:30 2001 -+++ thttpd-2.21b-cool/mime_types.txt Tue Feb 11 01:56:18 2003 ++++ thttpd-2.21b-cool/mime_types.txt Thu Feb 13 03:27:55 2003 @@ -1,135 +1,138 @@ -# mime_types.txt -# @@ -937,7 +937,7 @@ diff -ur thttpd-2.21b/mime_types.txt thttpd-2.21b-cool/mime_types.txt +ice x-conference/x-cooltalk diff -ur thttpd-2.21b/mmc.c thttpd-2.21b-cool/mmc.c --- thttpd-2.21b/mmc.c Fri Apr 13 23:02:15 2001 -+++ thttpd-2.21b-cool/mmc.c Tue Feb 11 01:56:18 2003 ++++ thttpd-2.21b-cool/mmc.c Thu Feb 13 03:27:55 2003 @@ -70,6 +70,7 @@ unsigned int hash; int hash_idx; @@ -1009,7 +1009,7 @@ diff -ur thttpd-2.21b/mmc.c thttpd-2.21b-cool/mmc.c else diff -ur thttpd-2.21b/mmc.h thttpd-2.21b-cool/mmc.h --- thttpd-2.21b/mmc.h Fri Apr 13 07:36:54 2001 -+++ thttpd-2.21b-cool/mmc.h Tue Feb 11 01:56:18 2003 ++++ thttpd-2.21b-cool/mmc.h Thu Feb 13 03:27:55 2003 @@ -31,8 +31,9 @@ /* Returns an mmap()ed area for the given file, or (void*) 0 on errors. ** If you have a stat buffer on the file, pass it in, otherwise pass 0. @@ -1023,17 +1023,19 @@ diff -ur thttpd-2.21b/mmc.h thttpd-2.21b-cool/mmc.h ** If you have a stat buffer on the file, pass it in, otherwise pass 0. diff -ur thttpd-2.21b/thttpd.c thttpd-2.21b-cool/thttpd.c --- thttpd-2.21b/thttpd.c Tue Apr 24 00:41:57 2001 -+++ thttpd-2.21b-cool/thttpd.c Tue Feb 11 01:57:04 2003 -@@ -53,6 +53,8 @@ ++++ thttpd-2.21b-cool/thttpd.c Thu Feb 13 03:28:11 2003 +@@ -53,6 +53,10 @@ #endif #include +#include ++ ++#include + #include "fdwatch.h" #include "libhttpd.h" #include "mmc.h" -@@ -66,6 +68,8 @@ +@@ -66,6 +70,8 @@ static char* dir; static int do_chroot, no_log, no_symlink, do_vhost, do_global_passwd; static char* cgi_pattern; @@ -1042,7 +1044,7 @@ diff -ur thttpd-2.21b/thttpd.c thttpd-2.21b-cool/thttpd.c static char* url_pattern; static int no_empty_referers; static char* local_pattern; -@@ -95,10 +99,10 @@ +@@ -95,10 +101,10 @@ httpd_conn* hc; int tnums[MAXTHROTTLENUMS]; /* throttle indexes */ int numtnums; @@ -1055,7 +1057,7 @@ diff -ur thttpd-2.21b/thttpd.c thttpd-2.21b-cool/thttpd.c Timer* wakeup_timer; Timer* linger_timer; long wouldblock_delay; -@@ -106,17 +110,22 @@ +@@ -106,17 +112,22 @@ off_t bytes_sent; off_t bytes_to_send; } connecttab; @@ -1085,7 +1087,7 @@ diff -ur thttpd-2.21b/thttpd.c thttpd-2.21b-cool/thttpd.c static httpd_server* hs = (httpd_server*) 0; int terminate = 0; -@@ -140,14 +149,15 @@ +@@ -140,14 +151,15 @@ static int handle_newconnect( struct timeval* tvP, int listen_fd ); static void handle_read( connecttab* c, struct timeval* tvP ); static void handle_send( connecttab* c, struct timeval* tvP ); @@ -1104,22 +1106,22 @@ diff -ur thttpd-2.21b/thttpd.c thttpd-2.21b-cool/thttpd.c static void wakeup_connection( ClientData client_data, struct timeval* nowP ); static void linger_clear_connection( ClientData client_data, struct timeval* nowP ); static void occasional( ClientData client_data, struct timeval* nowP ); -@@ -156,7 +166,14 @@ +@@ -156,7 +168,14 @@ #endif /* STATS_TIME */ static void logstats( struct timeval* nowP ); static void thttpd_logstats( long secs ); +static void boot_request(connecttab *c, struct timeval *tvP); + +typedef void (*handler_func)(connecttab*, struct timeval *); - ++ +handler_func handler_array[CNST_TOTAL_NR] = +{NULL, handle_read, handle_send, NULL, handle_linger, handle_send_resp, handle_read_body}; -+ + +#define RUN_HANDLER(type, c) if (handler_array[type]) handler_array[type](c, &tv) static void handle_term( int sig ) -@@ -177,7 +194,7 @@ +@@ -177,7 +196,7 @@ return; /* Re-open the log file. */ @@ -1128,7 +1130,7 @@ diff -ur thttpd-2.21b/thttpd.c thttpd-2.21b-cool/thttpd.c { logfp = fopen( logfile, "a" ); if ( logfp == (FILE*) 0 ) -@@ -198,6 +215,8 @@ +@@ -198,6 +217,8 @@ } @@ -1137,7 +1139,7 @@ diff -ur thttpd-2.21b/thttpd.c thttpd-2.21b-cool/thttpd.c static void handle_usr2( int sig ) { -@@ -217,7 +236,6 @@ +@@ -217,7 +238,6 @@ int num_ready; int cnum, ridx; connecttab* c; @@ -1145,7 +1147,7 @@ diff -ur thttpd-2.21b/thttpd.c thttpd-2.21b-cool/thttpd.c httpd_sockaddr sa4; httpd_sockaddr sa6; int gotv4, gotv6; -@@ -270,7 +288,9 @@ +@@ -270,7 +290,9 @@ no_log = 1; logfp = (FILE*) 0; } @@ -1156,7 +1158,7 @@ diff -ur thttpd-2.21b/thttpd.c thttpd-2.21b-cool/thttpd.c { logfp = fopen( logfile, "a" ); if ( logfp == (FILE*) 0 ) -@@ -420,7 +440,8 @@ +@@ -420,7 +442,8 @@ hostname, gotv4 ? &sa4 : (httpd_sockaddr*) 0, gotv6 ? &sa6 : (httpd_sockaddr*) 0, port, cgi_pattern, charset, cwd, no_log, logfp, no_symlink, do_vhost, @@ -1166,7 +1168,7 @@ diff -ur thttpd-2.21b/thttpd.c thttpd-2.21b-cool/thttpd.c if ( hs == (httpd_server*) 0 ) exit( 1 ); -@@ -430,6 +451,12 @@ +@@ -430,6 +453,12 @@ syslog( LOG_CRIT, "tmr_create(occasional) failed" ); exit( 1 ); } @@ -1179,7 +1181,7 @@ diff -ur thttpd-2.21b/thttpd.c thttpd-2.21b-cool/thttpd.c if ( numthrottles > 0 ) { /* Set up the throttles timer. */ -@@ -454,12 +481,14 @@ +@@ -454,12 +483,14 @@ /* If we're root, try to become someone else. */ if ( getuid() == 0 ) { @@ -1194,7 +1196,7 @@ diff -ur thttpd-2.21b/thttpd.c thttpd-2.21b-cool/thttpd.c /* Set primary group. */ if ( setgid( gid ) < 0 ) { -@@ -495,13 +524,17 @@ +@@ -495,13 +526,17 @@ } maxconnects -= SPARE_FDS; connects = NEW( connecttab, maxconnects ); @@ -1212,7 +1214,7 @@ diff -ur thttpd-2.21b/thttpd.c thttpd-2.21b-cool/thttpd.c connects[cnum].conn_state = CNST_FREE; connects[cnum].hc = (httpd_conn*) 0; } -@@ -518,6 +551,8 @@ +@@ -518,6 +553,8 @@ /* Main loop. */ (void) gettimeofday( &tv, (struct timezone*) 0 ); @@ -1221,7 +1223,7 @@ diff -ur thttpd-2.21b/thttpd.c thttpd-2.21b-cool/thttpd.c while ( ( ! terminate ) || numconnects > 0 ) { /* Do the fd watch. */ -@@ -565,16 +600,10 @@ +@@ -565,16 +602,10 @@ c = (connecttab*) fdwatch_get_client_data( ridx ); if ( c == (connecttab*) 0 ) continue; @@ -1242,7 +1244,7 @@ diff -ur thttpd-2.21b/thttpd.c thttpd-2.21b-cool/thttpd.c } tmr_run( &tv ); -@@ -627,6 +656,8 @@ +@@ -627,6 +658,8 @@ #else /* CGI_PATTERN */ cgi_pattern = (char*) 0; #endif /* CGI_PATTERN */ @@ -1251,7 +1253,7 @@ diff -ur thttpd-2.21b/thttpd.c thttpd-2.21b-cool/thttpd.c url_pattern = (char*) 0; no_empty_referers = 0; local_pattern = (char*) 0; -@@ -833,6 +864,16 @@ +@@ -833,6 +866,16 @@ value_required( name, value ); cgi_pattern = e_strdup( value ); } @@ -1268,7 +1270,7 @@ diff -ur thttpd-2.21b/thttpd.c thttpd-2.21b-cool/thttpd.c else if ( strcasecmp( name, "urlpat" ) == 0 ) { value_required( name, value ); -@@ -1196,8 +1237,10 @@ +@@ -1196,8 +1239,10 @@ logstats( &tv ); for ( cnum = 0; cnum < maxconnects; ++cnum ) { @@ -1280,7 +1282,7 @@ diff -ur thttpd-2.21b/thttpd.c thttpd-2.21b-cool/thttpd.c if ( connects[cnum].hc != (httpd_conn*) 0 ) { httpd_destroy_conn( connects[cnum].hc ); -@@ -1214,6 +1257,7 @@ +@@ -1214,6 +1259,7 @@ } mmc_destroy(); tmr_destroy(); @@ -1288,7 +1290,7 @@ diff -ur thttpd-2.21b/thttpd.c thttpd-2.21b-cool/thttpd.c free( (void*) connects ); if ( throttles != (throttletab*) 0 ) free( (void*) throttles ); -@@ -1234,7 +1278,7 @@ +@@ -1234,7 +1280,7 @@ for (;;) { /* Is there room in the connection table? */ @@ -1297,7 +1299,7 @@ diff -ur thttpd-2.21b/thttpd.c thttpd-2.21b-cool/thttpd.c { /* Out of connection slots. Run the timers, then the ** existing connections, and maybe we'll free up a slot -@@ -1245,10 +1289,10 @@ +@@ -1245,10 +1291,10 @@ return 0; } /* Find a free connection entry. */ @@ -1312,7 +1314,7 @@ diff -ur thttpd-2.21b/thttpd.c thttpd-2.21b-cool/thttpd.c /* Make the httpd_conn if necessary. */ if ( c->hc == (httpd_conn*) 0 ) { -@@ -1267,24 +1311,18 @@ +@@ -1267,24 +1313,18 @@ { case GC_FAIL: case GC_NO_MORE: @@ -1340,7 +1342,7 @@ diff -ur thttpd-2.21b/thttpd.c thttpd-2.21b-cool/thttpd.c /* Set the connection file descriptor to no-delay mode. */ httpd_set_ndelay( c->hc->conn_fd ); -@@ -1297,12 +1335,79 @@ +@@ -1297,12 +1337,79 @@ } } @@ -1421,7 +1423,7 @@ diff -ur thttpd-2.21b/thttpd.c thttpd-2.21b-cool/thttpd.c httpd_conn* hc = c->hc; /* Is there room in our buffer to read more bytes? */ -@@ -1311,7 +1416,7 @@ +@@ -1311,7 +1418,7 @@ if ( hc->read_size > 5000 ) { httpd_send_err( hc, 400, httpd_err400title, "", httpd_err400form, "" ); @@ -1430,7 +1432,7 @@ diff -ur thttpd-2.21b/thttpd.c thttpd-2.21b-cool/thttpd.c return; } httpd_realloc_str( -@@ -1327,14 +1432,53 @@ +@@ -1327,14 +1434,53 @@ ** EWOULDBLOCK; however, this apparently can happen if a packet gets ** garbled. */ @@ -1489,7 +1491,7 @@ diff -ur thttpd-2.21b/thttpd.c thttpd-2.21b-cool/thttpd.c /* Do we have a complete request yet? */ switch ( httpd_got_request( hc ) ) { -@@ -1342,14 +1486,14 @@ +@@ -1342,14 +1488,14 @@ return; case GR_BAD_REQUEST: httpd_send_err( hc, 400, httpd_err400title, "", httpd_err400form, "" ); @@ -1506,7 +1508,7 @@ diff -ur thttpd-2.21b/thttpd.c thttpd-2.21b-cool/thttpd.c return; } -@@ -1358,18 +1502,28 @@ +@@ -1358,18 +1504,28 @@ { httpd_send_err( hc, 503, httpd_err503title, "", httpd_err503form, hc->encodedurl ); @@ -1537,7 +1539,7 @@ diff -ur thttpd-2.21b/thttpd.c thttpd-2.21b-cool/thttpd.c /* Fill in bytes_to_send. */ if ( hc->got_range ) { -@@ -1384,37 +1538,25 @@ +@@ -1384,37 +1540,25 @@ { /* No file address means someone else is handling it. */ c->bytes_sent = hc->bytes_sent; @@ -1583,7 +1585,7 @@ diff -ur thttpd-2.21b/thttpd.c thttpd-2.21b-cool/thttpd.c static void handle_send( connecttab* c, struct timeval* tvP ) { -@@ -1443,6 +1585,9 @@ +@@ -1443,6 +1587,9 @@ iv[1].iov_base = &(hc->file_address[c->bytes_sent]); iv[1].iov_len = MIN( c->bytes_to_send - c->bytes_sent, c->limit ); sz = writev( hc->conn_fd, iv, 2 ); @@ -1593,7 +1595,7 @@ diff -ur thttpd-2.21b/thttpd.c thttpd-2.21b-cool/thttpd.c } if ( sz == 0 || -@@ -1486,12 +1631,12 @@ +@@ -1486,12 +1633,12 @@ */ if ( errno != EPIPE && errno != EINVAL && errno != ECONNRESET ) syslog( LOG_ERR, "write - %m sending %.80s", hc->encodedurl ); @@ -1608,7 +1610,7 @@ diff -ur thttpd-2.21b/thttpd.c thttpd-2.21b-cool/thttpd.c /* Was this a headers + file writev()? */ if ( hc->responselen > 0 ) { -@@ -1500,7 +1645,7 @@ +@@ -1500,7 +1647,7 @@ { /* Yes; move the unwritten part to the front of the buffer. */ int newlen = hc->responselen - sz; @@ -1617,7 +1619,7 @@ diff -ur thttpd-2.21b/thttpd.c thttpd-2.21b-cool/thttpd.c hc->responselen = newlen; sz = 0; } -@@ -1519,7 +1664,7 @@ +@@ -1519,7 +1666,7 @@ if ( c->bytes_sent >= c->bytes_to_send ) { /* This conection is finished! */ @@ -1626,7 +1628,7 @@ diff -ur thttpd-2.21b/thttpd.c thttpd-2.21b-cool/thttpd.c return; } -@@ -1560,6 +1705,9 @@ +@@ -1560,6 +1707,9 @@ char buf[1024]; int r; @@ -1636,7 +1638,7 @@ diff -ur thttpd-2.21b/thttpd.c thttpd-2.21b-cool/thttpd.c /* In lingering-close mode we just read and ignore bytes. An error ** or EOF ends things, otherwise we go until a timeout. */ -@@ -1569,6 +1717,61 @@ +@@ -1569,6 +1719,61 @@ } @@ -1698,7 +1700,7 @@ diff -ur thttpd-2.21b/thttpd.c thttpd-2.21b-cool/thttpd.c static int check_throttles( connecttab* c ) { -@@ -1635,23 +1838,18 @@ +@@ -1635,23 +1840,18 @@ static void @@ -1728,7 +1730,7 @@ diff -ur thttpd-2.21b/thttpd.c thttpd-2.21b-cool/thttpd.c if ( c->wakeup_timer != (Timer*) 0 ) { tmr_cancel( c->wakeup_timer ); -@@ -1669,13 +1867,36 @@ +@@ -1669,13 +1869,36 @@ ** circumstances that make a lingering close necessary. If the flag ** isn't set we do the real close now. */ @@ -1767,7 +1769,7 @@ diff -ur thttpd-2.21b/thttpd.c thttpd-2.21b-cool/thttpd.c client_data.p = c; c->linger_timer = tmr_create( tvP, linger_clear_connection, client_data, LINGER_TIME * 1000L, 0 ); -@@ -1684,9 +1905,19 @@ +@@ -1684,9 +1907,19 @@ syslog( LOG_CRIT, "tmr_create(linger_clear_connection) failed" ); exit( 1 ); } @@ -1788,7 +1790,7 @@ diff -ur thttpd-2.21b/thttpd.c thttpd-2.21b-cool/thttpd.c } -@@ -1702,45 +1933,12 @@ +@@ -1702,45 +1935,12 @@ tmr_cancel( c->linger_timer ); c->linger_timer = 0; } @@ -1835,7 +1837,7 @@ diff -ur thttpd-2.21b/thttpd.c thttpd-2.21b-cool/thttpd.c static void wakeup_connection( ClientData client_data, struct timeval* nowP ) -@@ -1826,3 +2024,41 @@ +@@ -1826,3 +2026,41 @@ stats_connections = stats_bytes = 0L; stats_simultaneous = 0; }