From b6ad737aa4365242a6172c8248803f31e12eca5f Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Mon, 18 Nov 2019 19:37:10 +0100 Subject: [PATCH] proxy: do not call setTcpNoDelay() but instead flush the stream --- .../jivesoftware/smack/proxy/Socks4ProxySocketConnection.java | 2 +- .../jivesoftware/smack/proxy/Socks5ProxySocketConnection.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/smack-core/src/main/java/org/jivesoftware/smack/proxy/Socks4ProxySocketConnection.java b/smack-core/src/main/java/org/jivesoftware/smack/proxy/Socks4ProxySocketConnection.java index 614957f87..edab289f1 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/proxy/Socks4ProxySocketConnection.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/proxy/Socks4ProxySocketConnection.java @@ -46,7 +46,6 @@ public class Socks4ProxySocketConnection implements ProxySocketConnection { socket.connect(new InetSocketAddress(proxy_host, proxy_port), timeout); InputStream in = socket.getInputStream(); OutputStream out = socket.getOutputStream(); - socket.setTcpNoDelay(true); byte[] buf = new byte[1024]; int index = 0; @@ -88,6 +87,7 @@ public class Socks4ProxySocketConnection implements ProxySocketConnection { } buf[index++] = 0; out.write(buf, 0, index); + out.flush(); /* The SOCKS server checks to see whether such a request should be granted diff --git a/smack-core/src/main/java/org/jivesoftware/smack/proxy/Socks5ProxySocketConnection.java b/smack-core/src/main/java/org/jivesoftware/smack/proxy/Socks5ProxySocketConnection.java index c91402218..299cf1d89 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/proxy/Socks5ProxySocketConnection.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/proxy/Socks5ProxySocketConnection.java @@ -48,8 +48,6 @@ public class Socks5ProxySocketConnection implements ProxySocketConnection { InputStream in = socket.getInputStream(); OutputStream out = socket.getOutputStream(); - socket.setTcpNoDelay(true); - byte[] buf = new byte[1024]; int index = 0; @@ -81,6 +79,7 @@ public class Socks5ProxySocketConnection implements ProxySocketConnection { buf[index++] = 2; // USERNAME/PASSWORD out.write(buf, 0, index); + out.flush(); /* The server selects from one of the methods given in METHODS, and @@ -205,6 +204,7 @@ public class Socks5ProxySocketConnection implements ProxySocketConnection { buf[index++] = (byte) (port & 0xff); out.write(buf, 0, index); + out.flush(); /* The SOCKS request information is sent by the client as soon as it has