Closed Bug 1808405 Opened 2 years ago Closed 2 years ago

Can't send 0-length arrays over RTCDataChannel

Categories

(Core :: WebRTC: Networking, defect, P2)

defect

Tracking

()

RESOLVED DUPLICATE of bug 1315782

People

(Reporter: jesup, Unassigned)

References

()

Details

We can't send 0-length arrays/strings over DataChannels, and this is a known-fail for the WPT tests:
RTCDataChannel-send: "should be able to send an empty string and receive an empty string"
We fail in netwerk/sctp/src/netinet/sctp_output.c:13905 where it returns EINVAL if we pass a 0-length buffer to usrsctp_sendv().

Using https://jsfiddle.net/jib1/fsba41mn/48/show in Chrome and MOZ_LOG_FILE=/c/tmp/jib.log MOZ_LOG=DataChannel:5 mach run, I established a connection and first sent "HelloWorld" from Chrome to Firefox:

[Child 31152: Socket Thread]: D/DataChannel In receive_cb, ulp_info=1
[Child 31152: Socket Thread]: D/DataChannel In ReceiveCallback
[Child 31152: Socket Thread]: D/DataChannel DataChannel: Received string message of length 10 on channel 0
[Child 31152: Socket Thread]: D/DataChannel HandleDataMessage: sending ON_DATA_STRING for 1126f12e0
[Child 31152: Main Thread]: V/DataChannel DoOnMessageAvailable
[Child 31152: Main Thread]: D/DataChannel 1126cc340(1126f12e0): DoOnMessageAvailable - Dispatching

...followed by "":

[Child 31152: Socket Thread]: D/DataChannel In receive_cb, ulp_info=1
[Child 31152: Socket Thread]: D/DataChannel In ReceiveCallback
[Child 31152: Socket Thread]: E/DataChannel Unhandled message of length 1 PPID 56 on stream 0 received (complete).

In the latter case, no onmessage is fired on JS in Firefox, while in Chrome<->Chrome it is.

Severity: -- → S3
Priority: -- → P2

So Chrome is using a PPID of 56 instead of 51 to send empty string. Safari does the same.

From upstream:

kStringEmpty = 56,
kBinaryEmpty = 57,

Status: NEW → RESOLVED
Closed: 2 years ago
Duplicate of bug: 1315782
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.