* HTTP client proxy: Don't flush after headers for a POST,

so the POST data is included in the SYN packet,
   to improve speed and reliability of small POSTs
This commit is contained in:
zzz
2014-02-11 13:44:37 +00:00
parent d8fef53aef
commit 8ed34e3edf
3 changed files with 15 additions and 3 deletions

View File

@ -18,6 +18,7 @@ import javax.net.ssl.SSLException;
import net.i2p.I2PAppContext;
import net.i2p.client.streaming.I2PSocket;
import net.i2p.data.ByteArray;
import net.i2p.data.DataHelper;
import net.i2p.util.ByteCache;
import net.i2p.util.Clock;
import net.i2p.util.I2PAppThread;
@ -137,6 +138,8 @@ public class I2PTunnelRunner extends I2PAppThread implements I2PSocket.SocketErr
protected InputStream getSocketIn() throws IOException { return s.getInputStream(); }
protected OutputStream getSocketOut() throws IOException { return s.getOutputStream(); }
private static final byte[] POST = { 'P', 'O', 'S', 'T', ' ' };
@Override
public void run() {
try {
@ -159,8 +162,12 @@ public class I2PTunnelRunner extends I2PAppThread implements I2PSocket.SocketErr
// So we now get a fast return from flush(), and can do it here to save 250 ms.
// To make sure we are under the initial window size and don't hang waiting for accept,
// only flush if it fits in one message.
if (initialI2PData.length <= 1730) // ConnectionOptions.DEFAULT_MAX_MESSAGE_SIZE
i2pout.flush();
if (initialI2PData.length <= 1730) { // ConnectionOptions.DEFAULT_MAX_MESSAGE_SIZE
// Don't flush if POST, so we can get POST data into the initial packet
if (initialI2PData.length < 5 ||
!DataHelper.eq(POST, 0, initialI2PData, 0, 5))
i2pout.flush();
}
//}
}
if (initialSocketData != null) {

View File

@ -1,3 +1,8 @@
2014-02-11 zzz
* HTTP client proxy: Don't flush after headers for a POST,
so the POST data is included in the SYN packet,
to improve speed and reliability of small POSTs
2014-02-10 zzz
Prop from i2p.i2p.zzz.test2:
* Addressbook: Rewrite subscriptions.txt for new default URL

View File

@ -18,7 +18,7 @@ public class RouterVersion {
/** deprecated */
public final static String ID = "Monotone";
public final static String VERSION = CoreVersion.VERSION;
public final static long BUILD = 2;
public final static long BUILD = 3;
/** for example "-test" */
public final static String EXTRA = "";