Fixing confusing wss -> https case
This commit is contained in:
parent
c9c284f432
commit
ae496051de
|
@ -45,19 +45,19 @@ public final class WSURI
|
|||
if ("http".equalsIgnoreCase(wsScheme) || "https".equalsIgnoreCase(wsScheme))
|
||||
{
|
||||
// leave alone
|
||||
return new URI(inputUri.toString());
|
||||
return inputUri;
|
||||
}
|
||||
|
||||
if ("ws".equalsIgnoreCase(wsScheme))
|
||||
{
|
||||
// convert to http
|
||||
return new URI("http"+inputUri.toString().substring(2));
|
||||
return new URI("http" + inputUri.toString().substring(wsScheme.length()));
|
||||
}
|
||||
|
||||
if ("wss".equalsIgnoreCase(wsScheme))
|
||||
{
|
||||
// convert to https
|
||||
return new URI("http"+inputUri.toString().substring(2));
|
||||
return new URI("https" + inputUri.toString().substring(wsScheme.length()));
|
||||
}
|
||||
|
||||
throw new URISyntaxException(inputUri.toString(),"Unrecognized WebSocket scheme");
|
||||
|
@ -126,13 +126,13 @@ public final class WSURI
|
|||
if ("http".equalsIgnoreCase(httpScheme))
|
||||
{
|
||||
// convert to ws
|
||||
return new URI("ws"+inputUri.toString().substring(4));
|
||||
return new URI("ws" + inputUri.toString().substring(httpScheme.length()));
|
||||
}
|
||||
|
||||
if ("https".equalsIgnoreCase(httpScheme))
|
||||
{
|
||||
// convert to wss
|
||||
return new URI("wss"+inputUri.toString().substring(5));
|
||||
return new URI("wss" + inputUri.toString().substring(httpScheme.length()));
|
||||
}
|
||||
|
||||
throw new URISyntaxException(inputUri.toString(),"Unrecognized HTTP scheme");
|
||||
|
|
Loading…
Reference in New Issue