Issue #1568 handle query strings with encoded characters
This commit is contained in:
parent
78280d0595
commit
50500ac99d
|
@ -45,7 +45,7 @@ public final class WSURI
|
||||||
if ("http".equalsIgnoreCase(wsScheme) || "https".equalsIgnoreCase(wsScheme))
|
if ("http".equalsIgnoreCase(wsScheme) || "https".equalsIgnoreCase(wsScheme))
|
||||||
{
|
{
|
||||||
// leave alone
|
// leave alone
|
||||||
return inputUri; // TODO should this be cloned?
|
return new URI(inputUri.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
if ("ws".equalsIgnoreCase(wsScheme))
|
if ("ws".equalsIgnoreCase(wsScheme))
|
||||||
|
@ -117,26 +117,24 @@ public final class WSURI
|
||||||
{
|
{
|
||||||
Objects.requireNonNull(inputUri,"Input URI must not be null");
|
Objects.requireNonNull(inputUri,"Input URI must not be null");
|
||||||
String httpScheme = inputUri.getScheme();
|
String httpScheme = inputUri.getScheme();
|
||||||
String wsScheme = null;
|
|
||||||
if ("ws".equalsIgnoreCase(httpScheme) || "wss".equalsIgnoreCase(httpScheme))
|
if ("ws".equalsIgnoreCase(httpScheme) || "wss".equalsIgnoreCase(httpScheme))
|
||||||
{
|
{
|
||||||
// keep as-is
|
// keep as-is
|
||||||
wsScheme = httpScheme;
|
return new URI(inputUri.toString());
|
||||||
}
|
}
|
||||||
else if ("http".equalsIgnoreCase(httpScheme))
|
|
||||||
|
if ("http".equalsIgnoreCase(httpScheme))
|
||||||
{
|
{
|
||||||
// convert to ws
|
// convert to ws
|
||||||
wsScheme = "ws";
|
return new URI("ws"+inputUri.toString().substring(4));
|
||||||
}
|
}
|
||||||
else if ("https".equalsIgnoreCase(httpScheme))
|
|
||||||
|
if ("https".equalsIgnoreCase(httpScheme))
|
||||||
{
|
{
|
||||||
// convert to wss
|
// convert to wss
|
||||||
wsScheme = "wss";
|
return new URI("wss"+inputUri.toString().substring(5));
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
throw new URISyntaxException(inputUri.toString(),"Unrecognized HTTP scheme");
|
throw new URISyntaxException(inputUri.toString(),"Unrecognized HTTP scheme");
|
||||||
}
|
}
|
||||||
return new URI(wsScheme,inputUri.getUserInfo(),inputUri.getHost(),inputUri.getPort(),inputUri.getPath(),inputUri.getQuery(),inputUri.getFragment());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue