forked from I2P_Developers/i2p.i2p
2005-03-04 jrandom
* Filter HTTP response headers in the eepproxy, forcing Connection: close so that broken (/malicious) webservers can't allow persistent connections. All HTTP compliant browsers should now always close the socket. * Enabled the GZIPInputStream's cache (they were'nt cached before) * Make sure our first send is always a SYN (duh) * Workaround for some buggy compilers
This commit is contained in:
@ -865,7 +865,7 @@ public class DataHelper {
|
||||
ReusableGZIPInputStream in = ReusableGZIPInputStream.acquire();
|
||||
in.initialize(new ByteArrayInputStream(orig, offset, length));
|
||||
|
||||
ByteCache cache = ByteCache.getInstance(16, MAX_UNCOMPRESSED);
|
||||
ByteCache cache = ByteCache.getInstance(8, MAX_UNCOMPRESSED);
|
||||
ByteArray outBuf = cache.acquire();
|
||||
int written = 0;
|
||||
while (true) {
|
||||
@ -877,6 +877,7 @@ public class DataHelper {
|
||||
byte rv[] = new byte[written];
|
||||
System.arraycopy(outBuf.getData(), 0, rv, 0, written);
|
||||
cache.release(outBuf);
|
||||
ReusableGZIPInputStream.release(in);
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
@ -134,8 +134,8 @@ public class Timestamper implements Runnable {
|
||||
try {
|
||||
lastFailed = !queryTime(serverList);
|
||||
} catch (IllegalArgumentException iae) {
|
||||
if (!lastFailed)
|
||||
_log.log(Log.CRIT, "Unable to reach any of the NTP servers - network disconnected?");
|
||||
if ( (!lastFailed) && (_log.shouldLog(Log.ERROR)) )
|
||||
_log.error("Unable to reach any of the NTP servers - network disconnected?");
|
||||
lastFailed = true;
|
||||
}
|
||||
}
|
||||
|
@ -238,8 +238,8 @@ public class OrderedProperties extends Properties {
|
||||
|
||||
public int compareTo(Object o) {
|
||||
if (o == null) return -1;
|
||||
if (o instanceof StringMapEntry) return ((String) getKey()).compareTo(((StringMapEntry) o).getKey());
|
||||
if (o instanceof String) return ((String) getKey()).compareTo(o);
|
||||
if (o instanceof StringMapEntry) return ((String) getKey()).compareTo((String)((StringMapEntry) o).getKey());
|
||||
if (o instanceof String) return ((String) getKey()).compareTo((String)o);
|
||||
return -2;
|
||||
}
|
||||
|
||||
|
@ -15,7 +15,7 @@ import net.i2p.data.DataHelper;
|
||||
*
|
||||
*/
|
||||
public class ReusableGZIPInputStream extends ResettableGZIPInputStream {
|
||||
private static ArrayList _available = new ArrayList(16);
|
||||
private static ArrayList _available = new ArrayList(8);
|
||||
/**
|
||||
* Pull a cached instance
|
||||
*/
|
||||
@ -36,7 +36,7 @@ public class ReusableGZIPInputStream extends ResettableGZIPInputStream {
|
||||
*/
|
||||
public static void release(ReusableGZIPInputStream released) {
|
||||
synchronized (_available) {
|
||||
if (_available.size() < 16)
|
||||
if (_available.size() < 8)
|
||||
_available.add(released);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user