Skip to content

Commit

Permalink
fix small bug introduced in r4089 that appeared when we tried to remo…
Browse files Browse the repository at this point in the history
…ve "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
  • Loading branch information
fuchsi committed Sep 10, 2007
1 parent ae4b930 commit e192f99
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion source/de/anomic/http/httpc.java
Expand Up @@ -666,7 +666,10 @@ private void send(String method, String path, httpHeader header, boolean zipped)
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 {
Expand Down

0 comments on commit e192f99

Please sign in to comment.