Skip to content

Commit b967cba

Browse files
committed
improved close code validation. Reserved but not (yet) used codes won't be treated as invalid.
1 parent 3028e0e commit b967cba

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/main/java/org/java_websocket/framing/CloseFrameBuilder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ private void initCloseCode() throws InvalidFrameException {
6868
bb.position( 0 );
6969
code = bb.getInt();
7070

71-
if( code == CloseFrame.ABNORMAL_CLOSE || code == CloseFrame.TLS_ERROR || code == CloseFrame.NOCODE || code > 4999 ) {
71+
if( code == CloseFrame.ABNORMAL_CLOSE || code == CloseFrame.TLS_ERROR || code == CloseFrame.NOCODE || code > 4999 || code < 1000 ) {
7272
throw new InvalidFrameException( "closecode must not be sent over the wire " + code );
7373
}
7474
}

0 commit comments

Comments
 (0)