https://issues.apache.org/bugzilla/show_bug.cgi?id=54628

            Bug ID: 54628
           Summary: there is something wrong when send binary data by
                    websocket.
           Product: Tomcat 7
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Catalina
          Assignee: dev@tomcat.apache.org
          Reporter: b....@foxmail.com
    Classification: Unclassified

there is something wrong when send binary data by websocket.

see org.apache.catalina.websocket.WsOutbound.doWriteBytes(ByteBuffer, boolean)

I think 

// Write the content
        upgradeOutbound.write(buffer.array(), 0, buffer.limit());
        upgradeOutbound.flush();

should change to :

// Write the content
        upgradeOutbound.write(buffer.array(), buffer.arrayOffset(),
buffer.limit());
        upgradeOutbound.flush();


For example:
byte[] bts = new byte[]{1,2,3,4,5}
ByteBuffer bf = ByteBuffer.wrap(bts, 2, 2);
out.writeBinaryMessage(bf);

I mean write [3,4] to the client, but in fact [1,2,3,4] be sent;

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to