reverting svn 3691+3692

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@3696 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 18 years ago
parent ea591630cb
commit 2fa8b50e54

@ -705,7 +705,6 @@ public final class httpHeader extends TreeMap implements Map {
httpHeader header = new httpHeader(httpd.reverseMappingCache); httpHeader header = new httpHeader(httpd.reverseMappingCache);
int p; int p;
String line; String line;
long start = System.currentTimeMillis();
while ((line = theSession.readLineAsString()) != null) { while ((line = theSession.readLineAsString()) != null) {
if (line.length() == 0) break; // this seperates the header of the HTTP request from the body if (line.length() == 0) break; // this seperates the header of the HTTP request from the body
// parse the header line: a property seperated with the ':' sign // parse the header line: a property seperated with the ':' sign
@ -713,7 +712,6 @@ public final class httpHeader extends TreeMap implements Map {
// store a property // store a property
header.add(line.substring(0, p).trim(), line.substring(p + 1).trim()); header.add(line.substring(0, p).trim(), line.substring(p + 1).trim());
} }
if (System.currentTimeMillis() - start > theSession.socketTimeout) break;
} }
/* /*

@ -111,7 +111,6 @@ public final class httpc {
private static final String vDATE = "20040602"; private static final String vDATE = "20040602";
public static String userAgent; public static String userAgent;
private static final int terminalMaxLength = 30000; private static final int terminalMaxLength = 30000;
private static final long terminalMaxTime = 60000;
private static final TimeZone GMTTimeZone = TimeZone.getTimeZone("GMT"); private static final TimeZone GMTTimeZone = TimeZone.getTimeZone("GMT");
/** /**
* This string is initialized on loading of this class and contains * This string is initialized on loading of this class and contains
@ -1709,7 +1708,7 @@ do upload
} }
// reads in the http header, right now, right here // reads in the http header, right now, right here
byte[] b = serverCore.receive(httpc.this.clientInput, httpc.this.readLineBuffer, terminalMaxLength, terminalMaxTime, false); byte[] b = serverCore.receive(httpc.this.clientInput, httpc.this.readLineBuffer, terminalMaxLength, false);
if (b == null) { if (b == null) {
// the server has meanwhile disconnected // the server has meanwhile disconnected
this.statusCode = 503; this.statusCode = 503;
@ -1728,7 +1727,7 @@ do upload
if ((this.statusCode==500)&&(this.statusText.equals("status line parse error"))) { if ((this.statusCode==500)&&(this.statusText.equals("status line parse error"))) {
// flush in anything that comes without parsing // flush in anything that comes without parsing
while ((b != null) && (b.length != 0)) b = serverCore.receive(httpc.this.clientInput, httpc.this.readLineBuffer, terminalMaxLength, terminalMaxTime, false); while ((b != null) && (b.length != 0)) b = serverCore.receive(httpc.this.clientInput, httpc.this.readLineBuffer, terminalMaxLength, false);
return; // in bad mood return; // in bad mood
} }
@ -1736,13 +1735,13 @@ do upload
if (this.statusCode == 400) { if (this.statusCode == 400) {
// bad request // bad request
// flush in anything that comes without parsing // flush in anything that comes without parsing
while ((b = serverCore.receive(httpc.this.clientInput, httpc.this.readLineBuffer, terminalMaxLength, terminalMaxTime, false)).length != 0) {} while ((b = serverCore.receive(httpc.this.clientInput, httpc.this.readLineBuffer, terminalMaxLength, false)).length != 0) {}
return; // in bad mood return; // in bad mood
} }
// at this point we should have a valid response. read in the header properties // at this point we should have a valid response. read in the header properties
String key = ""; String key = "";
while ((b = serverCore.receive(httpc.this.clientInput, httpc.this.readLineBuffer, terminalMaxLength, terminalMaxTime, false)) != null) { while ((b = serverCore.receive(httpc.this.clientInput, httpc.this.readLineBuffer, terminalMaxLength, false)) != null) {
if (b.length == 0) break; if (b.length == 0) break;
buffer = new String(b); buffer = new String(b);
buffer=buffer.trim(); buffer=buffer.trim();

@ -290,7 +290,6 @@ public class icapHeader extends TreeMap implements Map {
icapHeader header = new icapHeader(); icapHeader header = new icapHeader();
int p; int p;
String line; String line;
long start = System.currentTimeMillis();
while ((line = theSession.readLineAsString()) != null) { while ((line = theSession.readLineAsString()) != null) {
if (line.length() == 0) break; // this seperates the header of the HTTP request from the body if (line.length() == 0) break; // this seperates the header of the HTTP request from the body
// parse the header line: a property seperated with the ':' sign // parse the header line: a property seperated with the ':' sign
@ -298,7 +297,6 @@ public class icapHeader extends TreeMap implements Map {
// store a property // store a property
header.add(line.substring(0, p).trim(), line.substring(p + 1).trim()); header.add(line.substring(0, p).trim(), line.substring(p + 1).trim());
} }
if (System.currentTimeMillis() - start > theSession.socketTimeout) break;
} }
return header; return header;

@ -1004,7 +1004,7 @@ public final class serverCore extends serverAbstractThread implements serverThre
} }
public byte[] readLine() { public byte[] readLine() {
return receive(this.in, this.readLineBuffer, serverCore.this.commandMaxLength, serverCore.this.timeout, false); return receive(this.in, this.readLineBuffer, serverCore.this.commandMaxLength, false);
} }
/** /**
@ -1155,14 +1155,10 @@ public final class serverCore extends serverAbstractThread implements serverThre
String reqCmd; String reqCmd;
String reqProtocol = "HTTP"; String reqProtocol = "HTTP";
Object[] stringParameter = new String[1]; Object[] stringParameter = new String[1];
long starttime = System.currentTimeMillis(); while ((this.in != null) && ((requestBytes = readLine()) != null)) {
while ((this.in != null) &&
((requestBytes = readLine()) != null) &&
(System.currentTimeMillis() - starttime < serverCore.this.timeout)) {
this.setName("Session_" + this.userAddress.getHostAddress() + this.setName("Session_" + this.userAddress.getHostAddress() +
":" + this.controlSocket.getPort() + ":" + this.controlSocket.getPort() +
"_#=" + this.commandCounter + "#" + this.commandCounter);
"_T=" + (System.currentTimeMillis() - starttime));
this.request = new String(requestBytes); this.request = new String(requestBytes);
//log.logDebug("* session " + handle + " received command '" + request + "'. time = " + (System.currentTimeMillis() - handle)); //log.logDebug("* session " + handle + " received command '" + request + "'. time = " + (System.currentTimeMillis() - handle));
@ -1308,18 +1304,16 @@ public final class serverCore extends serverAbstractThread implements serverThre
} }
public static byte[] receive(PushbackInputStream pbis, serverByteBuffer readLineBuffer, int maxSize, long timeout, boolean logerr) { public static byte[] receive(PushbackInputStream pbis, serverByteBuffer readLineBuffer, int maxSize, boolean logerr) {
// reuse an existing linebuffer // reuse an existing linebuffer
readLineBuffer.reset(); readLineBuffer.reset();
int bufferSize = 0, b = 0; int bufferSize = 0, b = 0;
try { try {
long start = System.currentTimeMillis();
while ((b = pbis.read()) > 31) { while ((b = pbis.read()) > 31) {
readLineBuffer.write(b); readLineBuffer.write(b);
if (bufferSize++ > maxSize) break; if (bufferSize++ > maxSize) break;
if ((System.currentTimeMillis() - start > timeout)) break;
} }
// we have catched a possible line end // we have catched a possible line end

Loading…
Cancel
Save