diff --git a/CHANGELOG.md b/CHANGELOG.md index f1649934..4348b96b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Splunk Enterprise SDK for Java Changelog +## Version 1.9.4 + +### Minor Changes +* Added check for localhost IPv6 address, for IPv6 compatible apps (GitHub PR [#210](https://github.com/splunk/splunk-sdk-java/pull/210)) +* Updating SSL_SOCKET_FACTORY instance on changing _validateCertificates_ flag. (GitHub PR [#206](https://github.com/splunk/splunk-sdk-java/pull/210)) + ## Version 1.9.3 ### Minor Changes diff --git a/README.md b/README.md index 06883597..9c9b2bc9 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ [![Java SDK Test](https://github.com/splunk/splunk-sdk-java/actions/workflows/test.yml/badge.svg?branch=master)](https://github.com/splunk/splunk-sdk-java/actions/workflows/test.yml) # The Splunk Software Development Kit for Java -#### Version 1.9.3 +#### Version 1.9.4 The Splunk Software Development Kit (SDK) for Java contains library code and examples designed to enable developers to build applications using Splunk. @@ -75,7 +75,7 @@ To add the Splunk SDK for Java `.JAR` file as a dependency: com.splunk splunk - 1.9.3 + 1.9.4 ``` diff --git a/deploy b/deploy index 3e42a2fd..8e224780 100755 --- a/deploy +++ b/deploy @@ -2,7 +2,7 @@ declare -r scriptDirectory="$(dirname $(readlink -e $0))" declare -r scriptName="$(basename $0)" -declare -r version="1.9.3" +declare -r version="1.9.4" if [[ $# -ne 1 ]]; then echo 1>&2 "Usage: ${scriptName} {local|staging||production}" diff --git a/deploy.md b/deploy.md index c43e6e41..1c7d3a2a 100644 --- a/deploy.md +++ b/deploy.md @@ -9,8 +9,8 @@ deploy \ ##DESCRIPTION -Deploy transmits **target/splunk-1.9.3.jar**, **target/splunk-1.9.3-javadoc.jar**, and -**target/splunk-1.9.3-sources.jar** to the **local**, **staging**, or **production** +Deploy transmits **target/splunk-1.9.4.jar**, **target/splunk-1.9.4-javadoc.jar**, and +**target/splunk-1.9.4-sources.jar** to the **local**, **staging**, or **production** maven repository. Repository names are mapped to locations as follows. | repository-name | location | @@ -21,18 +21,18 @@ maven repository. Repository names are mapped to locations as follows. After deployment you should find this tree structure at the location of your repository - com/splunk/splunk/1.9.3/ - ├── splunk-1.9.3-javadoc.jar - ├── splunk-1.9.3-javadoc.jar.md5 - ├── splunk-1.9.3-javadoc.jar.sha1 - ├── splunk-1.9.3-sources.jar - ├── splunk-1.9.3-sources.jar.md5 - ├── splunk-1.9.3-sources.jar.sha1 - ├── splunk-1.9.3.jar - ├── splunk-1.9.3.jar.md5 - ├── splunk-1.9.3.jar.sha1 - ├── splunk-1.9.3.pom - ├── splunk-1.9.3.pom.md5 - └── splunk-1.9.3.pom.sha1 + com/splunk/splunk/1.9.4/ + ├── splunk-1.9.4-javadoc.jar + ├── splunk-1.9.4-javadoc.jar.md5 + ├── splunk-1.9.4-javadoc.jar.sha1 + ├── splunk-1.9.4-sources.jar + ├── splunk-1.9.4-sources.jar.md5 + ├── splunk-1.9.4-sources.jar.sha1 + ├── splunk-1.9.4.jar + ├── splunk-1.9.4.jar.md5 + ├── splunk-1.9.4.jar.sha1 + ├── splunk-1.9.4.pom + ├── splunk-1.9.4.pom.md5 + └── splunk-1.9.4.pom.sha1 Verify this structure prior to release. diff --git a/examples/pom.xml b/examples/pom.xml index 03e16d1c..9c5eaa01 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -37,7 +37,7 @@ com.splunk splunk - 1.9.3 + 1.9.4 provided diff --git a/pom.xml b/pom.xml index 9f1ac2f3..920736a6 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ 4.0.0 - 1.9.3 + 1.9.4 true UTF-8 8 diff --git a/splunk/pom.xml b/splunk/pom.xml index 62823326..9b61229a 100644 --- a/splunk/pom.xml +++ b/splunk/pom.xml @@ -5,7 +5,7 @@ 4.0.0 splunk - 1.9.3 + 1.9.4 splunk-sdk-java com.splunk diff --git a/splunk/src/main/java/com/splunk/HttpService.java b/splunk/src/main/java/com/splunk/HttpService.java index 696495fb..26a88ada 100644 --- a/splunk/src/main/java/com/splunk/HttpService.java +++ b/splunk/src/main/java/com/splunk/HttpService.java @@ -52,10 +52,11 @@ public class HttpService { private static String HTTP_SCHEME = "http"; private static String HOSTNAME = "localhost"; private static String HOSTIP = "127.0.0.1"; + private static String HOSTIPv6 = "::1"; private static final HostnameVerifier HOSTNAME_VERIFIER = new HostnameVerifier() { public boolean verify(String s, SSLSession sslSession) { - if (s.equals(HOSTNAME) || s.equals(HOSTIP)) { + if (s.equals(HOSTNAME) || s.equals(HOSTIP) || s.equals(HOSTIPv6)) { return true; } else { HostnameVerifier hv = HttpsURLConnection.getDefaultHostnameVerifier(); @@ -90,7 +91,7 @@ public boolean verify(String s, SSLSession sslSession) { private String prefix = null; static Map defaultHeader = new HashMap() {{ - put("User-Agent", "splunk-sdk-java/1.9.3"); + put("User-Agent", "splunk-sdk-java/1.9.4"); put("Accept", "*/*"); }}; @@ -558,8 +559,12 @@ public static SSLSocketFactory getSSLSocketFactory() { return HttpService.sslSocketFactory; } - public static void setValidateCertificates(boolean validateCertificates) { - HttpService.validateCertificates = validateCertificates; + public static void setValidateCertificates(boolean validateCertificate) { + // update the SSL_SOCKET_FACTORY if validateCertificates flag is changed + if (validateCertificates != validateCertificate) { + validateCertificates = validateCertificate; + sslSocketFactory = createSSLFactory(); + } } public static SSLSocketFactory createSSLFactory() { diff --git a/splunk/src/test/java/com/splunk/HttpServiceTest.java b/splunk/src/test/java/com/splunk/HttpServiceTest.java index 1ca2b9d2..283f1b99 100644 --- a/splunk/src/test/java/com/splunk/HttpServiceTest.java +++ b/splunk/src/test/java/com/splunk/HttpServiceTest.java @@ -41,6 +41,29 @@ public void setUp() throws Exception { ); } + @Test + public void testHttpServiceWithHostIP(){ + HttpService service = new HttpService("127.0.0.1"); + ResponseMessage response = service.get("/"); + Assert.assertEquals(200, response.getStatus()); + Assert.assertTrue(firstLineIsXmlDtd(response.getContent())); + } + + @Test + public void testHttpServiceWithHostIPv6(){ + // IPv6 Host without the [] brackets + HttpService service = new HttpService("::1"); + ResponseMessage response = service.get("/"); + Assert.assertEquals(200, response.getStatus()); + Assert.assertTrue(firstLineIsXmlDtd(response.getContent())); + + // IPv6 Host with the [] brackets + HttpService newService = new HttpService("[::1]"); + ResponseMessage resp = newService.get("/"); + Assert.assertEquals(200, resp.getStatus()); + Assert.assertTrue(firstLineIsXmlDtd(resp.getContent())); + } + @Test public void testGet() { ResponseMessage response = httpService.get("/");