fix small bug introduced in r4089 that appeared when we tried to remove "gzip" encoding from Accept-Encodings header

closes http://forum.yacy-websuche.de/viewtopic.php?f=6&t=336

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

@ -666,7 +666,10 @@ 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 + 5));
// ex: "gzip,deflate" => pos == 0, but we need to remove the "," as well => substring(pos+5),
// ex: "gzip" => pos == 0, but substring(pos+5) would exceed boundaries
String enc = encoding.substring(0, pos) + (encoding.length() > (pos+5) ? encoding.substring(pos + 5) : "");
header.put(httpHeader.ACCEPT_ENCODING, enc);
}
}
} else {

Loading…
Cancel
Save