This commit is contained in:
地平线
2015-09-10 10:05:11 +08:00
parent 29077870bc
commit ff9a8a6bf3

View File

@@ -362,6 +362,29 @@ public class WebSocketRunner implements Runnable {
private Logger logger;
/**
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-------+-+-------------+-------------------------------+
|F|R|R|R| opcode|M| Payload len | Extended payload length |
|I|S|S|S| (4) |A| (7) | (16/64) |
|N|V|V|V| |S| | (if payload len==126/127) |
| |1|2|3| |K| | |
+-+-+-+-+-------+-+-------------+ - - - - - - - - - - - - - - - +
| Extended payload length continued, if payload len == 127 |
+ - - - - - - - - - - - - - - - +-------------------------------+
| |Masking-key, if MASK set to 1 |
+-------------------------------+-------------------------------+
| Masking-key (continued) | Payload Data |
+-------------------------------- - - - - - - - - - - - - - - - +
: Payload Data continued :
+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +
| Payload Data continued |
+-----------------------------------------------------------------------+
@param buffer
@param exbuffers
@return
*/
public WebSocketPacket decode(final ByteBuffer buffer, ByteBuffer... exbuffers) {
final boolean debug = this.debugable;
if (debug) {
@@ -376,7 +399,8 @@ public class WebSocketRunner implements Runnable {
if (buffer.remaining() < 2) return null;
byte opcode = buffer.get();
final boolean last = (opcode & 0b1000000) != 0;
if (false && (opcode & 0b01110000) != 0) { //暂时不校验
final boolean checkrsv = false;//暂时不校验
if (checkrsv && (opcode & 0b01110000) != 0) {
if (debug) logger.log(Level.FINE, "rsv1 rsv2 rsv3 must be 0, but not (" + opcode + ")");
return null; //rsv1 rsv2 rsv3 must be 0
}