Avoid host reuse if proxy changes
[pazpar2-moved-to-github.git] / src / host.c
index 57c6eb6..7af0c07 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of Pazpar2.
-   Copyright (C) 2006-2011 Index Data
+   Copyright (C) 2006-2012 Index Data
 
 Pazpar2 is free software; you can redistribute it and/or modify it under
 the terms of the GNU General Public License as published by the Free
@@ -99,7 +99,12 @@ struct host *find_host(database_hosts_t hosts, const char *url,
     yaz_mutex_enter(hosts->mutex);
     for (p = hosts->hosts; p; p = p->next)
         if (!strcmp(p->url, url))
-            break;
+        {
+            if (p->proxy && proxy && !strcmp(p->proxy, proxy))
+                break;
+            if (!p->proxy && !proxy)
+                break;
+        }
     if (!p)
     {
         p = create_host(url, proxy, port, iochan_man);