Bug 35571

Summary: WebSocket bufferedAmount doesn't include framing overhead
Product: WebKit Reporter: Fumitoshi Ukai <ukai>
Component: WebCore JavaScriptAssignee: Fumitoshi Ukai <ukai>
Status: RESOLVED WONTFIX    
Severity: Normal CC: ap, joenotcharles, tyoshino
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Attachments:
Description Flags
Patch
none
Patch none

Description Fumitoshi Ukai 2010-03-02 03:08:27 PST
WebSocket spec draft says WebSocket bufferedAmount doesn't include framing overhead incurred by the protocol.
http://lists.whatwg.org/pipermail/commit-watchers-whatwg.org/2010/003971.html
Comment 1 Fumitoshi Ukai 2010-03-02 20:53:56 PST
Created attachment 49876 [details]
Patch
Comment 2 Alexey Proskuryakov 2010-03-03 14:20:14 PST
Comment on attachment 49876 [details]
Patch

Isn't 0x00 allowed to be inside of message text? 0xff can never occur in UTF-8, but 0x00 can be there.

It seems that if bufferedAmount() is going to parse the buffer, then it should have a state machine, and also ASSERT that it knows about the current frame type. I don't know how to reasonably implement that, since the buffer won't necessarily start on frame boundary.

But also, this seems quite slow, perhaps it would be better to store data size separately (again, it can be a challenge to update properly). Or even to try and get the spec changed back per implementor feedback.

Do we have a test checking how null characters go over WebSocket?
Comment 3 Fumitoshi Ukai 2010-03-03 18:41:34 PST
(In reply to comment #2)
> (From update of attachment 49876 [details])
> Isn't 0x00 allowed to be inside of message text? 0xff can never occur in UTF-8,
> but 0x00 can be there.

Oh, i missed that case.

> It seems that if bufferedAmount() is going to parse the buffer, then it should
> have a state machine, and also ASSERT that it knows about the current frame
> type. I don't know how to reasonably implement that, since the buffer won't
> necessarily start on frame boundary.
> 
> But also, this seems quite slow, perhaps it would be better to store data size
> separately (again, it can be a challenge to update properly). Or even to try
> and get the spec changed back per implementor feedback.

Yes, I prefer previous spec.  I'll ask the spec changed back.

> Do we have a test checking how null characters go over WebSocket?

Not yet.
I'll add.
Comment 4 Fumitoshi Ukai 2010-03-05 02:15:02 PST
Created attachment 50093 [details]
Patch
Comment 5 Alexey Proskuryakov 2010-03-05 12:25:57 PST
I'm not sure if we want to make this change even if we can't get the spec changed back.
Comment 6 Alexey Proskuryakov 2010-03-29 14:48:41 PDT
Comment on attachment 50093 [details]
Patch

This doesn't currently need review, removing the flag. The behavior of bufferedAmount is still being actively discussed on whatwg mailing list.
Comment 7 Takeshi Yoshino 2013-04-08 23:03:20 PDT
The patch is obsolete (for Hixie 75 style framing).

Needs discussion on the spec. Maybe reopening https://www.w3.org/Bugs/Public/show_bug.cgi?id=9083 if necessary.

Marking this bug as WONTFIX for now.