summaryrefslogtreecommitdiff
path: root/sapi
diff options
context:
space:
mode:
authorSascha Schumann <sas@php.net>2003-05-15 16:54:37 +0000
committerSascha Schumann <sas@php.net>2003-05-15 16:54:37 +0000
commitedd6a6449a5ae0fb72f44e450a64c5c9d33396b4 (patch)
treef45fdaf5663bb8baac9f626587ee99e88f987988 /sapi
parente473374ff325b0fa320be21cae0dd2c181f0920a (diff)
downloadphp-git-edd6a6449a5ae0fb72f44e450a64c5c9d33396b4.tar.gz
Properly timeout post requests
Diffstat (limited to 'sapi')
-rw-r--r--sapi/thttpd/thttpd_patch21
1 files changed, 12 insertions, 9 deletions
diff --git a/sapi/thttpd/thttpd_patch b/sapi/thttpd/thttpd_patch
index 8c394e41ae..b6d7085ef3 100644
--- a/sapi/thttpd/thttpd_patch
+++ b/sapi/thttpd/thttpd_patch
@@ -1406,7 +1406,7 @@ 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 Thu May 15 18:38:35 2003
++++ thttpd-2.21b-cool/thttpd.c Thu May 15 18:51:28 2003
@@ -53,6 +53,10 @@
#endif
#include <unistd.h>
@@ -2045,7 +2045,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 +1728,61 @@
+@@ -1569,6 +1728,63 @@
}
@@ -2057,13 +2057,15 @@ diff -ur thttpd-2.21b/thttpd.c thttpd-2.21b-cool/thttpd.c
+
+ n = read(hc->conn_fd, hc->read_buf + hc->read_idx,
+ hc->contentlength - (hc->read_idx - hc->checked_idx));
-+
++
+ if (n <= 0) {
+ if (errno == EAGAIN)
+ return;
+ clear_connection(c, tvP, 0);
+ return;
+ }
++
++ c->last_io = httpd_time_now;
+
+ hc->read_idx += n;
+
@@ -2107,7 +2109,7 @@ diff -ur thttpd-2.21b/thttpd.c thttpd-2.21b-cool/thttpd.c
static int
check_throttles( connecttab* c )
{
-@@ -1635,23 +1849,18 @@
+@@ -1635,23 +1851,18 @@
static void
@@ -2137,7 +2139,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 +1878,36 @@
+@@ -1669,13 +1880,36 @@
** circumstances that make a lingering close necessary. If the flag
** isn't set we do the real close now.
*/
@@ -2176,7 +2178,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 +1916,19 @@
+@@ -1684,9 +1918,19 @@
syslog( LOG_CRIT, "tmr_create(linger_clear_connection) failed" );
exit( 1 );
}
@@ -2197,7 +2199,7 @@ diff -ur thttpd-2.21b/thttpd.c thttpd-2.21b-cool/thttpd.c
}
-@@ -1702,45 +1944,12 @@
+@@ -1702,45 +1946,12 @@
tmr_cancel( c->linger_timer );
c->linger_timer = 0;
}
@@ -2244,7 +2246,7 @@ diff -ur thttpd-2.21b/thttpd.c thttpd-2.21b-cool/thttpd.c
static void
wakeup_connection( ClientData client_data, struct timeval* nowP )
-@@ -1783,6 +1992,43 @@
+@@ -1783,6 +1994,43 @@
}
#endif /* STATS_TIME */
@@ -2288,7 +2290,7 @@ diff -ur thttpd-2.21b/thttpd.c thttpd-2.21b-cool/thttpd.c
/* Generate debugging statistics syslog messages for all packages. */
static void
-@@ -1826,3 +2072,41 @@
+@@ -1826,3 +2074,42 @@
stats_connections = stats_bytes = 0L;
stats_simultaneous = 0;
}
@@ -2312,6 +2314,7 @@ diff -ur thttpd-2.21b/thttpd.c thttpd-2.21b-cool/thttpd.c
+ }
+ break;
+ case CNST_READING:
++ case CNST_READING_BODY:
+ checked++;
+ if ((now - c->last_io) > IDLE_READ_TIMELIMIT) {
+ clear_connection( c, nowP, 0 );