You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by wr...@apache.org on 2002/06/13 01:59:31 UTC

cvs commit: httpd-2.0/server config.c core.c

wrowe       2002/06/12 16:59:31

  Modified:    include  ap_mmn.h httpd.h
               modules/experimental mod_ext_filter.c
               modules/generators mod_cgi.c mod_info.c
               modules/http http_core.c http_protocol.c
               modules/proxy mod_proxy.c proxy_ftp.c proxy_util.c
               server   config.c core.c
  Log:
    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
  
  Revision  Changes    Path
  1.49      +2 -1      httpd-2.0/include/ap_mmn.h
  
  Index: ap_mmn.h
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/include/ap_mmn.h,v
  retrieving revision 1.48
  retrieving revision 1.49
  diff -u -r1.48 -r1.49
  --- ap_mmn.h	2 Jun 2002 22:29:16 -0000	1.48
  +++ ap_mmn.h	12 Jun 2002 23:59:29 -0000	1.49
  @@ -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 */
   
  
  
  
  1.185     +4 -4      httpd-2.0/include/httpd.h
  
  Index: httpd.h
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/include/httpd.h,v
  retrieving revision 1.184
  retrieving revision 1.185
  diff -u -r1.184 -r1.185
  --- httpd.h	30 May 2002 07:04:45 -0000	1.184
  +++ httpd.h	12 Jun 2002 23:59:29 -0000	1.185
  @@ -1078,10 +1078,10 @@
   
       /** 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? */
  
  
  
  1.29      +2 -2      httpd-2.0/modules/experimental/mod_ext_filter.c
  
  Index: mod_ext_filter.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/experimental/mod_ext_filter.c,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- mod_ext_filter.c	17 May 2002 11:33:09 -0000	1.28
  +++ mod_ext_filter.c	12 Jun 2002 23:59:30 -0000	1.29
  @@ -604,7 +604,7 @@
                   
                   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 @@
            * 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)");
  
  
  
  1.142     +3 -8      httpd-2.0/modules/generators/mod_cgi.c
  
  Index: mod_cgi.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/generators/mod_cgi.c,v
  retrieving revision 1.141
  retrieving revision 1.142
  diff -u -r1.141 -r1.142
  --- mod_cgi.c	6 Jun 2002 00:16:59 -0000	1.141
  +++ mod_cgi.c	12 Jun 2002 23:59:30 -0000	1.142
  @@ -490,23 +490,18 @@
               *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);
               }
           }
       }
  
  
  
  1.48      +2 -1      httpd-2.0/modules/generators/mod_info.c
  
  Index: mod_info.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/generators/mod_info.c,v
  retrieving revision 1.47
  retrieving revision 1.48
  diff -u -r1.47 -r1.48
  --- mod_info.c	7 May 2002 23:41:36 -0000	1.47
  +++ mod_info.c	12 Jun 2002 23:59:30 -0000	1.48
  @@ -395,7 +395,8 @@
               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);
  
  
  
  1.303     +1 -1      httpd-2.0/modules/http/http_core.c
  
  Index: http_core.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/http/http_core.c,v
  retrieving revision 1.302
  retrieving revision 1.303
  diff -u -r1.302 -r1.303
  --- http_core.c	5 Apr 2002 20:55:00 -0000	1.302
  +++ http_core.c	12 Jun 2002 23:59:30 -0000	1.303
  @@ -91,7 +91,7 @@
           return err;
       }
   
  -    cmd->server->keep_alive_timeout = atoi(arg);
  +    cmd->server->keep_alive_timeout = apr_time_from_sec(atoi(arg));
       return NULL;
   }
   
  
  
  
  1.435     +5 -5      httpd-2.0/modules/http/http_protocol.c
  
  Index: http_protocol.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/http/http_protocol.c,v
  retrieving revision 1.434
  retrieving revision 1.435
  diff -u -r1.434 -r1.435
  --- http_protocol.c	8 Jun 2002 04:36:05 -0000	1.434
  +++ http_protocol.c	12 Jun 2002 23:59:30 -0000	1.435
  @@ -254,14 +254,14 @@
           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");
           }
  
  
  
  1.85      +1 -1      httpd-2.0/modules/proxy/mod_proxy.c
  
  Index: mod_proxy.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/proxy/mod_proxy.c,v
  retrieving revision 1.84
  retrieving revision 1.85
  diff -u -r1.84 -r1.85
  --- mod_proxy.c	30 May 2002 07:33:59 -0000	1.84
  +++ mod_proxy.c	12 Jun 2002 23:59:30 -0000	1.85
  @@ -886,7 +886,7 @@
           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;    
   }
  
  
  
  1.121     +2 -5      httpd-2.0/modules/proxy/proxy_ftp.c
  
  Index: proxy_ftp.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/proxy/proxy_ftp.c,v
  retrieving revision 1.120
  retrieving revision 1.121
  diff -u -r1.120 -r1.121
  --- proxy_ftp.c	17 May 2002 11:24:16 -0000	1.120
  +++ proxy_ftp.c	12 Jun 2002 23:59:31 -0000	1.121
  @@ -968,14 +968,11 @@
   
       /* 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,
  
  
  
  1.92      +2 -4      httpd-2.0/modules/proxy/proxy_util.c
  
  Index: proxy_util.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/proxy/proxy_util.c,v
  retrieving revision 1.91
  retrieving revision 1.92
  diff -u -r1.91 -r1.92
  --- proxy_util.c	17 May 2002 11:24:16 -0000	1.91
  +++ proxy_util.c	12 Jun 2002 23:59:31 -0000	1.92
  @@ -1158,12 +1158,10 @@
   
           /* 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,
  
  
  
  1.152     +2 -2      httpd-2.0/server/config.c
  
  Index: config.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/config.c,v
  retrieving revision 1.151
  retrieving revision 1.152
  diff -u -r1.151 -r1.152
  --- config.c	20 May 2002 15:05:43 -0000	1.151
  +++ config.c	12 Jun 2002 23:59:31 -0000	1.152
  @@ -1726,8 +1726,8 @@
       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;
  
  
  
  1.183     +4 -4      httpd-2.0/server/core.c
  
  Index: core.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/core.c,v
  retrieving revision 1.182
  retrieving revision 1.183
  diff -u -r1.182 -r1.183
  --- core.c	31 May 2002 20:52:28 -0000	1.182
  +++ core.c	12 Jun 2002 23:59:31 -0000	1.183
  @@ -2041,7 +2041,7 @@
           return err;
       }
   
  -    cmd->server->timeout = atoi(arg);
  +    cmd->server->timeout = apr_time_from_sec(atoi(arg));
       return NULL;
   }
   
  @@ -3310,14 +3310,14 @@
           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));
               }
           }
       }