mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2024-11-05 05:46:44 +00:00
strip path from server url when determining host and port
This commit is contained in:
parent
48b3dbc353
commit
dd3b980c36
1 changed files with 3 additions and 1 deletions
|
@ -129,7 +129,9 @@ public enum Protocol {
|
||||||
public abstract CloseableTransport getTransport(HostAndPort server, File serverCert, HostAndPort proxy) throws IOException, CertificateException, NoSuchAlgorithmException, KeyStoreException, KeyManagementException;
|
public abstract CloseableTransport getTransport(HostAndPort server, File serverCert, HostAndPort proxy) throws IOException, CertificateException, NoSuchAlgorithmException, KeyStoreException, KeyManagementException;
|
||||||
|
|
||||||
public HostAndPort getServerHostAndPort(String url) {
|
public HostAndPort getServerHostAndPort(String url) {
|
||||||
return HostAndPort.fromString(url.substring(this.toUrlString().length()));
|
String lessProtocol = url.substring(this.toUrlString().length());
|
||||||
|
int pathStart = lessProtocol.indexOf('/');
|
||||||
|
return HostAndPort.fromString(pathStart < 0 ? lessProtocol : lessProtocol.substring(0, pathStart));
|
||||||
}
|
}
|
||||||
|
|
||||||
public String toUrlString() {
|
public String toUrlString() {
|
||||||
|
|
Loading…
Reference in a new issue