StompProtocolAndroid icon indicating copy to clipboard operation
StompProtocolAndroid copied to clipboard

Changed header pattern

Open boginw opened this issue 3 years ago • 6 comments

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

 

boginw avatar Sep 25 '20 20:09 boginw

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

([^:\s]+)\s*:\s*([^:\s]+)

forresthopkinsa avatar Sep 25 '20 23:09 forresthopkinsa

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.

boginw avatar Sep 26 '20 09:09 boginw

Ahh I understand. :+1:

forresthopkinsa avatar Sep 27 '20 01:09 forresthopkinsa

The PR now only includes the header change

boginw avatar Oct 16 '20 15:10 boginw

Can someone merge this and release a new version please?

kientux avatar Jan 13 '21 07:01 kientux

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

boginw avatar Sep 16 '21 08:09 boginw