[147] Websocket defines protocol when not required

Bugs will be moved here once resolved.

Post » Sun Oct 13, 2013 12:47 pm

Link to .capx file (required!):
https://docs.google.com/file/d/0By_A2aN9Y8fyZjdQdHNSUDJOYUE/edit?usp=sharing

Steps to reproduce:
1. Make sure Chrome Debug Tools are enabled (or different browser equivalent, you need to make sure you can view the headers)
2. Run the capx. It will try to connect to the echo server (echo.websocket.org)
3. On Chrome, open the Inspector and go to Network. Filter the results to Websocket. If there are no entries, refresh the page.

Observed result:
C2Websocket defines the Sec-Websocket-Protocol header as undefined. This results in a header mismatch with servers that do not define a protocol.

Expected result:
Similar to the case of www.websocket.org/echo.html, Sec-Websocket-Protocol should not exist in the request headers, unless defined. This can be verified by using the above steps on the websocket.org echo page

Browsers affected:
Chrome: yes

Operating system & service pack:
Windows 7

Construct 2 version:
r147 and r146
B
10
S
2
Posts: 94
Reputation: 1,536

Post » Sun Oct 13, 2013 4:45 pm

The problem was with <C2PluginRoot>/websocket/runtime.js:142 :

this.ws = new WebSocket(url_, requireProtocol_ === "" ? undefined : requireProtocol_)

Replacing this line with the more verbose:

if (requireProtocol_ === "") this.ws = new WebSocket(url_);
else this.ws = new WebSocker(url_, requireProtocol_);

fixes the problem in question, but I'll leave the fix up to you guys.
Sorry if I wasn't supposed to do that :/
B
10
S
2
Posts: 94
Reputation: 1,536

Post » Fri Oct 18, 2013 7:38 pm

Thanks, should be fixed in the next build.
Scirra Founder
B
395
S
233
G
88
Posts: 24,376
Reputation: 193,842


Return to Closed bugs

Who is online

Users browsing this forum: No registered users and 3 guests