duda icon indicating copy to clipboard operation
duda copied to clipboard

Web Sockets package does not work with SSL.

Open domenipavec opened this issue 11 years ago • 4 comments

To reproduce the problem:

  • compile wschat example with SSL
  • change javascript to connect to wss://...
  • open 2 tabs of chat and write a message

Output I get:

Monkey HTTP Daemon 1.4.0
Built : Aug 13 2014 22:11:35 (gcc 4.6.3)
Home  : http://monkey-project.com
[2014/08/13 22:43:10] [   Info] Linux TCP_FASTOPEN enabled.
* Process ID is 9438
* Server socket listening on Port 2001
* 1 threads, 508 client connections per thread, total 508
* Transport layer by polarssl in https mode
[2014/08/13 22:43:10] [   Info] Duda: loading service 'wschat'
[2014/08/13 22:43:10] [   Info] HTTP Server started
[FD 16] WebSockets Connection Upgrade
[FD 16] WebSockets Upgrade to 'websocket'
[FD 14] WebSockets Connection Upgrade
[FD 14] WebSockets Upgrade to 'websocket'
monkey: polarssl.c:587: context_new: Assertion `cur != ((void *)0)' failed.

domenipavec avatar Aug 13 '14 22:08 domenipavec

please copy/paste your plugins.load

edsiper avatar Aug 13 '14 22:08 edsiper

note: upgrading to Monkey v1.6 this will not longer be an issue as the network I/O operations and Streams are handled directly by the monkey run time, duda will not longer issue a direct 'write'.

edsiper avatar Jul 04 '15 12:07 edsiper

Which version exactly are you saying works with this?

Which of the build processes should I use?

The recommended approach is using Dudac and dst-1, but that is Monkey 1.4 Are you saying modify dudac to checkout 1.6 instead of dst-1? Have you tried this?

mr-mop avatar May 02 '18 11:05 mr-mop

OK having dug into this a little, the problem seems to be in the broadcast worker thread of the websocket package of Duda. The ws_broadcast_worker() will make a direct call to ws_write() but when it gets as far as sending over an SSL/TLS socket, the broadcast worker thread has no TLS context, so is unable to access the local_context pthread key.

I'm not exactly sure how to resolve this at the moment, but thought I'd share the info in case its useful.

If I find anything more, I'll update this.

mr-mop avatar May 16 '18 13:05 mr-mop