From ca93835713b9070866b61b17ecb07175c4b99a8a Mon Sep 17 00:00:00 2001
From: Michael Peter Christen
Date: Sun, 10 Jun 2012 23:17:21 +0200
Subject: [PATCH 1/8] removed usage of deprecated methods
---
source/de/anomic/http/server/HTTPDFileHandler.java | 6 +++---
source/net/yacy/interaction/TripleStore.java | 8 ++++----
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/source/de/anomic/http/server/HTTPDFileHandler.java b/source/de/anomic/http/server/HTTPDFileHandler.java
index b643fc81f..c889b483d 100644
--- a/source/de/anomic/http/server/HTTPDFileHandler.java
+++ b/source/de/anomic/http/server/HTTPDFileHandler.java
@@ -1427,11 +1427,11 @@ public final class HTTPDFileHandler {
final String strARGS = (String) conProp.get("ARGS");
if(strARGS.startsWith("url=")) {
final String strUrl = strARGS.substring(4); // strip url=
-
+
try {
proxyurl = new URL(strUrl);
} catch (MalformedURLException e) {
- proxyurl = new URL (URLDecoder.decode(strUrl));
+ proxyurl = new URL (URLDecoder.decode(strUrl, UTF8.charset.name()));
}
}
@@ -1486,7 +1486,7 @@ public final class HTTPDFileHandler {
String directory = "";
if (proxyurl.getPath().lastIndexOf('/') > 0)
directory = proxyurl.getPath().substring(0, proxyurl.getPath().lastIndexOf('/'));
-
+
String location = "";
if (outgoingHeader.containsKey("Location")) {
diff --git a/source/net/yacy/interaction/TripleStore.java b/source/net/yacy/interaction/TripleStore.java
index b2791e774..f56d1845f 100644
--- a/source/net/yacy/interaction/TripleStore.java
+++ b/source/net/yacy/interaction/TripleStore.java
@@ -2,15 +2,16 @@
package net.yacy.interaction;
+import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
-import java.io.StringBufferInputStream;
import java.util.Iterator;
import java.util.Map.Entry;
import java.util.concurrent.ConcurrentHashMap;
+import net.yacy.cora.document.UTF8;
import net.yacy.kelondro.logging.Log;
import net.yacy.search.Switchboard;
@@ -32,7 +33,7 @@ public class TripleStore {
if (filename.endsWith(".nt")) LoadNTriples(filename);
else LoadRDF(filename);
}
-
+
public static void LoadRDF(String fileNameOrUri) throws IOException {
Model tmp = ModelFactory.createDefaultModel();
Log.logInfo("TRIPLESTORE", "Loading from " + fileNameOrUri);
@@ -67,8 +68,7 @@ public class TripleStore {
try {
- @SuppressWarnings("deprecation")
- InputStream in = new StringBufferInputStream(rdffile);
+ InputStream in = new ByteArrayInputStream(UTF8.getBytes(rdffile));
// read the RDF/XML file
tmp.read(in, null);
From 7a4dab6d1d88efdf704c55b1ece4d42e5a3b6434 Mon Sep 17 00:00:00 2001
From: cominch
Date: Sun, 10 Jun 2012 23:33:09 +0200
Subject: [PATCH 2/8] - removed unused variables - do not replace malformed or
invalid URLs in urlproxy
git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@7835
6c8d7289-2bf4-0310-a012-ef5d649a1542
Conflicts:
source/de/anomic/http/server/HTTPDFileHandler.java
---
htroot/Triple_p.java | 77 ++++++++----------
htroot/interaction/GetRDF.java | 79 +++++++++----------
htroot/interaction/PutRDF.java | 68 +++++++---------
htroot/interaction/Table.java | 49 ++++++------
htroot/interaction/Triple.java | 49 ++++++------
htroot/interaction/UploadSingleFile.java | 73 ++++++++---------
.../http/server/AugmentedHtmlStream.java | 53 +++++++------
.../anomic/http/server/HTTPDProxyHandler.java | 24 +++---
8 files changed, 219 insertions(+), 253 deletions(-)
diff --git a/htroot/Triple_p.java b/htroot/Triple_p.java
index c80126b2e..5295c34d0 100644
--- a/htroot/Triple_p.java
+++ b/htroot/Triple_p.java
@@ -2,46 +2,33 @@
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.net.MalformedURLException;
-import java.util.List;
import net.yacy.cora.protocol.RequestHeader;
import net.yacy.interaction.TripleStore;
import net.yacy.kelondro.data.meta.DigestURI;
import net.yacy.kelondro.logging.Log;
-import net.yacy.search.Switchboard;
-
-
-import de.anomic.http.server.HTTPDemon;
-import de.anomic.server.serverObjects;
-import de.anomic.server.serverSwitch;
import com.hp.hpl.jena.query.QueryExecution;
import com.hp.hpl.jena.query.QueryExecutionFactory;
-import com.hp.hpl.jena.query.QueryFactory ;
+import com.hp.hpl.jena.query.QueryFactory;
import com.hp.hpl.jena.query.QuerySolution;
import com.hp.hpl.jena.query.ResultSet;
import com.hp.hpl.jena.query.ResultSetFormatter;
-import com.hp.hpl.jena.sparql.algebra.Algebra ;
-import com.hp.hpl.jena.sparql.algebra.Op ;
-import com.hp.hpl.jena.sparql.engine.QueryIterator ;
-import com.hp.hpl.jena.sparql.engine.binding.Binding ;
-import com.hp.hpl.jena.rdf.model.*;
-import com.hp.hpl.jena.util.FileManager;
+import de.anomic.http.server.HTTPDemon;
+import de.anomic.server.serverObjects;
+import de.anomic.server.serverSwitch;
public class Triple_p {
public static serverObjects respond(final RequestHeader header,
final serverObjects post, final serverSwitch env) {
- final Switchboard sb = (Switchboard) env;
final serverObjects prop = new serverObjects();
- boolean hasRights = sb.verifyAuthentication(header);
-
prop.put("display", 1); // Fixed to 1
prop.putHTML("mode_output", "no query performed");
-
+
String q = "PREFIX lln: \n"+
"PREFIX rdf: \n"+
"PREFIX xsd: \n"+
@@ -52,21 +39,21 @@ public class Triple_p {
"}";
if (post != null) {
-
+
if (post.containsKey("submit")) {
//
System.out.println (post.get("submit"));
}
-
+
if (post.containsKey("rdffileslist")) {
String list = post.get("rdffileslist");
-
+
for (String s: list.split("\n")) {
String newurl = s;
try {
DigestURI d = new DigestURI (s);
-
+
if (d.getHost().endsWith(".yacy")) {
newurl = d.getProtocol()+"://"+HTTPDemon.getAlternativeResolver().resolve(d.getHost())+d.getPath();
System.out.println (newurl);
@@ -77,38 +64,38 @@ public class Triple_p {
} catch (IOException e) {
Log.logException(e);
}
- }
+ }
}
-
+
if (post.containsKey("rdffile")) {
TripleStore.Add(post.get("rdffile$file"));
}
-
+
if (post.containsKey("query")) {
// Create a new query
String queryString = post.get("query");
-
+
q = queryString;
-
+
int count = 0;
-
+
try {
-
+
com.hp.hpl.jena.query.Query query = QueryFactory.create(queryString);
-
+
// Execute the query and obtain results
QueryExecution qe = QueryExecutionFactory.create(query, TripleStore.model);
ResultSet resultSet = qe.execSelect();
-
+
ByteArrayOutputStream sos = new ByteArrayOutputStream();
-
+
ResultSetFormatter.outputAsRDF(sos, "", resultSet);
prop.putHTML("mode_rdfdump", sos.toString());
-
+
int scount = 0;
while (resultSet.hasNext()) {
QuerySolution s = resultSet.next();
@@ -117,34 +104,34 @@ public class Triple_p {
prop.put("entries_"+scount+"_o", s.getResource(null).getURI());
scount ++;
}
-
+
prop.putHTML("entries", ""+scount);
-
+
for (String s: resultSet.getResultVars()) {
-
+
prop.putHTML("mode_output_"+count+"_caption", s);
count ++;
}
-
-
+
+
} catch (Exception e) {
prop.putHTML("mode_rdfdump", "error");
}
-
-
-
+
+
+
prop.putHTML("mode_output", ""+count);
}
-
+
}
-
+
prop.putHTML("mode_query", q);
-
+
// return rewrite properties
return prop;
}
-
+
}
diff --git a/htroot/interaction/GetRDF.java b/htroot/interaction/GetRDF.java
index f9466d27f..c2ebf8049 100644
--- a/htroot/interaction/GetRDF.java
+++ b/htroot/interaction/GetRDF.java
@@ -1,6 +1,6 @@
package interaction;
-//ViewLog_p.java
+//ViewLog_p.java
//-----------------------
//part of the AnomicHTTPD caching proxy
//(C) by Michael Peter Christen; mc@yacy.net
@@ -30,75 +30,72 @@ package interaction;
//if the shell's current path is HTROOT
import java.io.ByteArrayOutputStream;
-import java.io.FileOutputStream;
+import java.io.UnsupportedEncodingException;
-import com.hp.hpl.jena.rdf.model.Model;
-
-import net.yacy.cora.protocol.HeaderFramework;
+import net.yacy.cora.document.UTF8;
import net.yacy.cora.protocol.RequestHeader;
import net.yacy.interaction.Interaction;
import net.yacy.interaction.TripleStore;
-import net.yacy.kelondro.logging.Log;
-import net.yacy.search.Switchboard;
-import de.anomic.data.UserDB;
+
+import com.hp.hpl.jena.rdf.model.Model;
+
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
public class GetRDF {
-
+
public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
-
- final Switchboard sb = (Switchboard) env;
-
+
final serverObjects prop = new serverObjects();
- String url = "";
- String s = "";
- String p = "";
- String o = "";
-
Boolean global = false;
-
+
if(post != null){
-
+
global = post.containsKey("global");
-
+
}
-
+
if (global) {
-
+
ByteArrayOutputStream fout;
-
-
+
+
fout = new ByteArrayOutputStream();
-
+
TripleStore.model.write(fout);
-
- prop.put("resultXML", fout.toString());
-
+
+ try {
+ prop.put("resultXML", fout.toString(UTF8.charset.name()));
+ } catch (UnsupportedEncodingException e) {
+ }
+
} else {
-
+
Model tmp = TripleStore.privatestorage.get(Interaction.GetLoggedOnUser(header));
-
+
if (tmp != null) {
-
- ByteArrayOutputStream fout;
- fout = new ByteArrayOutputStream();
+
+ ByteArrayOutputStream fout;
+ fout = new ByteArrayOutputStream();
tmp.write(fout);
-
- prop.put("resultXML", fout.toString());
-
+
+ try {
+ prop.put("resultXML", fout.toString(UTF8.charset.name()));
+ } catch (UnsupportedEncodingException e) {
+ }
+
} else {
-
+
prop.put("resultXML", "");
}
}
-
-
-
-
+
+
+
+
return prop;
}
}
diff --git a/htroot/interaction/PutRDF.java b/htroot/interaction/PutRDF.java
index d591f877e..3806ee4c6 100644
--- a/htroot/interaction/PutRDF.java
+++ b/htroot/interaction/PutRDF.java
@@ -1,6 +1,6 @@
package interaction;
-//ViewLog_p.java
+//ViewLog_p.java
//-----------------------
//part of the AnomicHTTPD caching proxy
//(C) by Michael Peter Christen; mc@yacy.net
@@ -30,75 +30,65 @@ package interaction;
//if the shell's current path is HTROOT
import java.io.ByteArrayOutputStream;
-import java.io.FileOutputStream;
-import com.hp.hpl.jena.rdf.model.Model;
-
-import net.yacy.cora.protocol.HeaderFramework;
import net.yacy.cora.protocol.RequestHeader;
import net.yacy.interaction.Interaction;
import net.yacy.interaction.TripleStore;
-import net.yacy.kelondro.logging.Log;
-import net.yacy.search.Switchboard;
-import de.anomic.data.UserDB;
+
+import com.hp.hpl.jena.rdf.model.Model;
+
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
public class PutRDF {
-
+
public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
-
- final Switchboard sb = (Switchboard) env;
-
+
+
final serverObjects prop = new serverObjects();
- String url = "";
- String s = "";
- String p = "";
- String o = "";
-
Boolean global = false;
-
+
if(post != null){
-
+
global = post.containsKey("global");
-
+
}
-
+
if (global) {
-
+
ByteArrayOutputStream fout;
-
-
+
+
fout = new ByteArrayOutputStream();
-
+
TripleStore.model.write(fout);
-
+
prop.put("resultXML", fout.toString());
-
+
} else {
-
+
Model tmp = TripleStore.privatestorage.get(Interaction.GetLoggedOnUser(header));
-
+
if (tmp != null) {
-
- ByteArrayOutputStream fout;
- fout = new ByteArrayOutputStream();
+
+ ByteArrayOutputStream fout;
+ fout = new ByteArrayOutputStream();
tmp.write(fout);
-
+
prop.put("resultXML", fout.toString());
-
+
} else {
-
+
prop.put("resultXML", "");
}
}
-
-
-
-
+
+
+
+
return prop;
}
}
diff --git a/htroot/interaction/Table.java b/htroot/interaction/Table.java
index e4ccecfab..b25c1ab4f 100644
--- a/htroot/interaction/Table.java
+++ b/htroot/interaction/Table.java
@@ -1,6 +1,6 @@
package interaction;
-//ViewLog_p.java
+//ViewLog_p.java
//-----------------------
//part of the AnomicHTTPD caching proxy
//(C) by Michael Peter Christen; mc@yacy.net
@@ -32,23 +32,22 @@ package interaction;
import net.yacy.cora.protocol.HeaderFramework;
import net.yacy.cora.protocol.RequestHeader;
import net.yacy.interaction.Interaction;
-import net.yacy.kelondro.logging.Log;
import net.yacy.search.Switchboard;
import de.anomic.data.UserDB;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
public class Table {
-
+
public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
-
+
final Switchboard sb = (Switchboard) env;
-
+
final serverObjects prop = new serverObjects();
-
+
UserDB.Entry entry=null;
-
-
+
+
//default values
prop.put("enabled_logged_in", "0");
@@ -71,7 +70,7 @@ public class Table {
}
}
}
-
+
//identified via userDB
if(entry != null){
prop.put("enabled_logged-in", "1");
@@ -97,48 +96,48 @@ public class Table {
}
String url = "";
- String s = "";
+ String s = "";
String p = "";
String o = "";
-
+
Boolean global = false;
-
+
if(post != null){
if(post.containsKey("url")){
url = post.get("url");
}
-
+
if(post.containsKey("s")){
s = post.get("s");
}
-
+
if(post.containsKey("p")){
p = post.get("p");
}
-
+
if(post.containsKey("o")){
o = post.get("o");
}
-
+
global = post.containsKey("global");
-
+
}
-
+
if (post.containsKey("load")) {
-
+
o = Interaction.GetTableentry(s, p, global ? "global" : username, "");
-
+
} else {
-
+
Interaction.Tableentry(s, p, o, global ? "global" : username, "");
- }
-
+ }
+
prop.put("result", o);
-
-
+
+
return prop;
}
}
diff --git a/htroot/interaction/Triple.java b/htroot/interaction/Triple.java
index fa1a3c2fb..407b76c34 100644
--- a/htroot/interaction/Triple.java
+++ b/htroot/interaction/Triple.java
@@ -1,6 +1,6 @@
package interaction;
-//ViewLog_p.java
+//ViewLog_p.java
//-----------------------
//part of the AnomicHTTPD caching proxy
//(C) by Michael Peter Christen; mc@yacy.net
@@ -32,23 +32,22 @@ package interaction;
import net.yacy.cora.protocol.HeaderFramework;
import net.yacy.cora.protocol.RequestHeader;
import net.yacy.interaction.Interaction;
-import net.yacy.kelondro.logging.Log;
import net.yacy.search.Switchboard;
import de.anomic.data.UserDB;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
public class Triple {
-
+
public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
-
+
final Switchboard sb = (Switchboard) env;
-
+
final serverObjects prop = new serverObjects();
-
+
UserDB.Entry entry=null;
-
-
+
+
//default values
prop.put("enabled_logged_in", "0");
@@ -71,7 +70,7 @@ public class Triple {
}
}
}
-
+
//identified via userDB
if(entry != null){
prop.put("enabled_logged-in", "1");
@@ -97,47 +96,47 @@ public class Triple {
}
String url = "";
- String s = "";
+ String s = "";
String p = "";
String o = "";
-
+
Boolean global = false;
-
+
if(post != null){
if(post.containsKey("url")){
url = post.get("url");
}
-
+
if(post.containsKey("s")){
s = post.get("s");
}
-
+
if(post.containsKey("p")){
p = post.get("p");
}
-
+
if(post.containsKey("o")){
o = post.get("o");
}
-
+
global = post.containsKey("global");
-
+
}
-
+
if (post.containsKey("load")) {
-
+
o = Interaction.TripleGet(s, p, global ? "" : username);
-
+
} else {
-
+
Interaction.Triple(url, s, p, o, global ? "" : username);
- }
-
+ }
+
prop.put("result", o);
-
-
+
+
return prop;
}
}
diff --git a/htroot/interaction/UploadSingleFile.java b/htroot/interaction/UploadSingleFile.java
index fe5a1f06b..995d43c6d 100644
--- a/htroot/interaction/UploadSingleFile.java
+++ b/htroot/interaction/UploadSingleFile.java
@@ -1,24 +1,17 @@
package interaction;
-import java.io.BufferedOutputStream;
-import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
-import java.io.OutputStreamWriter;
import net.yacy.yacy;
-import net.yacy.cora.document.UTF8;
import net.yacy.cora.protocol.RequestHeader;
-import net.yacy.document.content.SurrogateReader;
import net.yacy.interaction.Interaction;
import net.yacy.kelondro.logging.Log;
-import net.yacy.kelondro.order.Digest;
import net.yacy.search.Switchboard;
import de.anomic.data.UserDB;
-import de.anomic.data.UserDB.AccessRight;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
@@ -31,67 +24,67 @@ public class UploadSingleFile {
final serverObjects prop = new serverObjects();
-
-
+
+
if (post != null){
if (post.containsKey("uploadfile") && !post.get("uploadfile").isEmpty()) {
-
+
UserDB.Entry entry = sb.userDB.getEntry(Interaction.GetLoggedOnUser(header));
if (entry != null) {
-
+
if (entry.hasRight(UserDB.AccessRight.UPLOAD_RIGHT)) {
-
+
// the user has the upload right
-
+
}
-
+
}
-
+
String targetfilename = post.get("uploadfile", "target.file");
-
+
String targetfolder = "/upload/"+Interaction.GetLoggedOnUser(header);
-
+
if (post.containsKey("targetfilename")) {
targetfilename = post.get("targetfilename");
-
+
}
-
+
if (post.containsKey("targetfolder")) {
targetfolder = post.get("targetfolder");
-
+
if (!targetfolder.startsWith("/")) {
targetfolder = "/" + targetfolder;
}
-
+
}
-
+
File f = new File(yacy.dataHome_g, "DATA/HTDOCS"+targetfolder+"/");
-
+
yacy.mkdirsIfNeseccary (f);
-
+
f = new File(f, targetfilename);
-
+
Log.logInfo ("FILEUPLOAD", f.toString());
-
-
+
+
try {
-
+
ByteArrayInputStream stream = new ByteArrayInputStream(post
.get("uploadfile$file").getBytes());
-
-
+
+
if (stream != null) {
-
+
OutputStream out;
-
-
+
+
out = new FileOutputStream(f.toString());
-
-
+
+
byte[] buf = new byte[1024];
int len;
while ((len = stream.read(buf)) > 0) {
@@ -100,7 +93,7 @@ public class UploadSingleFile {
stream.close();
out.close();
}
-
+
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
@@ -108,8 +101,8 @@ public class UploadSingleFile {
// TODO Auto-generated catch block
e.printStackTrace();
}
-
-
+
+
}
}
@@ -117,9 +110,9 @@ public class UploadSingleFile {
// return rewrite properties
return prop;
}
-
-
+
+
}
diff --git a/source/de/anomic/http/server/AugmentedHtmlStream.java b/source/de/anomic/http/server/AugmentedHtmlStream.java
index 82d944e9c..884798b82 100644
--- a/source/de/anomic/http/server/AugmentedHtmlStream.java
+++ b/source/de/anomic/http/server/AugmentedHtmlStream.java
@@ -15,55 +15,56 @@ import net.yacy.kelondro.data.meta.DigestURI;
import net.yacy.search.Switchboard;
public class AugmentedHtmlStream extends FilterOutputStream {
- private Writer out;
- private ByteArrayOutputStream buffer;
- private Charset charset;
- private DigestURI url;
- private byte[] urlhash;
- private RequestHeader requestHeader;
+ private final Writer out;
+ private final ByteArrayOutputStream buffer;
+ private final Charset charset;
+ private final DigestURI url;
+ private final RequestHeader requestHeader;
- public AugmentedHtmlStream(OutputStream out, Charset charset, DigestURI url, byte[] urlhash, RequestHeader requestHeader) {
+ public AugmentedHtmlStream(OutputStream out, Charset charset, DigestURI url, RequestHeader requestHeader) {
super(out);
this.out = new BufferedWriter(new OutputStreamWriter(out, charset));
this.buffer = new ByteArrayOutputStream();
this.charset = charset;
this.url = url;
- this.urlhash = urlhash;
this.requestHeader = requestHeader;
}
-
- public void write(int b) throws IOException {
+
+ @Override
+ public void write(int b) throws IOException {
this.buffer.write(b);
}
-
- public void write(byte[] b, int off, int len) throws IOException {
+
+ @Override
+ public void write(byte[] b, int off, int len) throws IOException {
this.buffer.write(b, off, len);
}
-
- public void close() throws IOException {
- StringBuffer b = new StringBuffer(this.buffer.toString(charset.name()));
+
+ @Override
+ public void close() throws IOException {
+ StringBuffer b = new StringBuffer(this.buffer.toString(this.charset.name()));
b = process(b);
- out.write(b.toString());
- out.close();
+ this.out.write(b.toString());
+ this.out.close();
}
-
+
public StringBuffer process(StringBuffer data) {
-
+
if (Switchboard.getSwitchboard().getConfigBool("proxyAugmentation", false) == true) {
-
+
if (!this.url.toNormalform(false, true).contains("currentyacypeer/")) {
-
- return AugmentHtmlStream.process (data, charset, url, requestHeader);
-
+
+ return AugmentHtmlStream.process (data, this.charset, this.url, this.requestHeader);
+
} else {
return data;
}
-
- } else {
+
+ } else {
return data;
}
}
-
+
public static boolean supportsMime(String mime) {
// System.out.println("mime" +mime);
return mime.split(";")[0].equals("text/html");
diff --git a/source/de/anomic/http/server/HTTPDProxyHandler.java b/source/de/anomic/http/server/HTTPDProxyHandler.java
index c0bb0768d..ad901bdb0 100644
--- a/source/de/anomic/http/server/HTTPDProxyHandler.java
+++ b/source/de/anomic/http/server/HTTPDProxyHandler.java
@@ -467,8 +467,8 @@ public final class HTTPDProxyHandler {
port = sb.peers.myPort();
path = path.substring(16);
}
-
- // point virtual directory to my peer
+
+ // point virtual directory to my peer
if (path.startsWith("/currentyacypeer/")) {
host = sb.peers.myIP();
port = sb.peers.myPort();
@@ -492,7 +492,7 @@ public final class HTTPDProxyHandler {
final String connectHost = hostPart(host, port, yAddress);
final String getUrl = "http://"+ connectHost + remotePath;
-
+
requestHeader.remove(HeaderFramework.HOST);
final HTTPClient client = setupHttpClient(requestHeader, connectHost);
@@ -508,13 +508,13 @@ public final class HTTPDProxyHandler {
if (responseHeader.isEmpty()) {
throw new Exception(client.getHttpResponse().getStatusLine().toString());
}
-
+
if(AugmentedHtmlStream.supportsMime(responseHeader.mime())) {
// enable chunk encoding, because we don't know the length after annotating
responseHeader.remove(HeaderFramework.CONTENT_LENGTH);
responseHeader.put(HeaderFramework.TRANSFER_ENCODING, "chunked");
- }
+ }
ChunkedOutputStream chunkedOut = setTransferEncoding(conProp, responseHeader, client.getHttpResponse().getStatusLine().getStatusCode(), respond);
@@ -555,7 +555,7 @@ public final class HTTPDProxyHandler {
// chunked encoding disables somewhere, add it again
responseHeader.put(HeaderFramework.TRANSFER_ENCODING, "chunked");
}
-
+
// sending the respond header back to the client
if (chunkedOut != null) {
responseHeader.put(HeaderFramework.TRANSFER_ENCODING, "chunked");
@@ -584,10 +584,10 @@ public final class HTTPDProxyHandler {
final String storeError = response.shallStoreCacheForProxy();
final boolean storeHTCache = response.profile().storeHTCache();
final String supportError = TextParser.supports(response.url(), response.getMimeType());
-
+
if(AugmentedHtmlStream.supportsMime(responseHeader.mime())) {
- outStream = new AugmentedHtmlStream(outStream, responseHeader.getCharSet(), url, url.hash(), requestHeader);
- }
+ outStream = new AugmentedHtmlStream(outStream, responseHeader.getCharSet(), url, requestHeader);
+ }
if (
/*
* Now we store the response into the htcache directory if
@@ -655,7 +655,7 @@ public final class HTTPDProxyHandler {
conProp.put(HeaderFramework.CONNECTION_PROP_PROXY_RESPOND_CODE,"TCP_MISS");
}
-
+
outStream.close();
if (chunkedOut != null) {
@@ -745,9 +745,9 @@ public final class HTTPDProxyHandler {
//respondHeader(respond, "203 OK", cachedResponseHeader); // respond with 'non-authoritative'
if(AugmentedHtmlStream.supportsMime(cachedResponseHeader.mime())) {
- respond = new AugmentedHtmlStream(respond, cachedResponseHeader.getCharSet(), url, url.hash(), requestHeader);
+ respond = new AugmentedHtmlStream(respond, cachedResponseHeader.getCharSet(), url, requestHeader);
}
-
+
// send also the complete body now from the cache
// simply read the file and transfer to out socket
FileUtils.copy(cacheEntry, respond);
From af5a597e47cdec9d5d8061b47f12508acb67df85 Mon Sep 17 00:00:00 2001
From: Roland 'Quix0r' Haeder
Date: Sun, 10 Jun 2012 23:38:41 +0200
Subject: [PATCH 3/8] Scroogle is not comming back, remove dead code
Conflicts:
source/net/yacy/search/Switchboard.java
---
defaults/yacy.init | 1 -
htroot/ConfigHeuristics_p.html | 16 +------
htroot/ConfigHeuristics_p.java | 3 --
htroot/ConfigNetwork_p.java | 1 -
source/net/yacy/search/Switchboard.java | 59 ++-----------------------
5 files changed, 4 insertions(+), 76 deletions(-)
diff --git a/defaults/yacy.init b/defaults/yacy.init
index 309531a50..9d8ceda59 100644
--- a/defaults/yacy.init
+++ b/defaults/yacy.init
@@ -1011,7 +1011,6 @@ about.body =
# search heuristics
heuristic.site = false
-heuristic.scroogle = false
heuristic.blekko = false
# colours for generic design
diff --git a/htroot/ConfigHeuristics_p.html b/htroot/ConfigHeuristics_p.html
index 91cc76746..0778c9396 100644
--- a/htroot/ConfigHeuristics_p.html
+++ b/htroot/ConfigHeuristics_p.html
@@ -43,20 +43,6 @@
-