Handle V4 base64 packets with line breaks gracefully #66
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Some socket.io client libraries, such as engine.io-client-java, include a line break in the base64 encoded binary V4 packets. Other server implementations (such as the nodejs module) handle this gracefully, this one currently throws an exception due to that unexpected char.
Adding logic to handle that gracefully since other servers do it, and to be compatible with older versions of libraries even if we were to change that behavior in the client.
engine.io-client-java reference (if they passed Base64.NO_WRAP we'd be fine...)
https://github.com/socketio/engine.io-client-java/blob/8519952a51baff36a2844d726876266b37ad6ffe/src/main/java/io/socket/engineio/parser/Parser.java#L46C21-L46C21
Note: There might be a better place earlier in the packet parsing logic that's more appropriate to handle this, I haven't read through the earlier stages, hoping someone can advise on that.