diff options
| author | Endi S. Dewata <edewata@redhat.com> | 2016-11-23 05:17:43 +0100 |
|---|---|---|
| committer | Endi S. Dewata <edewata@redhat.com> | 2016-11-23 21:10:27 +0100 |
| commit | 426f00afbdf73dde4c39d988e605dddaa5bb97ca (patch) | |
| tree | cd4d3abb052cf262942ceae6badedd897e0d034f /base/common/src/com | |
| parent | 3d186983fa91e5e16b8fc48f580248bca99035c9 (diff) | |
| download | pki-426f00afbdf73dde4c39d988e605dddaa5bb97ca.tar.gz pki-426f00afbdf73dde4c39d988e605dddaa5bb97ca.tar.xz pki-426f00afbdf73dde4c39d988e605dddaa5bb97ca.zip | |
Fixed problem with pki user-cert-add.
Previously the pki user-cert-add fails to check whether the server
has a CA subsystem when it's invoked over SSL. That is because the
CLI tries to establish a new but improperly set up SSL connection.
Now the CLI has been modified to use the existing server
connection.
https://fedorahosted.org/pki/ticket/1517
Diffstat (limited to 'base/common/src/com')
| -rw-r--r-- | base/common/src/com/netscape/certsrv/client/SubsystemClient.java | 28 |
1 files changed, 7 insertions, 21 deletions
diff --git a/base/common/src/com/netscape/certsrv/client/SubsystemClient.java b/base/common/src/com/netscape/certsrv/client/SubsystemClient.java index cbc17ac3f..bf329afcb 100644 --- a/base/common/src/com/netscape/certsrv/client/SubsystemClient.java +++ b/base/common/src/com/netscape/certsrv/client/SubsystemClient.java @@ -17,13 +17,9 @@ // --- END COPYRIGHT BLOCK --- package com.netscape.certsrv.client; -import java.net.URI; import java.net.URISyntaxException; -import org.apache.http.HttpResponse; -import org.apache.http.client.methods.HttpGet; -import org.apache.http.impl.client.CloseableHttpClient; -import org.apache.http.impl.client.HttpClientBuilder; +import javax.ws.rs.core.Response; import com.netscape.certsrv.account.AccountClient; @@ -52,22 +48,12 @@ public class SubsystemClient extends Client { public boolean exists() throws Exception { - ClientConfig config = client.getConfig(); - URI serverURI = config.getServerURI(); - URI subsystemURI = new URI( - serverURI.getScheme(), - null, - serverURI.getHost(), - serverURI.getPort(), - "/" + name, - null, - null); + PKIConnection connection = client.getConnection(); + Response response = connection.get("/" + name); - HttpGet method = new HttpGet(subsystemURI); - try (CloseableHttpClient client = HttpClientBuilder.create().build()) { - HttpResponse response = client.execute(method); - int code = response.getStatusLine().getStatusCode(); + try { + int code = response.getStatus(); if (code == 200) { return true; @@ -76,11 +62,11 @@ public class SubsystemClient extends Client { return false; } else { - throw new Exception("Error: " + response.getStatusLine()); + throw new Exception("Error: " + response.getStatusInfo()); } } finally { - method.releaseConnection(); + response.close(); } } |
