WebSocket CloseEvent reports code=1005 with nonempty reason

Issue #16138540 • Assigned to Steven K.

Details

Author
Felipe G.
Created
Feb 27, 2018
Privacy
This issue is public.
Found in
  • Microsoft Edge
Found in build #
38.14393
Reports
Reported by 1 person

Sign in to watch or report this issue.

Steps to reproduce

I’m developing a WebSocket application to run in a cPanel session, and I’m getting WebSocket CloseEvent objects that have a code of 1005, even when the server sends a valid response code (e.g., 1000 or 1011).

Curiously, the CloseEvent object still has the “reason” string from the close frame.

I opened the session in Fiddler and confirmed that the browser is receiving a close frame with a code (i.e., a non-empty close frame). The browser is sending an empty close frame back, though.

This doesn’t happen on all sites; for example, the WebSocket endpoints that connect on websocket.org don’t do this.

I observed the same behavior in IE11 (most recent Win10).

I’m still working on reproduction steps.

Attachments

1 attachment

Comments and activity

  • The attached perl script illustrates the bug.
    Just have Edge connect to the server, and monitor the connection in Fiddler. You’ll see that the server sends a close frame with code=1001 and reason="Hello.", but the browser will report to JavaScript that the code was 1005. (It does preserve the “reason”.)

  • You’ll need Net::WebSocket and HTTP::Request from CPAN to test this, by the way.

  • Microsoft Edge Team

    Changed Assigned To to “Steven K.”

You need to sign in to your Microsoft account to add a comment.

Sign in