Return-Path: Delivered-To: apmail-httpd-cvs-archive@www.apache.org Received: (qmail 1083 invoked from network); 11 Nov 2008 20:02:55 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 11 Nov 2008 20:02:55 -0000 Received: (qmail 82161 invoked by uid 500); 11 Nov 2008 20:03:02 -0000 Delivered-To: apmail-httpd-cvs-archive@httpd.apache.org Received: (qmail 82096 invoked by uid 500); 11 Nov 2008 20:03:02 -0000 Mailing-List: contact cvs-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@httpd.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list cvs@httpd.apache.org Received: (qmail 82087 invoked by uid 99); 11 Nov 2008 20:03:01 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 11 Nov 2008 12:03:01 -0800 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 11 Nov 2008 20:01:50 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 96CE6238889D; Tue, 11 Nov 2008 12:02:03 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r713145 - in /httpd/httpd/branches/2.2.x: CHANGES STATUS docs/manual/mod/mod_proxy.xml include/ap_mmn.h include/httpd.h modules/proxy/mod_proxy.c server/util.c Date: Tue, 11 Nov 2008 20:02:01 -0000 To: cvs@httpd.apache.org From: jim@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20081111200203.96CE6238889D@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: jim Date: Tue Nov 11 12:01:59 2008 New Revision: 713145 URL: http://svn.apache.org/viewvc?rev=713145&view=rev Log: * mod_proxy: Add the possibility to set the worker parameters connectiontimeout and ping in milliseconds. Trunk version of patch: http://svn.apache.org/viewvc?rev=705005&view=rev http://svn.apache.org/viewvc?rev=707022&view=rev Backport version for 2.2.x of patch: http://people.apache.org/~rpluem/patches/milli_seconds.diff +1: rpluem, pgollucci, jim Modified: httpd/httpd/branches/2.2.x/CHANGES httpd/httpd/branches/2.2.x/STATUS httpd/httpd/branches/2.2.x/docs/manual/mod/mod_proxy.xml httpd/httpd/branches/2.2.x/include/ap_mmn.h httpd/httpd/branches/2.2.x/include/httpd.h httpd/httpd/branches/2.2.x/modules/proxy/mod_proxy.c httpd/httpd/branches/2.2.x/server/util.c Modified: httpd/httpd/branches/2.2.x/CHANGES URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/CHANGES?rev=713145&r1=713144&r2=713145&view=diff ============================================================================== --- httpd/httpd/branches/2.2.x/CHANGES [utf-8] (original) +++ httpd/httpd/branches/2.2.x/CHANGES [utf-8] Tue Nov 11 12:01:59 2008 @@ -9,6 +9,11 @@ send the empty body packet, so container can deal with that. [Mladen Turk] + *) core: Add ap_timeout_parameter_parse to public API. [Ruediger Pluem] + + *) mod_proxy: Add the possibility to set the worker parameters + connectiontimeout and ping in milliseconds. [Ruediger Pluem] + *) Worker MPM: Crosscheck that idle workers are still available before using them and thus preventing an overflow of the worker queue which causes a SegFault. PR 45605 [Denis Ustimenko ] Modified: httpd/httpd/branches/2.2.x/STATUS URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/STATUS?rev=713145&r1=713144&r2=713145&view=diff ============================================================================== --- httpd/httpd/branches/2.2.x/STATUS (original) +++ httpd/httpd/branches/2.2.x/STATUS Tue Nov 11 12:01:59 2008 @@ -96,15 +96,6 @@ http://people.apache.org/~rpluem/patches/proxy_alloc_lifetime_rework_2.2.x.diff +1: rpluem, pgollucci, jim - * mod_proxy: Add the possibility to set the worker parameters - connectiontimeout and ping in milliseconds. - Trunk version of patch: - http://svn.apache.org/viewvc?rev=705005&view=rev - http://svn.apache.org/viewvc?rev=707022&view=rev - Backport version for 2.2.x of patch: - http://people.apache.org/~rpluem/patches/milli_seconds.diff - +1: rpluem, pgollucci, jim - PATCHES PROPOSED TO BACKPORT FROM TRUNK: [ New proposals should be added at the end of the list ] Modified: httpd/httpd/branches/2.2.x/docs/manual/mod/mod_proxy.xml URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/docs/manual/mod/mod_proxy.xml?rev=713145&r1=713144&r2=713145&view=diff ============================================================================== --- httpd/httpd/branches/2.2.x/docs/manual/mod/mod_proxy.xml (original) +++ httpd/httpd/branches/2.2.x/docs/manual/mod/mod_proxy.xml Tue Nov 11 12:01:59 2008 @@ -693,7 +693,8 @@ timeout Connect timeout in seconds. The number of seconds Apache waits for the creation of a connection to - the backend to complete. + the backend to complete. By adding a postfix of ms the timeout can be + also set in milliseconds. disablereuse Off @@ -748,6 +749,8 @@ which could be an issue, but it will lower the traffic in case some of the cluster nodes are down or busy. Currently this has an effect only for AJP. + By adding a postfix of ms the delay can be also set in + milliseconds. loadfactor 1 Modified: httpd/httpd/branches/2.2.x/include/ap_mmn.h URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/include/ap_mmn.h?rev=713145&r1=713144&r2=713145&view=diff ============================================================================== --- httpd/httpd/branches/2.2.x/include/ap_mmn.h (original) +++ httpd/httpd/branches/2.2.x/include/ap_mmn.h Tue Nov 11 12:01:59 2008 @@ -132,6 +132,7 @@ * proxy_worker struct. * 20051115.17 (2.2.10) Add scolonsep to proxy_balancer * 20051115.18 (2.2.10) Add chroot support to unixd_config + * 20051115.19 (2.2.11) Added ap_timeout_parameter_parse to util.c / httpd.h */ #define MODULE_MAGIC_COOKIE 0x41503232UL /* "AP22" */ @@ -139,7 +140,7 @@ #ifndef MODULE_MAGIC_NUMBER_MAJOR #define MODULE_MAGIC_NUMBER_MAJOR 20051115 #endif -#define MODULE_MAGIC_NUMBER_MINOR 18 /* 0...n */ +#define MODULE_MAGIC_NUMBER_MINOR 19 /* 0...n */ /** * Determine if the server's current MODULE_MAGIC_NUMBER is at least a Modified: httpd/httpd/branches/2.2.x/include/httpd.h URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/include/httpd.h?rev=713145&r1=713144&r2=713145&view=diff ============================================================================== --- httpd/httpd/branches/2.2.x/include/httpd.h (original) +++ httpd/httpd/branches/2.2.x/include/httpd.h Tue Nov 11 12:01:59 2008 @@ -1734,6 +1734,29 @@ AP_DECLARE(char *) ap_append_pid(apr_pool_t *p, const char *string, const char *delim); +/** + * Parse a given timeout parameter string into an apr_interval_time_t value. + * The unit of the time interval is given as postfix string to the numeric + * string. Currently the following units are understood: + * + * ms : milliseconds + * s : seconds + * mi[n] : minutes + * h : hours + * + * If no unit is contained in the given timeout parameter the default_time_unit + * will be used instead. + * @param timeout_parameter The string containing the timeout parameter. + * @param timeout The timeout value to be returned. + * @param default_time_unit The default time unit to use if none is specified + * in timeout_parameter. + * @return Status value indicating whether the parsing was successful or not. + */ +AP_DECLARE(apr_status_t) ap_timeout_parameter_parse( + const char *timeout_parameter, + apr_interval_time_t *timeout, + const char *default_time_unit); + /* Misc system hackery */ /** * Given the name of an object in the file system determine if it is a directory Modified: httpd/httpd/branches/2.2.x/modules/proxy/mod_proxy.c URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/modules/proxy/mod_proxy.c?rev=713145&r1=713144&r2=713145&view=diff ============================================================================== --- httpd/httpd/branches/2.2.x/modules/proxy/mod_proxy.c (original) +++ httpd/httpd/branches/2.2.x/modules/proxy/mod_proxy.c Tue Nov 11 12:01:59 2008 @@ -71,6 +71,8 @@ { int ival; + apr_interval_time_t timeout; + if (!strcasecmp(key, "loadfactor")) { /* Normalized load factor. Used with BalancerMamber, * it is a number between 1 and 100. @@ -126,14 +128,15 @@ worker->smax = ival; } else if (!strcasecmp(key, "acquire")) { - /* Acquire timeout in milliseconds. + /* Acquire in given unit (default is milliseconds). * If set this will be the maximum time to * wait for a free connection. */ - ival = atoi(val); - if (ival < 1) - return "Acquire must be at least one mili second"; - worker->acquire = apr_time_make(0, ival * 1000); + if (ap_timeout_parameter_parse(val, &timeout, "ms") != APR_SUCCESS) + return "Acquire timeout has wrong format"; + if (timeout < 1000) + return "Acquire must be at least one millisecond"; + worker->acquire = timeout; worker->acquire_set = 1; } else if (!strcasecmp(key, "timeout")) { @@ -267,22 +270,24 @@ worker->lbset = ival; } else if (!strcasecmp(key, "ping")) { - /* Ping/Pong timeout in seconds. + /* Ping/Pong timeout in given unit (default is second). */ - ival = atoi(val); - if (ival < 1) - return "Ping/Pong timeout must be at least one second"; - worker->ping_timeout = apr_time_from_sec(ival); + if (ap_timeout_parameter_parse(val, &timeout, "s") != APR_SUCCESS) + return "Ping/Pong timeout has wrong format"; + if (timeout < 1000) + return "Ping/Pong timeout must be at least one millisecond"; + worker->ping_timeout = timeout; worker->ping_timeout_set = 1; } else if (!strcasecmp(key, "connectiontimeout")) { - /* Request timeout in seconds. + /* Request timeout in given unit (default is second). * Defaults to connection timeout */ - ival = atoi(val); - if (ival < 1) - return "Connectiontimeout must be at least one second."; - worker->conn_timeout = apr_time_from_sec(ival); + if (ap_timeout_parameter_parse(val, &timeout, "s") != APR_SUCCESS) + return "Connectiontimeout has wrong format"; + if (timeout < 1000) + return "Connectiontimeout must be at least one millisecond."; + worker->conn_timeout = timeout; worker->conn_timeout_set = 1; } else { Modified: httpd/httpd/branches/2.2.x/server/util.c URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/server/util.c?rev=713145&r1=713144&r2=713145&view=diff ============================================================================== --- httpd/httpd/branches/2.2.x/server/util.c (original) +++ httpd/httpd/branches/2.2.x/server/util.c Tue Nov 11 12:01:59 2008 @@ -2146,3 +2146,71 @@ delim, getpid()); } + +/** + * Parse a given timeout parameter string into an apr_interval_time_t value. + * The unit of the time interval is given as postfix string to the numeric + * string. Currently the following units are understood: + * + * ms : milliseconds + * s : seconds + * mi[n] : minutes + * h : hours + * + * If no unit is contained in the given timeout parameter the default_time_unit + * will be used instead. + * @param timeout_parameter The string containing the timeout parameter. + * @param timeout The timeout value to be returned. + * @param default_time_unit The default time unit to use if none is specified + * in timeout_parameter. + * @return Status value indicating whether the parsing was successful or not. + */ +AP_DECLARE(apr_status_t) ap_timeout_parameter_parse( + const char *timeout_parameter, + apr_interval_time_t *timeout, + const char *default_time_unit) +{ + char *endp; + const char *time_str; + apr_int64_t tout; + + tout = apr_strtoi64(timeout_parameter, &endp, 10); + if (errno) { + return errno; + } + if (!endp || !*endp) { + time_str = default_time_unit; + } + else { + time_str = endp; + } + + switch (*time_str) { + /* Time is in seconds */ + case 's': + *timeout = (apr_interval_time_t) apr_time_from_sec(tout); + break; + case 'h': + /* Time is in hours */ + *timeout = (apr_interval_time_t) apr_time_from_sec(tout * 3600); + break; + case 'm': + switch (*(++time_str)) { + /* Time is in miliseconds */ + case 's': + *timeout = (apr_interval_time_t) tout * 1000; + break; + /* Time is in minutes */ + case 'i': + *timeout = (apr_interval_time_t) apr_time_from_sec(tout * 60); + break; + default: + return APR_EGENERAL; + } + break; + default: + return APR_EGENERAL; + } + return APR_SUCCESS; +} +