Fix problems with some web servers which couldn't handle the way yacy was sending requests. Thx to celle for the patch.

http://forum.yacy-websuche.de/viewtopic.php?f=5&t=320

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@4089 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
fuchsi 18 years ago
parent 6601e37512
commit ae4b9308ef

@ -666,7 +666,7 @@ public final class httpc {
if (pos >= 0) {
// remove the gzip encoding
//System.out.println("!!! removing gzip encoding");
header.put(httpHeader.ACCEPT_ENCODING, encoding.substring(0, pos) + encoding.substring(pos + 4));
header.put(httpHeader.ACCEPT_ENCODING, encoding.substring(0, pos) + encoding.substring(pos + 5));
}
}
} else {
@ -675,10 +675,11 @@ public final class httpc {
//header = new httpHeader(); header.put("Host", this.host); // debug
StringBuffer sb = new StringBuffer();
// send request
if ((this.remoteProxyUse) && (!(method.equals(httpHeader.METHOD_CONNECT))))
path = ((this.adressed_port == 443) ? "https://" : "http://") + this.adressed_host + ":" + this.adressed_port + path;
serverCore.send(this.clientOutput, method + " " + path + " HTTP/1.0"); // if set to HTTP/1.1, servers give time-outs?
sb.append(method + " " + path + " HTTP/1.0" + serverCore.crlfString); // 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
@ -692,14 +693,15 @@ public final class httpc {
if ((tag != '*') && (tag != '#')) {
count = header.keyCount(key);
for (int j = 0; j < count; j++) {
serverCore.send(this.clientOutput, key + ": " + ((String) header.getSingle(key, j)).trim());
sb.append(key + ": " + ((String) header.getSingle(key, j)).trim() + serverCore.crlfString);
}
//System.out.println("#" + key + ": " + value);
}
}
// send terminating line
serverCore.send(this.clientOutput, "");
// add terminating line
sb.append(serverCore.crlfString);
serverCore.send(this.clientOutput, sb.toString());
this.clientOutput.flush();
// this is the place where www.stern.de refuses to answer ..???

@ -859,7 +859,7 @@ public final class serverCore extends serverAbstractThread implements serverThre
}
public void writeLine(String messg) throws IOException {
send(this.out, messg);
send(this.out, messg + crlfString);
log(true, messg);
}
@ -1205,7 +1205,8 @@ public final class serverCore extends serverAbstractThread implements serverThre
public static void send(OutputStream os, String buf) throws IOException {
os.write(buf.getBytes());
os.write(crlf);
// TODO make sure there was no reason to add this additional newline
//os.write(crlf);
os.flush();
}

Loading…
Cancel
Save