From 3450ffad2b8ea4ae1015c81146f6efe23515852a Mon Sep 17 00:00:00 2001 From: Oliver Mihatsch Date: Mon, 18 Mar 2019 10:34:49 +0100 Subject: [PATCH 1/3] Do not use "CONNECT" in the Host header field. --- .../org/jivesoftware/smack/proxy/HTTPProxySocketConnection.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/smack-core/src/main/java/org/jivesoftware/smack/proxy/HTTPProxySocketConnection.java b/smack-core/src/main/java/org/jivesoftware/smack/proxy/HTTPProxySocketConnection.java index cd1000c15..6326cf1db 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/proxy/HTTPProxySocketConnection.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/proxy/HTTPProxySocketConnection.java @@ -58,7 +58,7 @@ class HTTPProxySocketConnection implements ProxySocketConnection { proxyLine = "\r\nProxy-Authorization: Basic " + Base64.encode(username + ":" + password); } socket.getOutputStream().write((hostport + " HTTP/1.1\r\nHost: " - + hostport + proxyLine + "\r\n\r\n").getBytes("UTF-8")); + + host + ":" + port + proxyLine + "\r\n\r\n").getBytes("UTF-8")); InputStream in = socket.getInputStream(); StringBuilder got = new StringBuilder(100); From 8e88cd2e31a744bf9c5d8e599d38796b927c0413 Mon Sep 17 00:00:00 2001 From: Georg Lukas Date: Tue, 12 Mar 2019 11:33:38 +0100 Subject: [PATCH 2/3] Proxy mode: add failed address on error --- .../main/java/org/jivesoftware/smack/tcp/XMPPTCPConnection.java | 1 + 1 file changed, 1 insertion(+) diff --git a/smack-tcp/src/main/java/org/jivesoftware/smack/tcp/XMPPTCPConnection.java b/smack-tcp/src/main/java/org/jivesoftware/smack/tcp/XMPPTCPConnection.java index bf4409506..97e0e2044 100644 --- a/smack-tcp/src/main/java/org/jivesoftware/smack/tcp/XMPPTCPConnection.java +++ b/smack-tcp/src/main/java/org/jivesoftware/smack/tcp/XMPPTCPConnection.java @@ -647,6 +647,7 @@ public class XMPPTCPConnection extends AbstractXMPPConnection { proxyInfo.getProxySocketConnection().connect(socket, host, port, timeout); } catch (IOException e) { hostAddress.setException(e); + failedAddresses.add(hostAddress); continue; } LOGGER.finer("Established TCP connection to " + hostAndPort); From 007a04c4fe599bbea04fdd4bc6cf03e45ae8db36 Mon Sep 17 00:00:00 2001 From: Oliver Mihatsch Date: Mon, 18 Mar 2019 10:28:50 +0100 Subject: [PATCH 3/3] Better error messages when using a Proxy to connect to the XMPP server. --- .../jivesoftware/smack/proxy/HTTPProxySocketConnection.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/smack-core/src/main/java/org/jivesoftware/smack/proxy/HTTPProxySocketConnection.java b/smack-core/src/main/java/org/jivesoftware/smack/proxy/HTTPProxySocketConnection.java index 6326cf1db..549406423 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/proxy/HTTPProxySocketConnection.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/proxy/HTTPProxySocketConnection.java @@ -115,7 +115,8 @@ class HTTPProxySocketConnection implements ProxySocketConnection { int code = Integer.parseInt(m.group(1)); if (code != HttpURLConnection.HTTP_OK) { - throw new ProxyException(ProxyInfo.ProxyType.HTTP); + throw new ProxyException(ProxyInfo.ProxyType.HTTP, + "Error code in proxy response: " + code); } }