From 787c36869689b126b553f68cbaafd2f215fa4413 Mon Sep 17 00:00:00 2001
From: allo <allo@6c8d7289-2bf4-0310-a012-ef5d649a1542>
Date: Wed, 23 Nov 2005 07:37:15 +0000
Subject: [PATCH] synchronized redirectors and using the port.

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@1122 6c8d7289-2bf4-0310-a012-ef5d649a1542
---
 htroot/Blacklist_p.html                      |  8 +++++--
 htroot/Blacklist_p.java                      | 23 ++++++++++++++------
 source/de/anomic/http/httpdProxyHandler.java | 12 +++++-----
 3 files changed, 29 insertions(+), 14 deletions(-)

diff --git a/htroot/Blacklist_p.html b/htroot/Blacklist_p.html
index 3a78a2689..77b900f84 100644
--- a/htroot/Blacklist_p.html
+++ b/htroot/Blacklist_p.html
@@ -35,9 +35,13 @@ New list:
 <input type="submit" name="newlistbutton" value="create">
 </td>
 <td valign="top" align="right">
-<input type="submit" name="activatelistbutton" value="Enable/disable this list"><br>
+<!--<input type="submit" name="activatelistbutton" value="Enable/disable this list"><br>
 <input type="submit" name="sharelistbutton" value="Share/don't share this list"><br>
-<input type="submit" name="dellistbutton" value="Delete this list"><br>
+<input type="submit" name="dellistbutton" value="Delete this list"><br>-->
+<input type="checkbox" name="proxylist" value="on" />active<br />
+<input type="checkbox" name="sharedlist" value="on" />shared<br />
+<input type="submit" name="changebutton" value="Change"><br />
+<input type="submit" name="dellistbutton" value="Delete this list"><br />
 </td>
 </tr>
 </table>
diff --git a/htroot/Blacklist_p.java b/htroot/Blacklist_p.java
index 8507d4922..e380d446e 100644
--- a/htroot/Blacklist_p.java
+++ b/htroot/Blacklist_p.java
@@ -128,13 +128,22 @@ public class Blacklist_p {
                 } catch (IOException e) {}
 
 
-            } else if (post.containsKey("activatelistbutton")) {
-                if( listManager.ListInListslist(BLACKLIST_ACTIVE, filename) ){ 
-                    listManager.removeListFromListslist(BLACKLIST_ACTIVE, filename);
-                } else { // inactive list -> enable
-                    listManager.addListToListslist(BLACKLIST_ACTIVE, filename);
-                }
-                listManager.reloadBlacklists();
+            } else if (post.containsKey("changebutton")) {
+                if (post.containsKey("proxylist")){
+                    if( !(post.get("proxylist").equals("on")) && listManager.ListInListslist(BLACKLIST_ACTIVE, filename) ){ 
+                        listManager.removeListFromListslist(BLACKLIST_ACTIVE, filename);
+                    } else if ( post.get("proxylist").equals("on") && !(listManager.ListInListslist(BLACKLIST_ACTIVE, filename)) ) { // inactive list -> enable
+                        listManager.addListToListslist(BLACKLIST_ACTIVE, filename);
+                    }
+				}
+                if (post.containsKey("sharedlist")){
+                    if( !(post.get("sharedlist").equals("on")) && listManager.ListInListslist(BLACKLIST_SHARED, filename) ){ 
+                        listManager.removeListFromListslist(BLACKLIST_SHARED, filename);
+                    } else if ( post.get("sharedlist").equals("on") && !(listManager.ListInListslist(BLACKLIST_SHARED, filename)) ) { // inSHARED list -> enable
+                        listManager.addListToListslist(BLACKLIST_SHARED, filename);
+                    }
+				}
+                    listManager.reloadBlacklists();
 
             } else if (post.containsKey("sharelistbutton")) {
                 if (listManager.ListInListslist(BLACKLIST_SHARED, filename)) { 
diff --git a/source/de/anomic/http/httpdProxyHandler.java b/source/de/anomic/http/httpdProxyHandler.java
index 2f0b23d5d..3898e99ed 100644
--- a/source/de/anomic/http/httpdProxyHandler.java
+++ b/source/de/anomic/http/httpdProxyHandler.java
@@ -355,16 +355,18 @@ public final class httpdProxyHandler extends httpdAbstractHandler implements htt
                 url = httpHeader.getRequestURL(conProp);
                 //redirector
                 if (redirectorEnabled){
-                    redirectorWriter.println(url.toString());
-                    redirectorWriter.flush();
+                    synchronized(redirectorProcess){
+                        redirectorWriter.println(url.toString());
+                        redirectorWriter.flush();
+                    }
                     String newUrl=redirectorReader.readLine();
                     url=new URL(newUrl);
-                    conProp.setProperty(httpHeader.CONNECTION_PROP_HOST, url.getHost());
+                    conProp.setProperty(httpHeader.CONNECTION_PROP_HOST, url.getHost()+":"+url.getPort());
                     conProp.setProperty(httpHeader.CONNECTION_PROP_PATH, url.getPath());
-                    requestHeader.put(httpHeader.HOST, url.getHost());
+                    requestHeader.put(httpHeader.HOST, url.getHost()+":"+url.getPort());
                     requestHeader.put(httpHeader.CONNECTION_PROP_PATH, url.getPath());
                     host=url.getHost();
-                    port=url.getPort();//TODO:this does not work.
+                    port=url.getPort();
                     path=url.getPath();
                 }
             } catch (MalformedURLException e) {