elixir-socket icon indicating copy to clipboard operation
elixir-socket copied to clipboard

Some advanced SSL options to web connection functions

Open Guid75 opened this issue 9 years ago • 5 comments

Hi,

I need to pass some advanced SSL options (like cert, key, etc) to the websocket module connection functions but it seems to be currently not possible. So I just patched the Socket.Web module to transmit a new optional "ssl_options" (via the connect! function) down to the Socket.SSL module and it seems to work but it's a bit quick'n'dirty for now and before going further and propose a PR, I would like to know if I'm on a good track or if it's something that would interest somebody else than me?

Guid75 avatar Nov 29 '16 22:11 Guid75

It would make sense to just remove the websocket specific options, then pass the given options over to the underlying socket type.

I'm working on this myself now because option handling is kind of complicated.

meh avatar Nov 29 '16 23:11 meh

@Guid75 can you try on master? Just pass the SSL/TCP options along with the other (if any) websocket options.

meh avatar Nov 29 '16 23:11 meh

Sorry for the late answer. I just read the master version of web.ex but I think it will be hard to handle options name conflict. For instance, key is used as a websocket option and as a SSL layer options as well. Maybe a more explicit strategy could allow to separate the local options from the global ones? A new option named transport_options that could be directly passed to the underlying layer? If that's fine for you, I could propose a PR. Let me know.

Guid75 avatar Dec 05 '16 21:12 Guid75

key is the only conflict, I'd rather rename it instead of having an indirection layer in the options, that's for consistence with the TCP and SSL APIs, they pass through the options of the layer below them.

meh avatar Dec 05 '16 21:12 meh

About consistency, the bigger issue here is that you'll have to compose with some underlying layer options named differently than the original ones when they are passed through the web API. But that would be fine for me as I could use this library in my context :).

Guid75 avatar Dec 06 '16 08:12 Guid75