NaikSoftware / StompProtocolAndroid

STOMP protocol via WebSocket for Android
MIT License
597 stars 265 forks source link

Changed header pattern #186

Open boginw opened 4 years ago

boginw commented 4 years ago

According to the STOMP protocol specification 1.2; each header should be terminated with an EOL. Currently, the regex for headers stops if it sees a :. This pull request fixes the regex.

An example of a message that the current implementation can't handle is shown below:

ERROR
message:Failed to send message to ExecutorSubscribableChannel[clientInboundChannel]; nested exception is org.springframework.security.access.AccessDeniedException\c Access is denied
content-length:0
forresthopkinsa commented 4 years ago

The regex currently includes a colon in the middle to address standard headers like the example you gave:

([^:\s]+)\s*:\s*([^:\s]+)
boginw commented 4 years ago

Yes, and that is fine. The issue is the second group. Please see the following link, with the original regex and the body given in the example : regexr.com/5crbl. There you'll notice, that only the first word is recognized. What this PR does, is to capture the second group fully, by only terminating on a newline, instead of a colon.

forresthopkinsa commented 4 years ago

Ahh I understand. :+1:

boginw commented 4 years ago

The PR now only includes the header change

kientux commented 3 years ago

Can someone merge this and release a new version please?

boginw commented 3 years ago

@NaikSoftware this issue is still present. Would you be so kind to review and merge this branch?