You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by rp...@apache.org on 2008/10/22 12:23:52 UTC
svn commit: r707022 - in /httpd/httpd/trunk: CHANGES include/ap_mmn.h
include/httpd.h modules/proxy/mod_proxy.c server/util.c
Author: rpluem
Date: Wed Oct 22 03:23:52 2008
New Revision: 707022
URL: http://svn.apache.org/viewvc?rev=707022&view=rev
Log:
* Move ap_timeout_parameter_parse from mod_proxy.c to server/util.c and thus
make it part of the public API.
Modified:
httpd/httpd/trunk/CHANGES
httpd/httpd/trunk/include/ap_mmn.h
httpd/httpd/trunk/include/httpd.h
httpd/httpd/trunk/modules/proxy/mod_proxy.c
httpd/httpd/trunk/server/util.c
Modified: httpd/httpd/trunk/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/CHANGES?rev=707022&r1=707021&r2=707022&view=diff
==============================================================================
--- httpd/httpd/trunk/CHANGES [utf-8] (original)
+++ httpd/httpd/trunk/CHANGES [utf-8] Wed Oct 22 03:23:52 2008
@@ -2,6 +2,8 @@
Changes with Apache 2.3.0
[ When backported to 2.2.x, remove entry from this file ]
+ *) core: Add ap_timeout_parameter_parse to public API. [Ruediger Pluem]
+
*) mod_proxy: Prevent segmentation faults by correctly flushing all buckets
from the proxy backend. PR 45792 [Ruediger Pluem]
Modified: httpd/httpd/trunk/include/ap_mmn.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/include/ap_mmn.h?rev=707022&r1=707021&r2=707022&view=diff
==============================================================================
--- httpd/httpd/trunk/include/ap_mmn.h (original)
+++ httpd/httpd/trunk/include/ap_mmn.h Wed Oct 22 03:23:52 2008
@@ -170,6 +170,7 @@
* 20080830.0 (2.3.0-dev) Cookies can be set on headers_out and err_headers_out
* 20080920.0 (2.3.0-dev) Add ap_mpm_register_timed_callback.
* 20080920.1 (2.3.0-dev) Export mod_rewrite.h in the public API.
+ * 20080920.2 (2.3.0-dev) Added ap_timeout_parameter_parse to util.c / httpd.h
*
*/
@@ -178,7 +179,7 @@
#ifndef MODULE_MAGIC_NUMBER_MAJOR
#define MODULE_MAGIC_NUMBER_MAJOR 20080920
#endif
-#define MODULE_MAGIC_NUMBER_MINOR 1 /* 0...n */
+#define MODULE_MAGIC_NUMBER_MINOR 2 /* 0...n */
/**
* Determine if the server's current MODULE_MAGIC_NUMBER is at least a
Modified: httpd/httpd/trunk/include/httpd.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/include/httpd.h?rev=707022&r1=707021&r2=707022&view=diff
==============================================================================
--- httpd/httpd/trunk/include/httpd.h (original)
+++ httpd/httpd/trunk/include/httpd.h Wed Oct 22 03:23:52 2008
@@ -1746,6 +1746,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/trunk/modules/proxy/mod_proxy.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/mod_proxy.c?rev=707022&r1=707021&r2=707022&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/proxy/mod_proxy.c (original)
+++ httpd/httpd/trunk/modules/proxy/mod_proxy.c Wed Oct 22 03:23:52 2008
@@ -41,76 +41,6 @@
return sizeof(proxy_worker_stat);
}
-/**
- * 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.
- */
-/*
- * XXX: Once this function has its final status parameter wise it makes sense
- * to move it to some of the util??? files under server/ as public API.
- */
-static 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;
-}
-
/*
* A Web proxy module. Stages:
*
Modified: httpd/httpd/trunk/server/util.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/util.c?rev=707022&r1=707021&r2=707022&view=diff
==============================================================================
--- httpd/httpd/trunk/server/util.c (original)
+++ httpd/httpd/trunk/server/util.c Wed Oct 22 03:23:52 2008
@@ -2152,3 +2152,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;
+}
+