Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Initialization fix #71

Merged
merged 3 commits into from

2 participants

@phedny

I fixed some bugs that occurred when initializing StdHttpClient, see the included commits for details.

@helun helun merged commit b376461 into helun:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 16 additions and 0 deletions.
  1. +16 −0 org.ektorp/src/main/java/org/ektorp/http/StdHttpClient.java
View
16 org.ektorp/src/main/java/org/ektorp/http/StdHttpClient.java
@@ -190,7 +190,21 @@ public Builder url(String s) throws MalformedURLException {
public Builder url(URL url){
this.host = url.getHost();
this.port = url.getPort();
+ if (url.getUserInfo() != null) {
+ String[] userInfoParts = url.getUserInfo().split(":");
+ if (userInfoParts.length == 2) {
+ this.username = userInfoParts[0];
+ this.password = userInfoParts[1];
+ }
+ }
enableSSL("https".equals(url.getProtocol()));
+ if (this.port == -1) {
+ if (this.enableSSL) {
+ this.port = 443;
+ } else {
+ this.port = 80;
+ }
+ }
return this;
}
@@ -270,6 +284,8 @@ public void checkServerTrusted(
String authType) {
}
} }, null);
+ } else {
+ context.init(null, null, null);
}
sslSocketFactory = relaxedSSLSettings ? new SSLSocketFactory(context, SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER) : new SSLSocketFactory(context);
Something went wrong with that request. Please try again.