Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

moving the redirector code

allo24d15eb0e8f5
diff --git a/source/de/anomic/http/httpdProxyHandler.java b/source/de/anomic/http/httpdProxyHandler.java
index 3898e99ed..97f9281dd 100644
--- a/source/de/anomic/http/httpdProxyHandler.java
+++ b/source/de/anomic/http/httpdProxyHandler.java
@@ -330,26 +330,6 @@ public final class httpdProxyHandler extends httpdAbstractHandler implements htt
// using an ByteCount OutputStream to count the send bytes (needed for the logfile)
respond = new httpdByteCountOutputStream(respond,conProp.getProperty(httpHeader.CONNECTION_PROP_REQUESTLINE).length() + 2);
- String host = conProp.getProperty(httpHeader.CONNECTION_PROP_HOST);
- String path = conProp.getProperty(httpHeader.CONNECTION_PROP_PATH); // always starts with leading '/'
- String args = conProp.getProperty(httpHeader.CONNECTION_PROP_ARGS); // may be null if no args were given
- String ip = conProp.getProperty(httpHeader.CONNECTION_PROP_CLIENTIP); // the ip from the connecting peer
-
- int port, pos;
- if ((pos = host.indexOf(":")) < 0) {
- port = 80;
- } else {
- port = Integer.parseInt(host.substring(pos + 1));
- host = host.substring(0, pos);
- }
-
- String ext;
- if ((pos = path.lastIndexOf('.')) < 0) {
- ext = "";
- } else {
- ext = path.substring(pos + 1).toLowerCase();
- }
-
URL url = null;
try {
url = httpHeader.getRequestURL(conProp);
@@ -365,9 +345,6 @@ public final class httpdProxyHandler extends httpdAbstractHandler implements htt
conProp.setProperty(httpHeader.CONNECTION_PROP_PATH, url.getPath());
requestHeader.put(httpHeader.HOST, url.getHost()+":"+url.getPort());
requestHeader.put(httpHeader.CONNECTION_PROP_PATH, url.getPath());
- host=url.getHost();
- port=url.getPort();
- path=url.getPath();
}
} catch (MalformedURLException e) {
String errorMsg = "ERROR: internal error with url generation: host=" +
@@ -377,6 +354,27 @@ public final class httpdProxyHandler extends httpdAbstractHandler implements htt
return;
}
+ String host = conProp.getProperty(httpHeader.CONNECTION_PROP_HOST);
+ String path = conProp.getProperty(httpHeader.CONNECTION_PROP_PATH); // always starts with leading '/'
+ String args = conProp.getProperty(httpHeader.CONNECTION_PROP_ARGS); // may be null if no args were given
+ String ip = conProp.getProperty(httpHeader.CONNECTION_PROP_CLIENTIP); // the ip from the connecting peer
+
+ int port, pos;
+ if ((pos = host.indexOf(":")) < 0) {
+ port = 80;
+ } else {
+ port = Integer.parseInt(host.substring(pos + 1));
+ host = host.substring(0, pos);
+ }
+
+ String ext;
+ if ((pos = path.lastIndexOf('.')) < 0) {
+ ext = "";
+ } else {
+ ext = path.substring(pos + 1).toLowerCase();
+ }
+
+
// check the blacklist
// blacklist idea inspired by [AS]:
// respond a 404 for all AGIS ("all you get is shit") servers