Summary:ASTERISK-23099: [patch] WSS: enable ast_websocket_read() function to read the whole available data at first and then wait for any fragmented packets
Reporter:Thava Iyer (thava)Labels:
Date Opened:2014-01-05 19:27:21.000-0600Date Closed:2014-03-11 14:37:22
Versions:11.5.1 Frequency of
is related toASTERISK-21930 [patch]WebRTC over WSS is not working.
Environment:Linux, ChromeAttachments:( 0) ast_wss_r404720_v11_5_0.patch
Description:Asterisk websocket interface (res/res_http_websocket.c) works well for normal websockets (ws) but fails on secure - websockets (wss). The ast_websocket_read() function, first reads the header (14) bytes using first fread() call and then , for the remaining payload,  in a while loop, it first polls the raw-socket for the date before further reads. In the normal websocket, it is fine. But for the secure-websocket case, the underlying ssl_read() would have read the whole data, in the first fread() call (of course to decrypt ) and emptied the socket-fd. This would make the ast_websocket_read() to wait for data to appear on the socket.

This patch enables the ast_websocket_read() function to read the whole available data at first and then wait for any fragmented packets. This makes the secure-websocket connection to work properly.

This has been tested with  Chrome 31.0.1650.63.
Comments:By: Rusty Newton (rnewton) 2014-01-07 17:57:25.248-0600

@Thava, I think your patch is invisible because you probably attached it before you had a valid license. Please re-attach the patch now it that it appears you have a valid license. Thanks!

By: Thava Iyer (thava) 2014-01-07 18:39:51.668-0600

Rusty Newton,
Thanks, I've re-attched. But in view 'All' options, I can see both attachments.
I got a license issue msg that I need to use my company mail. Is there anyway to change the email address? Couldn't see the option in the profile?

By: Rusty Newton (rnewton) 2014-01-09 12:38:06.785-0600

Sorry about the confusion. I misread your profile, it does say "Has Valid License Agreement: False" Which means the license hasn't been accepted. That is likely due to the reasons sent to you in the E-mail from Digium's general counsel.

Basically. If you are submitting code on behalf of your company, then the license agreement and your E-mail should all be your company details, and if you are submitting code on behalf of yourself, it should all be your personal details.

If you need to modify the E-mail address in your profile, the easiest way will be to login with your current account to https://wiki.asterisk.org (which shares a user database with other Asterisk community sites) and edit your profile there. That change will be reflected for issues.asterisk.org, wiki.asterisk.org and code.asterisk.org. At the moment it doesn't appear you can edit your E-mail address from JIRA for whatever reason.

After you change your E-mail at wiki.asterisk.org, give it ten minutes or so to sync before you come back and fill out the license form in JIRA.

When your JIRA profile finally shows the "Has Valid License Agreement: True" then re-attach the patch to the JIRA issue. Then the patch will show up on the main view of the issue and be properly marked as submitted under license.

We'll look into making this easier in the future!

By: Rusty Newton (rnewton) 2014-01-09 13:17:27.625-0600

Remember to hit "Send Back" or "Enter Feedback" when you've got everything ready.

By: Rusty Newton (rnewton) 2014-01-10 09:56:41.951-0600

You can check your profile to see the status of the license. "Has Valid License Agreement: Pending"  You'll have to wait until it says True to re-post the patch.

By: Rusty Newton (rnewton) 2014-01-27 11:38:24.837-0600

I see that the patch was attached under a valid license. Thanks!

By: Matt Jordan (mjordan) 2014-01-31 11:49:17.237-0600

This patch is equivalent in purpose to ASTERISK-21930. It may be worthwhile for you and Moises to confer and determine which patch you feel is the better approach to solving this problem.

By: Matt Jordan (mjordan) 2014-03-04 16:41:29.100-0600

Just as a heads up, Moises's patch on ASTERISK-21930 was put up for review here - https://reviewboard.asterisk.org/r/3248/

It currently has a Ship It! - so I'd expect it to get committed reasonably soon. If you have any comments you want to make on it, you may want to make them there soon.