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

ws/wss scheme resolution? #59

Open
mjambon opened this issue Jun 3, 2016 · 1 comment
Open

ws/wss scheme resolution? #59

mjambon opened this issue Jun 3, 2016 · 1 comment

Comments

@mjambon
Copy link

mjambon commented Jun 3, 2016

I'm using the following code because the wss scheme doesn't seem to be supported by ocaml-conduit. I found the code for the Resolver_lwt.resolve_uri line in the tests subdirectory so I've been assuming it's proper usage.

let uri = Uri.of_string "wss://echo.websocket.org" in
Resolver_lwt.resolve_uri ~uri Resolver_lwt_unix.system

The result is a Conduit.endp of value ``Unknown "unknown scheme"` on my machine. Later, when I do this and it fails:

Conduit_lwt_unix.endp_to_client
  ~ctx:Conduit_lwt_unix.default_ctx (`Unknown "unknown scheme");;
Exception: Failure "resolution failed: unknown scheme".

Is this a problem with my usage, with ocaml-conduit, with ocaml-websocket, or is it something else?

The workaround I'm using consists in replacing wss by https in the URI as follows:

  let orig_uri = Uri.of_string ws_url in
  let uri = Uri.with_scheme orig_uri (Some "https") in
  ...
@vbmithr
Copy link
Owner

vbmithr commented Jun 5, 2016

I do the same as you. I use https instead of wss. I think it doesn't work because ws:// and wss:// are not real unix schemes, they are aliases for http/https (same ports) and are not in /etc/services.

I agree it would be good to have them work out of the box but after realizing that indeed ocaml-conduit does not support them I just did the same as you and used https.

The proper fix would be that ocaml-conduit correctly infer port 80/443 from ws/wss and don't complain. But I think they read /etc/services to have the mapping name -> port, and indeed ws and wss are not in /etc/services.

What do you think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants