Skip to content
This repository has been archived by the owner on Aug 13, 2018. It is now read-only.

opcodes are incorrect #70

Open
tdhsmith opened this issue Jan 6, 2017 · 4 comments
Open

opcodes are incorrect #70

tdhsmith opened this issue Jan 6, 2017 · 4 comments

Comments

@tdhsmith
Copy link

tdhsmith commented Jan 6, 2017

My connections seem to have incorrectly flagged opcodes/frame types. All of the outgoing frames are marked TEXT (opcode 0x1) and all the incoming frames are marked CONTINUATION (opcode 0x0), regardless of ground truth.

Here are the same 4 frames, shown first in the socket monitor and then in wireshark:
screen shot 2017-01-06 at 2 09 57 pm
screen shot 2017-01-06 at 2 20 21 pm
As seen in the right column, their true values are TEXT, TEXT, TEXT, BINARY, which was confirmed by dissection as well.

I understand it is likely an underlying issue and not one with this package itself, but I wanted to file the issue while I was dealing with it to investigate later. (Would this again be stemming from the SDK or from something closer to FF internals?)

@tdhsmith
Copy link
Author

tdhsmith commented Jan 6, 2017

Actually I'm just realizing the inaccuracies are a bit larger than that:

  • all frames are marked as having maskBit=true when they aren't (in my case messages from the server are being sent unmasked)
  • disconnect frame is displayed as raw text with the reason code appended to the front. For example �ëonly text frames are supported, where the gibberish 0x03eb on the front should be parsed as reason code=1003.

(I don't have the capability right now to modify my stack to send true continuation frames with finBit=0, so I can't verify if the finBit is parsing correctly or not.)

@eliihen
Copy link
Member

eliihen commented Jan 6, 2017

Yeah, the entire frame, including the metadata like opcode, comes from the Firefox API we're using to read websockets. We pretty much only map that to a string. I can't really give any info on the Firefox API because I haven't been that deep.

Let's try pinging @bakulf, he seems knowledgeable on the matter.

@bakulf
Copy link

bakulf commented Jan 12, 2017

Can I have a testcase? I would like to test it locally. @esphen, thanks.

@tdhsmith
Copy link
Author

tdhsmith commented Jan 18, 2017

Here's a quick demonstration server in NodeJS, if that helps. Sorry for the messy code; threw it together on lunch break.

https://gist.github.com/tdhsmith/8e71aba02c684f549cdec05761e6e87b

You'll need to install ws first. Run the server with node server.js then browse to http://localhost:3000/ and the browser and client will each send a variety of frame types.

Here's what I see:

Server

-> TEXT         (0x1); MASKED
-> BINARY       (0x2); MASKED
<- BINARY       (0x2); unmasked
<- PING         (0x9); unmasked
<- PONG         (0xA); unmasked
<- TEXT         (0x1); unmasked
<- CONTINUATION (0x0); unmasked
<- CLOSE        (0x8)
-> PONG         (0xA); MASKED
-> CLOSE        (0x8)

(note that the ordering of the last few is off slightly due to when I'm calling the log commands relative to the actual message queue)

WireShark

screen shot 2017-01-18 at 11 43 10 am

Raw capture file is available in the gist above.

websocket-monitor

screen shot 2017-01-18 at 11 46 39 am

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

No branches or pull requests

3 participants