]> granicus.if.org Git - apache/commitdiff
By using a consistent naming structure, we can persist
authorJim Jagielski <jim@apache.org>
Tue, 18 Sep 2012 18:02:31 +0000 (18:02 +0000)
committerJim Jagielski <jim@apache.org>
Tue, 18 Sep 2012 18:02:31 +0000 (18:02 +0000)
across stop/starts (assuming people don't change
such basics as scheme, hostname, etc...)

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1387287 13f79535-47bb-0310-9956-ffa450edef68

modules/proxy/mod_proxy.c

index 04f1a21cd85eb2fbb2e6bded5b756219e7b5b061..8c0cd7841299bb7115ef8ec19756581ebac4a1a6 100644 (file)
@@ -1142,12 +1142,16 @@ static void * create_proxy_config(apr_pool_t *p, server_rec *s)
     ps->forward = NULL;
     ps->reverse = NULL;
     ps->domain = NULL;
-#if 0
-    id = ap_proxy_hashfunc(apr_psprintf(p, "%pp-%" APR_TIME_T_FMT, ps, apr_time_now()), PROXY_HASHFUNC_DEFAULT);
-#else
-    id = ap_proxy_hashfunc(apr_psprintf(p, "%pp", s), PROXY_HASHFUNC_DEFAULT);
-#endif
-    ps->id = apr_psprintf(p, "s%x", id);
+    /* yeah, ugly, but we need this both unique but consistent */
+    id = ap_proxy_hashfunc(apr_psprintf(p, "%s.%s.%d.%s.%s.%s",
+                                        (s->server_scheme ? s->server_scheme : "????"),
+                                        (s->server_hostname ? s->server_hostname : "???"),
+                                        (int)s->port,
+                                        (s->server_admin ? s->server_admin : "??"),
+                                        (s->defn_name ? s->defn_name : "?"),
+                                        (s->error_fname ? s->error_fname : DEFAULT_ERRORLOG))
+                           , PROXY_HASHFUNC_DEFAULT);
+    ps->id = apr_psprintf(p, "p%x", id);
     ps->viaopt = via_off; /* initially backward compatible with 1.3.1 */
     ps->viaopt_set = 0; /* 0 means default */
     ps->req = 0;