lua-resty-rabbitmqstomp
lua-resty-rabbitmqstomp copied to clipboard
[BUG]The definition of LF, EOL, NULL_BYTE is wrong
In rabbitmqstomp.lua: local LF = "\x0a" local EOL = "\x0d\x0a" local NULL_BYTE = "\x00"
However, they do not work properly. They should be:
local LF = "\n" local EOL = "\r\n" local NULL_BYTE = "\0"
Hi @gokoushiro thanks for raising the issue, the above configuration has been working for us and others for quite some time now.
Is there a way you can tell us how to reproduce this issue or some code sample where this might fail.
On my vmware Ubuntu 16.04 , openresty 1.9.4.7 with lua5.1,
I cannot connect to the rabbitmq-server in my lua script, always got "timeout".
And then I found when connecting to the rabbitmq-server, in function _build_frame I got "CONNECTx0dx0aaccept-version:1.2x0dx0ahost:/x0dx0alogin:guestx0dx0apasscode:guestx0dx0ax0dx0ax00x0dx0a"
The escape character "\x" seems not working. But when I change them, the connecting succeed.
I also ran into this issue where the \x .. characters were also not converting to their proper encoding equivalents. It may be related to environment issues such as different Lua versions and settings so I've made changes here (mainly in the escaped characters constants and changes to the build_frame function) such that it should work for version 5.1.
If you have the same issue as described above, try my lua script at https://github.com/Loc-Tran/lua-resty-rabbitmqstomp
I was notably using Openresty in CentOS as well so it might be related to that too...