Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/net/websocket: protocol implementation fails to respond to PingFrame without payload #7825

Closed
gopherbot opened this issue Apr 20, 2014 · 2 comments

Comments

@gopherbot
Copy link

by opennota:

RFC 6455 states, that Ping frame payload is optional:

    https://tools.ietf.org/html/rfc6455#section-5.5.2:

    A Ping frame MAY include "Application data".


However, the protocol implementation reads a frame using io.ReadFull, that returns
io.EOF error, if no bytes are read, and this io.EOF is treated as an error on the next
line.

The following patch solves this issue:

--- hybi.go.backup      2014-04-20 17:03:27.811047258 +0700
+++ hybi.go     2014-04-20 17:30:58.371147981 +0700
@@ -291,7 +291,7 @@
        case PingFrame:
                pingMsg := make([]byte, maxControlFramePayloadLength)
                n, err := io.ReadFull(frame, pingMsg)
-               if err != nil && err != io.ErrUnexpectedEOF {
+               if err != nil && err != io.ErrUnexpectedEOF && err !=
io.EOF {
                        return nil, err
                }                                                                                                    
                io.Copy(ioutil.Discard, frame)
@ianlancetaylor
Copy link
Contributor

Comment 1:

Please submit patches using the procedure documented in
http://golang.org/doc/contribute.html .  Thanks.

Labels changed: added repo-net, release-none.

@bradfitz bradfitz removed the new label Dec 18, 2014
@mikioh mikioh changed the title go.net/websocket: protocol implementation fails to respond to PingFrame without payload x/net/websocket: protocol implementation fails to respond to PingFrame without payload Dec 23, 2014
@mikioh mikioh added repo-net and removed repo-net labels Dec 23, 2014
@mikioh mikioh changed the title x/net/websocket: protocol implementation fails to respond to PingFrame without payload websocket: protocol implementation fails to respond to PingFrame without payload Jan 4, 2015
@rsc rsc added this to the Unplanned milestone Apr 10, 2015
@rsc rsc removed the release-none label Apr 10, 2015
@rsc rsc changed the title websocket: protocol implementation fails to respond to PingFrame without payload x/net/websocket: protocol implementation fails to respond to PingFrame without payload Apr 14, 2015
@rsc rsc modified the milestones: Unreleased, Unplanned Apr 14, 2015
@rsc rsc removed the repo-net label Apr 14, 2015
@gopherbot
Copy link
Author

CL https://golang.org/cl/13054 mentions this issue.

@golang golang locked and limited conversation to collaborators Aug 5, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants