Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Force client to use the valid schema #1026

Closed
yindex opened this issue May 18, 2020 · 1 comment · Fixed by #1025
Closed

Force client to use the valid schema #1026

yindex opened this issue May 18, 2020 · 1 comment · Fixed by #1025

Comments

@yindex
Copy link

yindex commented May 18, 2020

Is your feature request related to a problem? Please describe.

Yes.

When I use the invalid schema(https, http) with explicit port in uri

//dev config, host=domain:port

String url = String.format("http:https://%s/%s", host, "websocket");

ws = new WebSocketClient(new URI(url)) 

MayBe, I can't find the potential the problem, because it can run without exception.

But, it will failed when we omit the port in uri. and It will throw an exception:"unkown schema http"

// prod config, host=domain

String url = String.format("http:https://%s/%s", host, "websocket");

ws = new WebSocketClient(new URI(url)) `

I'm alway frustrated when run failed only with different config in prod environment.

I think we should allow user to find the potential problem during development.

Describe the solution you'd like

always check the schema and throw exception on invalid schema, regardless whether the port is explicit set(no matter uri.getPort() == -1).

@marci4
Copy link
Collaborator

marci4 commented May 23, 2020

@yindex thx for creating the issue.

@marci4 marci4 added this to the Release 1.5.2 milestone May 23, 2020
yindex pushed a commit to yindex/Java-WebSocket that referenced this issue May 23, 2020
add unit test for schema check
yindex pushed a commit to yindex/Java-WebSocket that referenced this issue May 23, 2020
@marci4 marci4 added the Bug label May 24, 2020
@marci4 marci4 changed the title force user to use the valid schema Force user to use the valid schema May 24, 2020
@marci4 marci4 changed the title Force user to use the valid schema Force client to use the valid schema May 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants