summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam A. Rowe Jr <wrowe@apache.org>2002-06-12 23:59:31 +0000
committerWilliam A. Rowe Jr <wrowe@apache.org>2002-06-12 23:59:31 +0000
commit7af68c0bf546ffe8aa86b9251258037eda6bc903 (patch)
tree2bb33b97192e0e42931893e5aaf4d70f53b41d19
parentddc19c042ee44d8cfe17dd34ed6f9e7bdea2ebf8 (diff)
downloadhttpd-7af68c0bf546ffe8aa86b9251258037eda6bc903.tar.gz
Solve the 80/20 by initializing and storing server_rec->timeout and
server_rec->keep_alive_timeout in apr_time_interval_t format (in apr units, whatever they be), as both values exist to pass into APR, and all APR timeouts are in apr_time_t. Reviewed by: Cliff Woolley git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@95623 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--include/ap_mmn.h3
-rw-r--r--include/httpd.h8
-rw-r--r--modules/experimental/mod_ext_filter.c4
-rw-r--r--modules/generators/mod_cgi.c11
-rw-r--r--modules/generators/mod_info.c3
-rw-r--r--modules/http/http_core.c2
-rw-r--r--modules/http/http_protocol.c10
-rw-r--r--modules/proxy/mod_proxy.c2
-rw-r--r--modules/proxy/proxy_ftp.c7
-rw-r--r--modules/proxy/proxy_util.c6
-rw-r--r--server/config.c4
-rw-r--r--server/core.c8
12 files changed, 30 insertions, 38 deletions
diff --git a/include/ap_mmn.h b/include/ap_mmn.h
index 9245480048..13938579b1 100644
--- a/include/ap_mmn.h
+++ b/include/ap_mmn.h
@@ -107,12 +107,13 @@
* 20020506 (2.0.37-dev) Removed r->boundary in request_rec.
* 20020529 (2.0.37-dev) Standardized the names of some apr_pool_*_set funcs
* 20020602 (2.0.37-dev) Bucket API change (metadata buckets)
+ * 20020612 (2.0.38-dev) Changed server_rec->[keep_alive_]timeout to apr time
*/
#define MODULE_MAGIC_COOKIE 0x41503230UL /* "AP20" */
#ifndef MODULE_MAGIC_NUMBER_MAJOR
-#define MODULE_MAGIC_NUMBER_MAJOR 20020602
+#define MODULE_MAGIC_NUMBER_MAJOR 20020612
#endif
#define MODULE_MAGIC_NUMBER_MINOR 1 /* 0...n */
diff --git a/include/httpd.h b/include/httpd.h
index 78cdb4121a..e70044cba6 100644
--- a/include/httpd.h
+++ b/include/httpd.h
@@ -1078,10 +1078,10 @@ struct server_rec {
/** I haven't got a clue */
server_addr_rec *addrs;
- /** Timeout, in seconds, before we give up */
- int timeout;
- /** Seconds we'll wait for another request */
- int keep_alive_timeout;
+ /** Timeout, as an apr interval, before we give up */
+ apr_interval_time_t timeout;
+ /** The apr interval we will wait for another request */
+ apr_interval_time_t keep_alive_timeout;
/** Maximum requests per connection */
int keep_alive_max;
/** Use persistent connections? */
diff --git a/modules/experimental/mod_ext_filter.c b/modules/experimental/mod_ext_filter.c
index e7ddee2cbe..8e94408603 100644
--- a/modules/experimental/mod_ext_filter.c
+++ b/modules/experimental/mod_ext_filter.c
@@ -604,7 +604,7 @@ static apr_status_t pass_data_to_filter(ap_filter_t *f, const char *data,
rv = apr_poll(ctx->pollset,
&num_events,
- f->r->server->timeout * APR_USEC_PER_SEC);
+ f->r->server->timeout);
if (rv || dc->debug >= DBGLVL_GORY) {
ap_log_rerror(APLOG_MARK, APLOG_DEBUG,
rv, f->r, "apr_poll()");
@@ -696,7 +696,7 @@ static apr_status_t ef_output_filter(ap_filter_t *f, apr_bucket_brigade *bb)
* timeout; we don't care if we don't return from apr_file_read() for a while...
*/
rv = apr_file_pipe_timeout_set(ctx->proc->out,
- r->server->timeout * APR_USEC_PER_SEC);
+ r->server->timeout);
if (rv) {
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
"apr_file_pipe_timeout_set(child output)");
diff --git a/modules/generators/mod_cgi.c b/modules/generators/mod_cgi.c
index 88e70ae207..daad028808 100644
--- a/modules/generators/mod_cgi.c
+++ b/modules/generators/mod_cgi.c
@@ -490,23 +490,18 @@ static apr_status_t run_cgi_child(apr_file_t **script_out,
*script_in = procnew->out;
if (!*script_in)
return APR_EBADF;
- apr_file_pipe_timeout_set(*script_in, (int)(r->server->timeout *
- APR_USEC_PER_SEC));
+ apr_file_pipe_timeout_set(*script_in, r->server->timeout);
if (e_info->prog_type == RUN_AS_CGI) {
*script_out = procnew->in;
if (!*script_out)
return APR_EBADF;
- apr_file_pipe_timeout_set(*script_out,
- (int)(r->server->timeout *
- APR_USEC_PER_SEC));
+ apr_file_pipe_timeout_set(*script_out, r->server->timeout);
*script_err = procnew->err;
if (!*script_err)
return APR_EBADF;
- apr_file_pipe_timeout_set(*script_err,
- (int)(r->server->timeout *
- APR_USEC_PER_SEC));
+ apr_file_pipe_timeout_set(*script_err, r->server->timeout);
}
}
}
diff --git a/modules/generators/mod_info.c b/modules/generators/mod_info.c
index 3623155f72..f29b82f6f8 100644
--- a/modules/generators/mod_info.c
+++ b/modules/generators/mod_info.c
@@ -395,7 +395,8 @@ static int display_info(request_rec *r)
ap_rprintf(r, "<dt><strong>Timeouts:</strong> "
"<tt>connection: %d &nbsp;&nbsp; "
"keep-alive: %d</tt></dt>",
- serv->timeout, serv->keep_alive_timeout);
+ (int)(apr_time_sec(serv->timeout)),
+ (int)(apr_time_sec(serv->timeout)));
ap_mpm_query(AP_MPMQ_MAX_DAEMON_USED, &max_daemons);
ap_mpm_query(AP_MPMQ_IS_THREADED, &threaded);
ap_mpm_query(AP_MPMQ_IS_FORKED, &forked);
diff --git a/modules/http/http_core.c b/modules/http/http_core.c
index 854b7c9289..cc51aee644 100644
--- a/modules/http/http_core.c
+++ b/modules/http/http_core.c
@@ -91,7 +91,7 @@ static const char *set_keep_alive_timeout(cmd_parms *cmd, void *dummy,
return err;
}
- cmd->server->keep_alive_timeout = atoi(arg);
+ cmd->server->keep_alive_timeout = apr_time_from_sec(atoi(arg));
return NULL;
}
diff --git a/modules/http/http_protocol.c b/modules/http/http_protocol.c
index cab3bafe0c..7a1f4e8e7a 100644
--- a/modules/http/http_protocol.c
+++ b/modules/http/http_protocol.c
@@ -254,14 +254,14 @@ AP_DECLARE(int) ap_set_keepalive(request_rec *r)
if (ka_sent) {
if (r->server->keep_alive_max) {
apr_table_setn(r->headers_out, "Keep-Alive",
- apr_psprintf(r->pool, "timeout=%d, max=%d",
- r->server->keep_alive_timeout,
- left));
+ apr_psprintf(r->pool, "timeout=%d, max=%d",
+ (int)apr_time_sec(r->server->keep_alive_timeout),
+ left));
}
else {
apr_table_setn(r->headers_out, "Keep-Alive",
- apr_psprintf(r->pool, "timeout=%d",
- r->server->keep_alive_timeout));
+ apr_psprintf(r->pool, "timeout=%d",
+ (int)apr_time_sec(r->server->keep_alive_timeout)));
}
apr_table_mergen(r->headers_out, "Connection", "Keep-Alive");
}
diff --git a/modules/proxy/mod_proxy.c b/modules/proxy/mod_proxy.c
index 513c82045c..e78415aae3 100644
--- a/modules/proxy/mod_proxy.c
+++ b/modules/proxy/mod_proxy.c
@@ -886,7 +886,7 @@ static const char*
return "Proxy Timeout must be at least 1 second.";
}
psf->timeout_set=1;
- psf->timeout=timeout;
+ psf->timeout=apr_time_from_sec(timeout);
return NULL;
}
diff --git a/modules/proxy/proxy_ftp.c b/modules/proxy/proxy_ftp.c
index 93b5582fe2..4bbcaf679e 100644
--- a/modules/proxy/proxy_ftp.c
+++ b/modules/proxy/proxy_ftp.c
@@ -968,14 +968,11 @@ int ap_proxy_ftp_handler(request_rec *r, proxy_server_conf *conf,
/* Set a timeout on the socket */
if (conf->timeout_set == 1) {
- apr_setsocketopt(sock,
- APR_SO_TIMEOUT,
- (int)(conf->timeout * APR_USEC_PER_SEC));
+ apr_setsocketopt(sock, APR_SO_TIMEOUT, conf->timeout);
}
else {
apr_setsocketopt(sock,
- APR_SO_TIMEOUT,
- (int)(r->server->timeout * APR_USEC_PER_SEC));
+ APR_SO_TIMEOUT, r->server->timeout);
}
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
diff --git a/modules/proxy/proxy_util.c b/modules/proxy/proxy_util.c
index 355e51bad8..94106f8c9c 100644
--- a/modules/proxy/proxy_util.c
+++ b/modules/proxy/proxy_util.c
@@ -1158,12 +1158,10 @@ PROXY_DECLARE(int) ap_proxy_connect_to_backend(apr_socket_t **newsock,
/* Set a timeout on the socket */
if (conf->timeout_set == 1) {
- apr_setsocketopt(*newsock, APR_SO_TIMEOUT,
- (int)(conf->timeout * APR_USEC_PER_SEC));
+ apr_setsocketopt(*newsock, APR_SO_TIMEOUT, conf->timeout);
}
else {
- apr_setsocketopt(*newsock, APR_SO_TIMEOUT,
- (int)(s->timeout * APR_USEC_PER_SEC));
+ apr_setsocketopt(*newsock, APR_SO_TIMEOUT, s->timeout);
}
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s,
diff --git a/server/config.c b/server/config.c
index 0b0ded380a..d8932345da 100644
--- a/server/config.c
+++ b/server/config.c
@@ -1726,8 +1726,8 @@ static server_rec *init_server_config(process_rec *process, apr_pool_t *p)
s->limit_req_line = DEFAULT_LIMIT_REQUEST_LINE;
s->limit_req_fieldsize = DEFAULT_LIMIT_REQUEST_FIELDSIZE;
s->limit_req_fields = DEFAULT_LIMIT_REQUEST_FIELDS;
- s->timeout = DEFAULT_TIMEOUT;
- s->keep_alive_timeout = DEFAULT_KEEPALIVE_TIMEOUT;
+ s->timeout = apr_time_from_sec(DEFAULT_TIMEOUT);
+ s->keep_alive_timeout = apr_time_from_sec(DEFAULT_KEEPALIVE_TIMEOUT);
s->keep_alive_max = DEFAULT_KEEPALIVE;
s->keep_alive = 1;
s->next = NULL;
diff --git a/server/core.c b/server/core.c
index 8454dbc997..037454b0dc 100644
--- a/server/core.c
+++ b/server/core.c
@@ -2041,7 +2041,7 @@ static const char *set_timeout(cmd_parms *cmd, void *dummy, const char *arg)
return err;
}
- cmd->server->timeout = atoi(arg);
+ cmd->server->timeout = apr_time_from_sec(atoi(arg));
return NULL;
}
@@ -3310,14 +3310,14 @@ static int net_time_filter(ap_filter_t *f, apr_bucket_brigade *b,
if (*first_line) {
apr_setsocketopt(csd, APR_SO_TIMEOUT,
(int)(keptalive
- ? f->c->base_server->keep_alive_timeout * APR_USEC_PER_SEC
- : f->c->base_server->timeout * APR_USEC_PER_SEC));
+ ? f->c->base_server->keep_alive_timeout
+ : f->c->base_server->timeout));
*first_line = 0;
}
else {
if (keptalive) {
apr_setsocketopt(csd, APR_SO_TIMEOUT,
- (int)(f->c->base_server->timeout * APR_USEC_PER_SEC));
+ (int)(f->c->base_server->timeout));
}
}
}