Browse Source
Merge pull request #619 from Redliver/master
fix invalid namespace
master
Nikita Koksharov
6 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
18 additions and
1 deletions
-
src/main/java/com/corundumstudio/socketio/protocol/PacketDecoder.java
|
|
@ -279,7 +279,7 @@ public class PacketDecoder { |
|
|
|
if (packet.getType() == PacketType.MESSAGE) { |
|
|
|
if (packet.getSubType() == PacketType.CONNECT |
|
|
|
|| packet.getSubType() == PacketType.DISCONNECT) { |
|
|
|
packet.setNsp(readString(frame)); |
|
|
|
packet.setNsp(readNamespace(frame)); |
|
|
|
} |
|
|
|
|
|
|
|
if (packet.hasAttachments() && !packet.isAttachmentsLoaded()) { |
|
|
@ -309,5 +309,22 @@ public class PacketDecoder { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private String readNamespace(ByteBuf frame){ |
|
|
|
/** |
|
|
|
* namespace post request with url queryString, like |
|
|
|
* /message?a=1, |
|
|
|
* /message, |
|
|
|
*/ |
|
|
|
int endIndex = frame.bytesBefore((byte)'?'); |
|
|
|
if(endIndex > 0){ |
|
|
|
return readString(frame,endIndex); |
|
|
|
} |
|
|
|
endIndex = frame.bytesBefore((byte)','); |
|
|
|
if(endIndex > 0){ |
|
|
|
return readString(frame,endIndex); |
|
|
|
} |
|
|
|
return readString(frame); |
|
|
|
} |
|
|
|
|
|
|
|
} |