From ed45546726bb14e3e3bbf90603f84ebb785b29b0 Mon Sep 17 00:00:00 2001 From: Vijay Venugopalan Date: Tue, 2 Sep 2014 14:10:29 -0400 Subject: [PATCH 1/4] Fix for Bug #186 Proxy support does not work when the IP address of the proxy server is used instead of the hostname. This issue was introduced when adding support for authentication proxies. --- .../java/com/notnoop/apns/internal/TlsTunnelBuilder.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/notnoop/apns/internal/TlsTunnelBuilder.java b/src/main/java/com/notnoop/apns/internal/TlsTunnelBuilder.java index 36da7fea..951918c1 100644 --- a/src/main/java/com/notnoop/apns/internal/TlsTunnelBuilder.java +++ b/src/main/java/com/notnoop/apns/internal/TlsTunnelBuilder.java @@ -91,10 +91,8 @@ Socket makeTunnel(String host, int port, String proxyUsername, ProxyClient client = new ProxyClient(); client.getParams().setParameter("http.useragent", "java-apns"); client.getHostConfiguration().setHost(host, port); - String proxyHost = proxyAddress.getAddress().toString().substring(0, proxyAddress.getAddress().toString().indexOf("/")); - client.getHostConfiguration().setProxy(proxyHost, proxyAddress.getPort()); + client.getHostConfiguration().setProxy(proxyAddress.getHostString(), proxyAddress.getPort()); - ProxyClient.ConnectResponse response = client.connect(); socket = response.getSocket(); if (socket == null) { @@ -103,7 +101,8 @@ Socket makeTunnel(String host, int port, String proxyUsername, if(method.getStatusLine().toString().matches("HTTP/1\\.\\d 407 Proxy Authentication Required")) { // Proxy server returned 407. We will now try to connect with auth Header if(proxyUsername != null && proxyPassword != null) { - socket = AuthenticateProxy(method, client,proxyHost, proxyAddress.getPort(), + socket = AuthenticateProxy(method, client, + proxyAddress.getHostString(), proxyAddress.getPort(), proxyUsername, proxyPassword); } else { throw new ProtocolException("Socket not created: " + method.getStatusLine()); From 21d2938ae9f0901a1ce9dc96ee5e8d482cb44f79 Mon Sep 17 00:00:00 2001 From: Vijay Venugopalan Date: Tue, 2 Sep 2014 16:09:11 -0400 Subject: [PATCH 2/4] This is change fixes bug #186 for JDK 1.6 The previous commit for #186 does not work on any version before JDK 1.7. --- src/main/java/com/notnoop/apns/internal/TlsTunnelBuilder.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/notnoop/apns/internal/TlsTunnelBuilder.java b/src/main/java/com/notnoop/apns/internal/TlsTunnelBuilder.java index 951918c1..bb9bb50f 100644 --- a/src/main/java/com/notnoop/apns/internal/TlsTunnelBuilder.java +++ b/src/main/java/com/notnoop/apns/internal/TlsTunnelBuilder.java @@ -91,7 +91,7 @@ Socket makeTunnel(String host, int port, String proxyUsername, ProxyClient client = new ProxyClient(); client.getParams().setParameter("http.useragent", "java-apns"); client.getHostConfiguration().setHost(host, port); - client.getHostConfiguration().setProxy(proxyAddress.getHostString(), proxyAddress.getPort()); + client.getHostConfiguration().setProxy(proxyAddress.getHostName(), proxyAddress.getPort()); ProxyClient.ConnectResponse response = client.connect(); socket = response.getSocket(); @@ -102,7 +102,7 @@ Socket makeTunnel(String host, int port, String proxyUsername, // Proxy server returned 407. We will now try to connect with auth Header if(proxyUsername != null && proxyPassword != null) { socket = AuthenticateProxy(method, client, - proxyAddress.getHostString(), proxyAddress.getPort(), + proxyAddress.getHostName(), proxyAddress.getPort(), proxyUsername, proxyPassword); } else { throw new ProtocolException("Socket not created: " + method.getStatusLine()); From d50e070041c2cbaa5c14b45cac033750d3677c28 Mon Sep 17 00:00:00 2001 From: Vijay Venugopalan Date: Fri, 23 Feb 2018 16:21:46 -0800 Subject: [PATCH 3/4] test --- CHANGELOG | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index df598f7a..69366317 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,7 +1,7 @@ Changelog of java-apns Version 0.2.4.build-SNAPSHOT - (in progress) - - Performance testing java-apns (#95) + - Prmance testing java-apns (#95) Version 0.2.3 - Mar 30, 2013 - return back to com.notnoop.apns group id (#91) From 2c606a2ba8ed7896d16f2b6b9a88e02672e85a2a Mon Sep 17 00:00:00 2001 From: Vijay Venugopalan Date: Fri, 23 Feb 2018 16:27:21 -0800 Subject: [PATCH 4/4] test --- CHANGELOG | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index 69366317..df598f7a 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,7 +1,7 @@ Changelog of java-apns Version 0.2.4.build-SNAPSHOT - (in progress) - - Prmance testing java-apns (#95) + - Performance testing java-apns (#95) Version 0.2.3 - Mar 30, 2013 - return back to com.notnoop.apns group id (#91)