aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Paul Querna 2004-12-12 21:28:26 +0000
committerGravatar Paul Querna 2004-12-12 21:28:26 +0000
commit95ca7c04e1fafa455b2a66dffae8383de934253c (patch)
treed0e7e2e774f112e7777e316117997733de688f1e
parenta66e1478c77fc8c8a7ab831916ab3d1c3aacb539 (diff)
use apr to parse hostnames..
-rw-r--r--src/gnutls_cache.c26
1 files changed, 17 insertions, 9 deletions
diff --git a/src/gnutls_cache.c b/src/gnutls_cache.c
index bc13440..cee30fa 100644
--- a/src/gnutls_cache.c
+++ b/src/gnutls_cache.c
@@ -59,18 +59,26 @@ int mod_gnutls_cache_child_init(apr_pool_t *p, server_rec *s,
59 split = apr_strtok(cache_config, " ", &tok); 59 split = apr_strtok(cache_config, " ", &tok);
60 while (split) { 60 while (split) {
61 apr_memcache_server_t* st; 61 apr_memcache_server_t* st;
62 char* split2;
63 char* host_str; 62 char* host_str;
64 char* port_str; 63 char* scope_id;
65 int port; 64 apr_port_t port;
66 65
67 host_str = apr_strtok(split,":", &split2); 66 rv = apr_parse_addr_port(&host_str, &scope_id, &port, split, p);
68 port_str = apr_strtok(NULL,":", &split2); 67 if(rv != APR_SUCCESS) {
69 if (!port_str) { 68 ap_log_error(APLOG_MARK, APLOG_CRIT, rv, s,
70 port = 11211; /* default port */ 69 "[gnutls_cache] Failed to Parse Server: '%s'", split);
70 return rv;
71 }
72
73 if(host_str == NULL) {
74 ap_log_error(APLOG_MARK, APLOG_CRIT, rv, s,
75 "[gnutls_cache] Failed to Parse Server, "
76 "no hostname specified: '%s'", split);
77 return rv;
71 } 78 }
72 else { 79
73 port = atoi(port_str); 80 if (port == 0) {
81 port = 11211; /* default port */
74 } 82 }
75 83
76 /* Should Max Conns be (thread_limit / nservers) ? */ 84 /* Should Max Conns be (thread_limit / nservers) ? */