Skip to content

Commit

Permalink
BZ-1250323 - Not able to register KIE server if we use https protocol
Browse files Browse the repository at this point in the history
- closes #186
  • Loading branch information
mswiderski authored and Marco Rietveld committed Sep 23, 2015
1 parent fbac57d commit 6bcb887
Showing 1 changed file with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -851,6 +851,19 @@ private HttpURLConnection createConnection() {
} else {
connection = CONNECTION_FACTORY.create(getRequestInfo().getRequestUrl());
}
// support for localhost and https
if (getRequestInfo().getRequestUrl().getProtocol().equalsIgnoreCase("https") && getRequestInfo().getRequestUrl().getHost().equalsIgnoreCase("localhost")) {
((HttpsURLConnection) connection).setHostnameVerifier(new HostnameVerifier(){

public boolean verify(String hostname, javax.net.ssl.SSLSession sslSession) {
if (hostname.equalsIgnoreCase("localhost")) {
return true;
}
return false;
}
});
}

connection.setRequestMethod(getRequestInfo().requestMethod);
return connection;
} catch( IOException ioe ) {
Expand Down

3 comments on commit 6bcb887

@mrietveld
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mswiderski I've merged and cherry-picked this to 6.3.x and 6.2.x.

However, if you could write some sort of basic tests for this, that would be appreciated!

@mswiderski
Copy link
Contributor Author

@mswiderski mswiderski commented on 6bcb887 Sep 24, 2015 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mrietveld
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maciej, go back to your vacation! ;D

Ahh, good to know that you would prefer to stick to this. Then we'll do that for the time being.

I just want a unit test for the logic, I'll see if there's an easy way to use simple to do this.

Here's an example of configuring Simple to use SSL. A test that starts a SSL Simple instance and then uses the KieRemoteHttpRequest to connect to it would be fine.

Please sign in to comment.