diff -ur apache_1.3.23/src/include/httpd.h apache_1.3.23_recvtimeout/src/include/httpd.h --- apache_1.3.23/src/include/httpd.h Mon Jan 21 14:25:02 2002 +++ apache_1.3.23_recvtimeout/src/include/httpd.h Sat Jan 26 15:57:00 2002 @@ -264,11 +264,16 @@ #define MAX_STRING_LEN HUGE_STRING_LEN #define HUGE_STRING_LEN 8192 -/* The timeout for waiting for messages */ +/* The timeout for waiting for messages sent */ #ifndef DEFAULT_TIMEOUT #define DEFAULT_TIMEOUT 300 #endif +/* The timeout for waiting for messages received */ +#ifndef DEFAULT_RECV_TIMEOUT +#define DEFAULT_RECV_TIMEOUT 5 +#endif + /* The timeout for waiting for keepalive timeout until next request */ #ifndef DEFAULT_KEEPALIVE_TIMEOUT #define DEFAULT_KEEPALIVE_TIMEOUT 15 @@ -957,7 +962,7 @@ /* Transaction handling */ server_addr_rec *addrs; - int timeout; /* Timeout, in seconds, before we give up */ + int timeout; /* Timeout, in seconds, before we give up (general)*/ int keep_alive_timeout; /* Seconds we'll wait for another request */ int keep_alive_max; /* Maximum requests per connection */ int keep_alive; /* Use persistent connections? */ @@ -975,6 +980,7 @@ int limit_req_line; /* limit on size of the HTTP request line */ int limit_req_fieldsize; /* limit on size of any request header field */ int limit_req_fields; /* limit on number of request header fields */ + int recv_timeout; /* Timeout, in seconds, before we give up on receives */ }; /* These are more like real hosts than virtual hosts */ diff -ur apache_1.3.23/src/main/http_config.c apache_1.3.23_recvtimeout/src/main/http_config.c --- apache_1.3.23/src/main/http_config.c Sun Jan 20 15:14:37 2002 +++ apache_1.3.23_recvtimeout/src/main/http_config.c Sat Jan 26 14:17:26 2002 @@ -1417,6 +1417,7 @@ s->srm_confname = NULL; s->access_confname = NULL; s->timeout = 0; + s->recv_timeout = 0; s->keep_alive_timeout = 0; s->keep_alive = -1; s->keep_alive_max = -1; @@ -1470,6 +1471,9 @@ if (virt->timeout == 0) virt->timeout = main_server->timeout; + if (virt->recv_timeout == 0) + virt->recv_timeout = main_server->recv_timeout; + if (virt->keep_alive_timeout == 0) virt->keep_alive_timeout = main_server->keep_alive_timeout; @@ -1537,6 +1541,7 @@ s->limit_req_fieldsize = DEFAULT_LIMIT_REQUEST_FIELDSIZE; s->limit_req_fields = DEFAULT_LIMIT_REQUEST_FIELDS; s->timeout = DEFAULT_TIMEOUT; + s->recv_timeout = DEFAULT_RECV_TIMEOUT; s->keep_alive_timeout = DEFAULT_KEEPALIVE_TIMEOUT; s->keep_alive_max = DEFAULT_KEEPALIVE; s->keep_alive = 1; diff -ur apache_1.3.23/src/main/http_core.c apache_1.3.23_recvtimeout/src/main/http_core.c --- apache_1.3.23/src/main/http_core.c Wed Jan 16 16:34:32 2002 +++ apache_1.3.23_recvtimeout/src/main/http_core.c Sat Jan 26 14:17:26 2002 @@ -2165,6 +2165,17 @@ return NULL; } +static const char *set_recv_timeout(cmd_parms *cmd, void *dummy, char *arg) +{ + const char *err = ap_check_cmd_context(cmd, NOT_IN_DIR_LOC_FILE|NOT_IN_LIMIT); + if (err != NULL) { + return err; + } + + cmd->server->recv_timeout = atoi(arg); + return NULL; +} + static const char *set_keep_alive_timeout(cmd_parms *cmd, void *dummy, char *arg) { @@ -3274,6 +3285,7 @@ { "ServerPath", set_serverpath, NULL, RSRC_CONF, TAKE1, "The pathname the server can be reached at" }, { "Timeout", set_timeout, NULL, RSRC_CONF, TAKE1, "Timeout duration (sec)" }, +{ "RecvTimeout", set_recv_timeout, NULL, RSRC_CONF, TAKE1, "Timeout duration for receiving requests (sec)" }, { "KeepAliveTimeout", set_keep_alive_timeout, NULL, RSRC_CONF, TAKE1, "Keep-Alive timeout duration (sec)"}, { "MaxKeepAliveRequests", set_keep_alive_max, NULL, RSRC_CONF, TAKE1, diff -ur apache_1.3.23/src/main/http_main.c apache_1.3.23_recvtimeout/src/main/http_main.c --- apache_1.3.23/src/main/http_main.c Sun Jan 20 17:45:14 2002 +++ apache_1.3.23_recvtimeout/src/main/http_main.c Sat Jan 26 14:17:26 2002 @@ -1686,7 +1686,7 @@ if (r->connection->keptalive) to = r->server->keep_alive_timeout; else - to = r->server->timeout; + to = r->server->recv_timeout; ap_set_callback_and_alarm(timeout, to); } @@ -1707,6 +1707,25 @@ #endif timeout_name = name; ap_set_callback_and_alarm(timeout, r->server->timeout); +} + +API_EXPORT(void) ap_hard_recv_timeout(char *name, request_rec *r) +{ +#ifdef NETWARE + get_tsd +#endif + timeout_req = r; + timeout_name = name; + ap_set_callback_and_alarm(timeout, r->server->recv_timeout); +} + +API_EXPORT(void) ap_soft_recv_timeout(char *name, request_rec *r) +{ +#ifdef NETWARE + get_tsd +#endif + timeout_name = name; + ap_set_callback_and_alarm(timeout, r->server->recv_timeout); } API_EXPORT(void) ap_kill_timeout(request_rec *dummy) diff -ur apache_1.3.23/src/main/http_protocol.c apache_1.3.23_recvtimeout/src/main/http_protocol.c --- apache_1.3.23/src/main/http_protocol.c Mon Jan 21 16:56:43 2002 +++ apache_1.3.23_recvtimeout/src/main/http_protocol.c Sat Jan 26 14:17:26 2002 @@ -1172,7 +1172,7 @@ return NULL; } if (!r->assbackwards) { - ap_hard_timeout("read request headers", r); + ap_hard_recv_timeout("read request headers", r); get_mime_headers(r); ap_kill_timeout(r); if (r->status != HTTP_REQUEST_TIME_OUT) { @@ -2232,7 +2232,7 @@ r->connection->keepalive = -1; return OK; } - ap_hard_timeout("reading request body", r); + ap_hard_recv_timeout("reading request body", r); while ((rv = ap_get_client_block(r, dumpbuf, HUGE_STRING_LEN)) > 0) continue; ap_kill_timeout(r); diff -ur apache_1.3.23/src/modules/proxy/proxy_http.c apache_1.3.23_recvtimeout/src/modules/proxy/proxy_http.c --- apache_1.3.23/src/modules/proxy/proxy_http.c Sun Jan 20 15:14:37 2002 +++ apache_1.3.23_recvtimeout/src/modules/proxy/proxy_http.c Sat Jan 26 14:24:50 2002 @@ -386,7 +386,7 @@ /* Right - now it's time to listen for a response. */ - ap_hard_timeout("proxy receive", r); + ap_hard_recv_timeout("proxy receive", r); len = ap_bgets(buffer, sizeof buffer - 1, f); if (len == -1) { diff -ur apache_1.3.23/src/modules/standard/mod_info.c apache_1.3.23_recvtimeout/src/modules/standard/mod_info.c --- apache_1.3.23/src/modules/standard/mod_info.c Fri Mar 9 05:10:34 2001 +++ apache_1.3.23_recvtimeout/src/modules/standard/mod_info.c Sat Jan 26 14:17:26 2002 @@ -511,8 +511,9 @@ ap_excess_requests_per_child); ap_rprintf(r, "Timeouts: " "connection: %d    " + "recv: %d    " "keep-alive: %d
", - serv->timeout, serv->keep_alive_timeout); + serv->timeout, serv->recv_timeout, serv->keep_alive_timeout); ap_rprintf(r, "Server Root: " "%s
\n", ap_server_root); ap_rprintf(r, "Config File: "