small cosmetic change for static fields in serverCore (special protocol ASCII entities) to improve readability

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@4275 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
fuchsi 17 years ago
parent 270d016d89
commit 21b8d1b918

@ -201,7 +201,7 @@ public final class hello {
final Map ySeeds = yacyCore.seedDB.seedsByAge(true, count); // peerhash/yacySeed relation
// attach also my own seed
seeds.append("seed0=").append(yacyCore.seedDB.mySeed().genSeedStr(key)).append(serverCore.crlfString);
seeds.append("seed0=").append(yacyCore.seedDB.mySeed().genSeedStr(key)).append(serverCore.CRLF_STRING);
count = 1;
// attach other seeds
@ -212,14 +212,14 @@ public final class hello {
while (si.hasNext()) {
s = (yacySeed) si.next();
if ((s != null) && (s.isProper() == null)) {
seeds.append("seed").append(count).append('=').append(s.genSeedStr(key)).append(serverCore.crlfString);
seeds.append("seed").append(count).append('=').append(s.genSeedStr(key)).append(serverCore.CRLF_STRING);
count++;
}
}
}
} else {
// attach also my own seed
seeds.append("seed0=").append(yacyCore.seedDB.mySeed().genSeedStr(key)).append(serverCore.crlfString);
seeds.append("seed0=").append(yacyCore.seedDB.mySeed().genSeedStr(key)).append(serverCore.CRLF_STRING);
}
prop.put("seedlist", seeds.toString());

@ -159,7 +159,7 @@ public final class search {
wordhash = (String) entry.getKey();
indexContainer container = (indexContainer) entry.getValue();
indexabstractContainercount += container.size();
indexabstract.append("indexabstract." + wordhash + "=").append(indexContainer.compressIndex(container, null, 1000).toString()).append(serverCore.crlfString);
indexabstract.append("indexabstract." + wordhash + "=").append(indexContainer.compressIndex(container, null, 1000).toString()).append(serverCore.CRLF_STRING);
}
}
@ -191,7 +191,7 @@ public final class search {
Iterator i = theSearch.IACount.entrySet().iterator();
while (i.hasNext()) {
entry = (Map.Entry) i.next();
indexcount.append("indexcount.").append((String) entry.getKey()).append('=').append(((Integer) entry.getValue()).toString()).append(serverCore.crlfString);
indexcount.append("indexcount.").append((String) entry.getKey()).append('=').append(((Integer) entry.getValue()).toString()).append(serverCore.CRLF_STRING);
}
if (abstractSet != null) {
// if a specific index-abstract is demanded, attach it here
@ -200,7 +200,7 @@ public final class search {
while (i.hasNext()) {
wordhash = (String) i.next();
indexabstractContainercount += ((Integer) theSearch.IACount.get(wordhash)).intValue();
indexabstract.append("indexabstract." + wordhash + "=").append((String) theSearch.IAResults.get(wordhash)).append(serverCore.crlfString);
indexabstract.append("indexabstract." + wordhash + "=").append((String) theSearch.IAResults.get(wordhash)).append(serverCore.CRLF_STRING);
}
}
prop.put("indexcount", indexcount.toString());
@ -222,11 +222,11 @@ public final class search {
} else if (abstracts.equals("auto")) {
// automatically attach the index abstract for the index that has the most references. This should be our target dht position
indexabstractContainercount += ((Integer) theSearch.IACount.get(theSearch.IAmaxcounthash)).intValue();
indexabstract.append("indexabstract." + theSearch.IAmaxcounthash + "=").append((String) theSearch.IAResults.get(theSearch.IAmaxcounthash)).append(serverCore.crlfString);
indexabstract.append("indexabstract." + theSearch.IAmaxcounthash + "=").append((String) theSearch.IAResults.get(theSearch.IAmaxcounthash)).append(serverCore.CRLF_STRING);
if ((theSearch.IAneardhthash != null) && (!(theSearch.IAneardhthash.equals(theSearch.IAmaxcounthash)))) {
// in case that the neardhthash is different from the maxcounthash attach also the neardhthash-container
indexabstractContainercount += ((Integer) theSearch.IACount.get(theSearch.IAneardhthash)).intValue();
indexabstract.append("indexabstract." + theSearch.IAneardhthash + "=").append((String) theSearch.IAResults.get(theSearch.IAneardhthash)).append(serverCore.crlfString);
indexabstract.append("indexabstract." + theSearch.IAneardhthash + "=").append((String) theSearch.IAResults.get(theSearch.IAneardhthash)).append(serverCore.CRLF_STRING);
}
//System.out.println("DEBUG-ABSTRACTGENERATION: maxcounthash = " + maxcounthash);
//System.out.println("DEBUG-ABSTRACTGENERATION: neardhthash = "+ neardhthash);
@ -266,7 +266,7 @@ public final class search {
entry = (plasmaSearchEvent.ResultEntry) accu.get(i);
resource = entry.resource();
if (resource != null) {
links.append("resource").append(i).append('=').append(resource).append(serverCore.crlfString);
links.append("resource").append(i).append('=').append(resource).append(serverCore.CRLF_STRING);
}
}
prop.put("links", links.toString());

@ -193,7 +193,7 @@ public class listManager {
for(int i=0;i < list.length; i++){
out
.append(list[i])
.append(serverCore.crlfString);
.append(serverCore.CRLF_STRING);
}
return writeList(listFile, new String(out)); //(File, String)
}
@ -223,9 +223,9 @@ public class listManager {
String line = "";
while ((line = br.readLine()) != null) {
if ((!line.startsWith("#") || withcomments) || !line.equals("")) {
//temp += line + serverCore.crlfString;
//temp += line + serverCore.CRLF_STRING;
temp.append(line)
.append(serverCore.crlfString);
.append(serverCore.CRLF_STRING);
}
}
br.close();

@ -151,7 +151,7 @@ public class translator {
try{
br = new BufferedReader(new InputStreamReader(new FileInputStream(sourceFile),"UTF-8"));
while( (line = br.readLine()) != null){
content += line + de.anomic.server.serverCore.crlfString;
content += line + de.anomic.server.serverCore.CRLF_STRING;
}
br.close();
}catch(IOException e){

@ -110,7 +110,7 @@ public class wikiCode extends abstractWikiParser implements wikiParser {
StringBuffer out = new StringBuffer(length);
String line;
while ((line = reader.readLine()) != null)
out.append(transformLine(line, publicAddress, switchboard)).append(serverCore.crlfString);
out.append(transformLine(line, publicAddress, switchboard)).append(serverCore.CRLF_STRING);
return out.insert(0, directory()).toString();
}
@ -246,7 +246,7 @@ public class wikiCode extends abstractWikiParser implements wikiParser {
if(result.startsWith(numListLevel + "#")){ //more #
p0 = result.indexOf(numListLevel);
p1 = result.length();
result = "<ol>" + serverCore.crlfString +
result = "<ol>" + serverCore.CRLF_STRING +
"<li>" +
result.substring(numListLevel.length() + 1, p1) +
"</li>";
@ -294,7 +294,7 @@ public class wikiCode extends abstractWikiParser implements wikiParser {
if(result.startsWith(ListLevel + "*")){ //more stars
p0 = result.indexOf(ListLevel);
p1 = result.length();
result = "<ul>" + serverCore.crlfString +
result = "<ul>" + serverCore.CRLF_STRING +
"<li>" +
result.substring(ListLevel.length() + 1, p1) +
"</li>";

@ -67,8 +67,8 @@ public final class httpChunkedOutputStream extends FilterOutputStream {
public void finish() throws IOException {
if (!this.finished) {
this.out.write((byte) 48);
this.out.write(serverCore.crlf);
this.out.write(serverCore.crlf);
this.out.write(serverCore.CRLF);
this.out.write(serverCore.CRLF);
this.out.flush();
this.finished = true;
}
@ -79,9 +79,9 @@ public final class httpChunkedOutputStream extends FilterOutputStream {
if (b.length == 0) return;
this.out.write(Integer.toHexString(b.length).getBytes());
this.out.write(serverCore.crlf);
this.out.write(serverCore.CRLF);
this.out.write(b);
this.out.write(serverCore.crlf);
this.out.write(serverCore.CRLF);
this.out.flush();
}
@ -90,9 +90,9 @@ public final class httpChunkedOutputStream extends FilterOutputStream {
if (len == 0) return;
this.out.write(Integer.toHexString(len).getBytes());
this.out.write(serverCore.crlf);
this.out.write(serverCore.CRLF);
this.out.write(b, off, len);
this.out.write(serverCore.crlf);
this.out.write(serverCore.CRLF);
this.out.flush();
}
@ -101,9 +101,9 @@ public final class httpChunkedOutputStream extends FilterOutputStream {
if (len == 0) return;
this.out.write(Integer.toHexString(len).getBytes());
this.out.write(serverCore.crlf);
this.out.write(serverCore.CRLF);
this.out.write(b.getBytes(off, len));
this.out.write(serverCore.crlf);
this.out.write(serverCore.CRLF);
this.out.flush();
}
@ -113,9 +113,9 @@ public final class httpChunkedOutputStream extends FilterOutputStream {
if (len == 0) return;
this.out.write(Integer.toHexString(len).getBytes());
this.out.write(serverCore.crlf);
this.out.write(serverCore.CRLF);
serverFileUtils.copy(b, out, len);
this.out.write(serverCore.crlf);
this.out.write(serverCore.CRLF);
this.out.flush();
}
@ -123,9 +123,9 @@ public final class httpChunkedOutputStream extends FilterOutputStream {
if (this.finished) throw new IOException("ChunkedOutputStream already finalized.");
this.out.write("1".getBytes());
this.out.write(serverCore.crlf);
this.out.write(serverCore.CRLF);
this.out.write(b);
this.out.write(serverCore.crlf);
this.out.write(serverCore.CRLF);
this.out.flush();
}
}

@ -462,7 +462,7 @@ public final class httpTemplate {
//Read the Include
String line = "";
while( (line = br.readLine()) != null ){
include.append(line.getBytes("UTF-8")).append(de.anomic.server.serverCore.crlfString.getBytes("UTF-8"));
include.append(line.getBytes("UTF-8")).append(de.anomic.server.serverCore.CRLF_STRING.getBytes("UTF-8"));
}
} catch (IOException e) {
//file not found?

@ -660,7 +660,7 @@ public final class httpc {
// send request
if ((this.remoteProxyUse) && (!(method.equals(httpHeader.METHOD_CONNECT))))
path = ((this.adressed_port == 443) ? "https://" : "http://") + this.adressed_host + ":" + this.adressed_port + path;
sb.append(method + " " + path + " HTTP/1.0" + serverCore.crlfString); // TODO if set to HTTP/1.1, servers give time-outs?
sb.append(method + " " + path + " HTTP/1.0" + serverCore.CRLF_STRING); // TODO if set to HTTP/1.1, servers give time-outs?
// send header
//System.out.println("***HEADER for path " + path + ": PROXY TO SERVER = " + header.toString()); // DEBUG
@ -674,14 +674,14 @@ public final class httpc {
if ((tag != '*') && (tag != '#')) {
count = header.keyCount(key);
for (int j = 0; j < count; j++) {
sb.append(key + ": " + ((String) header.getSingle(key, j)).trim() + serverCore.crlfString);
sb.append(key + ": " + ((String) header.getSingle(key, j)).trim() + serverCore.CRLF_STRING);
}
//System.out.println("#" + key + ": " + value);
}
}
// add terminating line
sb.append(serverCore.crlfString);
sb.append(serverCore.CRLF_STRING);
serverCore.send(this.clientOutput, sb.toString());
this.clientOutput.flush();
@ -849,29 +849,29 @@ public final class httpc {
while (e.hasMoreElements()) {
// start with a boundary
out.write(boundary.getBytes("UTF-8"));
out.write(serverCore.crlf);
out.write(serverCore.CRLF);
// write value
key = (String) e.nextElement();
value = args.get(key, "");
if ((files != null) && (files.containsKey(key))) {
// we are about to write a file
out.write(("Content-Disposition: form-data; name=" + '"' + key + '"' + "; filename=" + '"' + value + '"').getBytes("UTF-8"));
out.write(serverCore.crlf);
out.write(serverCore.crlf);
out.write(serverCore.CRLF);
out.write(serverCore.CRLF);
out.write((byte[]) files.get(key));
out.write(serverCore.crlf);
out.write(serverCore.CRLF);
} else {
// write a single value
out.write(("Content-Disposition: form-data; name=" + '"' + key + '"').getBytes("UTF-8"));
out.write(serverCore.crlf);
out.write(serverCore.crlf);
out.write(serverCore.CRLF);
out.write(serverCore.CRLF);
out.write(value.getBytes("UTF-8"));
out.write(serverCore.crlf);
out.write(serverCore.CRLF);
}
}
// finish with a boundary
out.write(boundary.getBytes("UTF-8"));
out.write(serverCore.crlf);
out.write(serverCore.CRLF);
}
// create body array
out.close();
@ -1293,7 +1293,8 @@ public final class httpc {
buffer = new String(b);
buffer=buffer.trim();
//System.out.println("#H#" + buffer); // debug
if (buffer.charAt(0) <= 32) {
// RFC2616 4.2: headers beginning with LWS are appended to the previous line
if (b[0] == serverCore.SP || b[0] == serverCore.HT) {
// use old entry
if (key.length() == 0) throw new IOException("header corrupted - input error");
// attach new line

@ -315,18 +315,18 @@ public final class httpd implements serverHandler {
String auth = (String) header.get(httpHeader.AUTHORIZATION);
if (auth == null) {
// authorization requested, but no authorizeation given in header. Ask for authenticate:
this.session.out.write((httpVersion + " 401 log-in required" + serverCore.crlfString +
httpHeader.WWW_AUTHENTICATE + ": Basic realm=\"log-in\"" + serverCore.crlfString +
serverCore.crlfString).getBytes());
this.session.out.write((httpVersion + " 401 log-in required" + serverCore.CRLF_STRING +
httpHeader.WWW_AUTHENTICATE + ": Basic realm=\"log-in\"" + serverCore.CRLF_STRING +
serverCore.CRLF_STRING).getBytes());
this.session.out.write((httpHeader.CONTENT_LENGTH + ": 0\r\n").getBytes());
this.session.out.write("\r\n".getBytes());
return false;
} else if (!this.serverAccountBase64MD5.equals(serverCodings.encodeMD5Hex(auth.trim().substring(6)))) {
// wrong password given: ask for authenticate again
serverLog.logInfo("HTTPD", "Wrong log-in for account 'server' in HTTPD.GET " + this.prop.getProperty("PATH") + " from IP " + this.clientIP);
this.session.out.write((httpVersion + " 401 log-in required" + serverCore.crlfString +
this.session.out.write((httpVersion + " 401 log-in required" + serverCore.CRLF_STRING +
httpHeader.WWW_AUTHENTICATE + ": Basic realm=\"log-in\"" +
serverCore.crlfString).getBytes());
serverCore.CRLF_STRING).getBytes());
this.session.out.write((httpHeader.CONTENT_LENGTH + ": 0\r\n").getBytes());
this.session.out.write("\r\n".getBytes());
return false;
@ -420,8 +420,8 @@ public final class httpd implements serverHandler {
return false;
}
// ask for authenticate
this.session.out.write((httpVersion + " 407 Proxy Authentication Required" + serverCore.crlfString +
httpHeader.PROXY_AUTHENTICATE + ": Basic realm=\"log-in\"" + serverCore.crlfString).getBytes());
this.session.out.write((httpVersion + " 407 Proxy Authentication Required" + serverCore.CRLF_STRING +
httpHeader.PROXY_AUTHENTICATE + ": Basic realm=\"log-in\"" + serverCore.CRLF_STRING).getBytes());
this.session.out.write((httpHeader.CONTENT_LENGTH + ": 0\r\n").getBytes());
this.session.out.write("\r\n".getBytes());
return false;
@ -490,7 +490,7 @@ public final class httpd implements serverHandler {
}
} else {
// not authorized through firewall blocking (ip does not match filter)
this.session.out.write((httpVersion + " 403 refused (IP not granted)" + serverCore.crlfString + serverCore.crlfString + "you are not allowed to connect to this server, because you are using the non-granted IP " + clientIP + ". allowed are only connections that match with the following filter: " + switchboard.getConfig("serverClient", "*") + serverCore.crlfString).getBytes());
this.session.out.write((httpVersion + " 403 refused (IP not granted)" + serverCore.CRLF_STRING + serverCore.CRLF_STRING + "you are not allowed to connect to this server, because you are using the non-granted IP " + clientIP + ". allowed are only connections that match with the following filter: " + switchboard.getConfig("serverClient", "*") + serverCore.CRLF_STRING).getBytes());
return serverCore.TERMINATE_CONNECTION;
}
} else {
@ -500,7 +500,7 @@ public final class httpd implements serverHandler {
httpdProxyHandler.doGet(this.prop, header, this.session.out);
} else {
// not authorized through firewall blocking (ip does not match filter)
this.session.out.write((httpVersion + " 403 refused (IP not granted)" + serverCore.crlfString + serverCore.crlfString + "you are not allowed to connect to this proxy, because you are using the non-granted IP " + clientIP + ". allowed are only connections that match with the following filter: " + switchboard.getConfig("proxyClient", "*") + serverCore.crlfString).getBytes());
this.session.out.write((httpVersion + " 403 refused (IP not granted)" + serverCore.CRLF_STRING + serverCore.CRLF_STRING + "you are not allowed to connect to this proxy, because you are using the non-granted IP " + clientIP + ". allowed are only connections that match with the following filter: " + switchboard.getConfig("proxyClient", "*") + serverCore.CRLF_STRING).getBytes());
return serverCore.TERMINATE_CONNECTION;
}
}
@ -562,7 +562,7 @@ public final class httpd implements serverHandler {
} else {
// not authorized through firewall blocking (ip does not match filter)
session.out.write((httpVersion + " 403 refused (IP not granted)" +
serverCore.crlfString).getBytes());
serverCore.CRLF_STRING).getBytes());
return serverCore.TERMINATE_CONNECTION;
}
} else {
@ -573,7 +573,7 @@ public final class httpd implements serverHandler {
} else {
// not authorized through firewall blocking (ip does not match filter)
session.out.write((httpVersion + " 403 refused (IP not granted)" +
serverCore.crlfString).getBytes());
serverCore.CRLF_STRING).getBytes());
return serverCore.TERMINATE_CONNECTION;
}
}
@ -611,7 +611,7 @@ public final class httpd implements serverHandler {
}
} else {
// not authorized through firewall blocking (ip does not match filter)
session.out.write((httpVersion + " 403 refused (IP not granted)" + serverCore.crlfString + serverCore.crlfString + "you are not allowed to connect to this server, because you are using the non-granted IP " + clientIP + ". allowed are only connections that match with the following filter: " + switchboard.getConfig("serverClient", "*") + serverCore.crlfString).getBytes());
session.out.write((httpVersion + " 403 refused (IP not granted)" + serverCore.CRLF_STRING + serverCore.CRLF_STRING + "you are not allowed to connect to this server, because you are using the non-granted IP " + clientIP + ". allowed are only connections that match with the following filter: " + switchboard.getConfig("serverClient", "*") + serverCore.CRLF_STRING).getBytes());
return serverCore.TERMINATE_CONNECTION;
}
} else {
@ -621,7 +621,7 @@ public final class httpd implements serverHandler {
httpdProxyHandler.doPost(prop, header, this.session.out, this.session.in);
} else {
// not authorized through firewall blocking (ip does not match filter)
session.out.write((httpVersion + " 403 refused (IP not granted)" + serverCore.crlfString + serverCore.crlfString + "you are not allowed to connect to this proxy, because you are using the non-granted IP " + clientIP + ". allowed are only connections that match with the following filter: " + switchboard.getConfig("proxyClient", "*") + serverCore.crlfString).getBytes());
session.out.write((httpVersion + " 403 refused (IP not granted)" + serverCore.CRLF_STRING + serverCore.CRLF_STRING + "you are not allowed to connect to this proxy, because you are using the non-granted IP " + clientIP + ". allowed are only connections that match with the following filter: " + switchboard.getConfig("proxyClient", "*") + serverCore.CRLF_STRING).getBytes());
return serverCore.TERMINATE_CONNECTION;
}
}
@ -670,7 +670,7 @@ public final class httpd implements serverHandler {
if (!(allowProxy)) {
// not authorized through firewall blocking (ip does not match filter)
session.out.write((httpVersion + " 403 refused (IP not granted)" + serverCore.crlfString + serverCore.crlfString + "you are not allowed to connect to this proxy, because you are using the non-granted IP " + clientIP + ". allowed are only connections that match with the following filter: " + switchboard.getConfig("proxyClient", "*") + serverCore.crlfString).getBytes());
session.out.write((httpVersion + " 403 refused (IP not granted)" + serverCore.CRLF_STRING + serverCore.CRLF_STRING + "you are not allowed to connect to this proxy, because you are using the non-granted IP " + clientIP + ". allowed are only connections that match with the following filter: " + switchboard.getConfig("proxyClient", "*") + serverCore.CRLF_STRING).getBytes());
return serverCore.TERMINATE_CONNECTION;
}
@ -678,7 +678,7 @@ public final class httpd implements serverHandler {
// security: connection only to ssl port
// we send a 403 (forbidden) error back
session.out.write((httpVersion + " 403 Connection to non-443 forbidden" +
serverCore.crlfString + serverCore.crlfString).getBytes());
serverCore.CRLF_STRING + serverCore.CRLF_STRING).getBytes());
return serverCore.TERMINATE_CONNECTION;
}
@ -688,7 +688,7 @@ public final class httpd implements serverHandler {
httpdProxyHandler.doConnect(prop, header, this.session.in, this.session.out);
} else {
// not authorized through firewall blocking (ip does not match filter)
session.out.write((httpVersion + " 403 refused (IP not granted)" + serverCore.crlfString + serverCore.crlfString + "you are not allowed to connect to this proxy, because you are using the non-granted IP " + clientIP + ". allowed are only connections that match with the following filter: " + switchboard.getConfig("proxyClient", "*") + serverCore.crlfString).getBytes());
session.out.write((httpVersion + " 403 refused (IP not granted)" + serverCore.CRLF_STRING + serverCore.CRLF_STRING + "you are not allowed to connect to this proxy, because you are using the non-granted IP " + clientIP + ". allowed are only connections that match with the following filter: " + switchboard.getConfig("proxyClient", "*") + serverCore.CRLF_STRING).getBytes());
}
return serverCore.TERMINATE_CONNECTION;
@ -952,14 +952,14 @@ public final class httpd implements serverHandler {
break;
}
// we don't know if the value is terminated by lf, cr or crlf
// (it's suppose to be crlf, but we want to be lazy about wrong terminations)
if (buffer[p - 2] == serverCore.cr) // ERROR: IndexOutOfBounds: -2
/* crlf */ q = p - 2;
// we don't know if the value is terminated by LF, CR or CRLF
// (it's suppose to be CRLF, but we want to be lazy about wrong terminations)
if (buffer[p - 2] == serverCore.CR) // ERROR: IndexOutOfBounds: -2
/* CRLF */ q = p - 2;
else
/* cr or lf only */ q = p - 1;
// the above line is wrong if we uploaded a file that has a cr as it's last byte
// and the client's line termination symbol is only a cr or lf (which would be incorrect)
/* CR or LF only */ q = p - 1;
// the above line is wrong if we uploaded a file that has a CR as it's last byte
// and the client's line termination symbol is only a CR or LF (which would be incorrect)
// the value is between 'pos' and 'q', while the next marker is 'p'
line = new byte[q - pos];
java.lang.System.arraycopy(buffer, pos, line, 0, q - pos);
@ -1007,11 +1007,11 @@ public final class httpd implements serverHandler {
private static byte[] readLine(int start, byte[] array) {
// read a string from an array; line ending is always CRLF
// but we are also fuzzy with that: may also be only CR or LF
// if no remaining cr, crlf or lf can be found, return null
// if no remaining CR, CRLF or LF can be found, return null
if (start > array.length) return null;
int pos = indexOf(start, array, serverCore.crlf); nextPos = pos + 2;
if (pos < 0) {pos = indexOf(start, array, new byte[] {serverCore.cr}); nextPos = pos + 1;}
if (pos < 0) {pos = indexOf(start, array, new byte[] {serverCore.lf}); nextPos = pos + 1;}
int pos = indexOf(start, array, serverCore.CRLF); nextPos = pos + 2;
if (pos < 0) {pos = indexOf(start, array, new byte[] {serverCore.CR}); nextPos = pos + 1;}
if (pos < 0) {pos = indexOf(start, array, new byte[] {serverCore.LF}); nextPos = pos + 1;}
if (pos < 0) {nextPos = start; return null;}
byte[] result = new byte[pos - start];
java.lang.System.arraycopy(array, start, result, 0, pos - start);

@ -1169,9 +1169,9 @@ public final class httpdProxyHandler {
OutputStream promiscuousOut = sslSocket.getOutputStream();
// now then we can return a success message
clientOut.write((httpVersion + " 200 Connection established" + serverCore.crlfString +
"Proxy-agent: YACY" + serverCore.crlfString +
serverCore.crlfString).getBytes());
clientOut.write((httpVersion + " 200 Connection established" + serverCore.CRLF_STRING +
"Proxy-agent: YACY" + serverCore.CRLF_STRING +
serverCore.CRLF_STRING).getBytes());
theLogger.logInfo("SSL connection to " + host + ":" + port + " established.");

@ -283,18 +283,18 @@ public class plasmaRankingCRProcess {
source_file = new File(from_dir, files[i]);
if (newdb) {
if (accumulate_upd(source_file, newacc, newseq)) {
// move cr file to temporary folder
// move CR file to temporary folder
source_file.renameTo(new File(tmp_dir, files[i]));
} else {
// error case: the cr-file is not valid; move to error path
// error case: the CR-file is not valid; move to error path
source_file.renameTo(new File(err_dir, files[i]));
}
} else {
if (accumulate_upd(source_file, acc)) {
// move cr file to temporary folder
// move CR file to temporary folder
source_file.renameTo(new File(tmp_dir, files[i]));
} else {
// error case: the cr-file is not valid; move to error path
// error case: the CR-file is not valid; move to error path
source_file.renameTo(new File(err_dir, files[i]));
}
}

@ -69,7 +69,7 @@ public final class plasmaRankingDistribution {
public static final int METHOD_FIXEDADDRESS = 99;
private final serverLog log;
private File sourcePath; // where to load cr-files
private File sourcePath; // where to load CR-files
private int method; // of peer selection
private int percentage; // to select any other peer
private String address[]; // of fixed other peer

@ -1905,7 +1905,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
try {
boolean hasDoneSomething = false;
// do transmission of cr-files
// do transmission of CR-files
checkInterruption();
int count = rankingOwnDistribution.size() / 100;
if (count == 0) count = 1;

@ -86,12 +86,14 @@ import de.anomic.yacy.yacySeed;
public final class serverCore extends serverAbstractThread implements serverThread {
// generic input/output static methods
public static final byte cr = 13;
public static final byte lf = 10;
public static final byte[] crlf = {cr, lf};
public static final String crlfString = new String(crlf);
public static final String lfstring = new String(new byte[]{lf});
// special ASCII codes used for protocol handling
public static final byte HT = 9; // Horizontal Tab
public static final byte LF = 10; // Line Feed
public static final byte CR = 13; // Carriage Return
public static final byte SP = 32; // Space
public static final byte[] CRLF = {CR, LF}; // Line End of HTTP/ICAP headers
public static final String CRLF_STRING = new String(CRLF);
public static final String LF_STRING = new String(new byte[]{LF});
public static final Class[] stringType = {"".getClass()}; // set up some reflection
public static final long startupTime = System.currentTimeMillis();
@ -848,7 +850,7 @@ public final class serverCore extends serverAbstractThread implements serverThre
}
public void writeLine(String messg) throws IOException {
send(this.out, messg + crlfString);
send(this.out, messg + CRLF_STRING);
log(true, messg);
}
@ -1189,21 +1191,21 @@ public final class serverCore extends serverAbstractThread implements serverThre
while (bufferSize < maxSize) {
b = pbis.read();
if ((b > 31 && b != 127) || b == 9) {
if ((b > 31 && b != 127) || b == HT) {
// add legal chars to the result
readLineBuffer.append(b);
bufferSize++;
} else if (b == cr) {
} else if (b == CR) {
// possible beginning of CRLF, check following byte
b = pbis.read();
if (b == lf) {
if (b == LF) {
// line end catched: break the loop
break;
} else if (b >= 0) {
// no line end: push back the byte, ignore the CR
pbis.unread(b);
}
} else if (b == lf || b < 0) {
} else if (b == LF || b < 0) {
// LF without precedent CR: treat as line end of broken servers
// b < 0: EOS
break;
@ -1225,13 +1227,13 @@ public final class serverCore extends serverAbstractThread implements serverThre
public static void send(OutputStream os, String buf) throws IOException {
os.write(buf.getBytes());
// TODO make sure there was no reason to add this additional newline
//os.write(crlf);
//os.write(CRLF);
os.flush();
}
public static void send(OutputStream os, byte[] buf) throws IOException {
os.write(buf);
os.write(crlf);
os.write(CRLF);
os.flush();
}
@ -1240,7 +1242,7 @@ public final class serverCore extends serverAbstractThread implements serverThre
byte[] buffer = new byte[((bufferSize < 1) || (bufferSize > 4096)) ? 4096 : bufferSize];
int l;
while ((l = is.read(buffer)) > 0) {os.write(buffer, 0, l);}
os.write(crlf);
os.write(CRLF);
os.flush();
if (bufferSize > 80) return "<LONG STREAM>"; else return new String(buffer);
}

@ -340,7 +340,7 @@ public final class serverSystem {
// runs a unix/linux script as separate thread
File starterFile = new File(scriptFile.getAbsolutePath() + ".starter.sh");
//deployScript(starterFile, "touch restart.starter.startet1");
deployScript(starterFile, "#!/bin/sh" + serverCore.lfstring + scriptFile.getAbsolutePath() + " &" + serverCore.lfstring);
deployScript(starterFile, "#!/bin/sh" + serverCore.LF_STRING + scriptFile.getAbsolutePath() + " &" + serverCore.LF_STRING);
try {
Runtime.getRuntime().exec(starterFile.getAbsolutePath()).waitFor();
} catch (InterruptedException e) {

@ -961,7 +961,7 @@ public final class yacyClient {
entry = (indexRWIEntry) eenum.next();
entrypost.append(indexes[i].getWordHash())
.append(entry.toPropertyForm())
.append(serverCore.crlfString);
.append(serverCore.CRLF_STRING);
indexcount++;
}
}

@ -734,7 +734,7 @@ public final class yacySeedDB {
if (addMySeed) {
line = mySeed.genSeedStr(null);
v.add(line);
pw.print(line + serverCore.crlfString);
pw.print(line + serverCore.CRLF_STRING);
}
// store other seeds
@ -745,7 +745,7 @@ public final class yacySeedDB {
if (ys != null) {
line = ys.genSeedStr(null);
v.add(line);
pw.print(line + serverCore.crlfString);
pw.print(line + serverCore.CRLF_STRING);
}
}
pw.flush();
@ -787,9 +787,9 @@ public final class yacySeedDB {
// Comparing if local copy and uploaded copy are equal
String errorMsg = checkCache(uv, check);
if (errorMsg == null)
log = log + "UPLOAD CHECK - Success: the result vectors are equal" + serverCore.crlfString;
log = log + "UPLOAD CHECK - Success: the result vectors are equal" + serverCore.CRLF_STRING;
else {
throw new Exception("UPLOAD CHECK - Error: the result vector is different. " + errorMsg + serverCore.crlfString);
throw new Exception("UPLOAD CHECK - Error: the result vector is different. " + errorMsg + serverCore.CRLF_STRING);
}
} finally {
if (seedFile != null) try { seedFile.delete(); } catch (Exception e) {/* ignore this */}

@ -370,13 +370,13 @@ public final class yacyVersion implements Comparator, Comparable {
try {
serverLog.logInfo("RESTART", "INITIATED");
String script =
"#!/bin/sh" + serverCore.lfstring +
"cd " + sb.getRootPath() + "/DATA/RELEASE/" + serverCore.lfstring +
"while [ -f ../yacy.running ]; do" + serverCore.lfstring +
"sleep 1" + serverCore.lfstring +
"done" + serverCore.lfstring +
"cd ../../" + serverCore.lfstring +
"nohup ./startYACY.sh > /dev/null" + serverCore.lfstring;
"#!/bin/sh" + serverCore.LF_STRING +
"cd " + sb.getRootPath() + "/DATA/RELEASE/" + serverCore.LF_STRING +
"while [ -f ../yacy.running ]; do" + serverCore.LF_STRING +
"sleep 1" + serverCore.LF_STRING +
"done" + serverCore.LF_STRING +
"cd ../../" + serverCore.LF_STRING +
"nohup ./startYACY.sh > /dev/null" + serverCore.LF_STRING;
File scriptFile = new File(sb.getRootPath(), "DATA/RELEASE/restart.sh");
serverSystem.deployScript(scriptFile, script);
serverLog.logInfo("RESTART", "wrote restart-script to " + scriptFile.getAbsolutePath());
@ -395,16 +395,16 @@ public final class yacyVersion implements Comparator, Comparable {
plasmaSwitchboard sb = plasmaSwitchboard.getSwitchboard();
serverLog.logInfo("UPDATE", "INITIATED");
String script =
"#!/bin/sh" + serverCore.lfstring +
"cd " + sb.getRootPath() + "/DATA/RELEASE/" + serverCore.lfstring +
"gunzip -c " + release + " | tar xf -" + serverCore.lfstring +
"while [ -f ../yacy.running ]; do" + serverCore.lfstring +
"sleep 1" + serverCore.lfstring +
"done" + serverCore.lfstring +
"cp -Rf yacy/* ../../" + serverCore.lfstring +
"rm -Rf yacy" + serverCore.lfstring +
"cd ../../" + serverCore.lfstring +
"nohup ./startYACY.sh > /dev/null" + serverCore.lfstring;
"#!/bin/sh" + serverCore.LF_STRING +
"cd " + sb.getRootPath() + "/DATA/RELEASE/" + serverCore.LF_STRING +
"gunzip -c " + release + " | tar xf -" + serverCore.LF_STRING +
"while [ -f ../yacy.running ]; do" + serverCore.LF_STRING +
"sleep 1" + serverCore.LF_STRING +
"done" + serverCore.LF_STRING +
"cp -Rf yacy/* ../../" + serverCore.LF_STRING +
"rm -Rf yacy" + serverCore.LF_STRING +
"cd ../../" + serverCore.LF_STRING +
"nohup ./startYACY.sh > /dev/null" + serverCore.LF_STRING;
File scriptFile = new File(sb.getRootPath(), "DATA/RELEASE/update.sh");
serverSystem.deployScript(scriptFile, script);
serverLog.logInfo("UPDATE", "wrote update-script to " + scriptFile.getAbsolutePath());

@ -813,7 +813,7 @@ public final class yacy {
counter++;
container = (indexContainer) indexContainerIterator.next();
bos.write((container.getWordHash()).getBytes());
bos.write(serverCore.crlf);
bos.write(serverCore.CRLF);
if (counter % 500 == 0) {
log.logInfo("Found " + counter + " Hashs until now. Last found Hash: " + container.getWordHash());
}
@ -828,7 +828,7 @@ public final class yacy {
counter++;
container = (indexContainer) indexContainerIterator.next();
bos.write((container.getWordHash()).getBytes());
bos.write(serverCore.crlf);
bos.write(serverCore.CRLF);
if (counter % 500 == 0) {
log.logInfo("Found " + counter + " Hashs until now. Last found Hash: " + container.getWordHash());
}

Loading…
Cancel
Save