New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HTTP calls do not work with lua 5.4.3 #331
Comments
|
I can also confirm that this got broken in lua 5.4.3 and used to work with lua 5.4.0 - 5.4.2 To do this those lua versions were locally compiled and tested against. |
|
The fix is easy: all Unfortunately this issue affects all clients that use |
…n receive(). This is the same issue that was fixed in MIME code in f329aae. Closes lunarmodules#331.
I tried haproxytech / haproxy-lua-http which use |
|
@atealxt, I'm not sure where this error is coming from, but try specifying an empty string as the second parameter (the prefix) to see if this helps: |
|
the default parameter for receive is not working |
|
Finally, after update buffer.c file to the one as mentioned on brunoos/luasec@34252fb or download buffer.c from https://github.com/brunoos/luasec/tree/master/src/luasocket (v1.0.2), this will make luasocket work with Lua 5.4.3. On my Windows 10 Pro setup at c:\msys64\mingw64, I have to modify the src/makefile to remove /lua from LDIR_mingw?=lua/$(LUAV)/lua so that it is the same as CDIR_mingw?=lua/$(LUAV), so that it has the "directory structure" of https://w3.impa.br/~diego/software/luasocket/installation.html I have also issued below for build & install:- Note1: If mingw was specified, the makefile should have already defined the correct directories, not having user to specify any other locations. |
|
Could this be a bug in Lua 5.4 itself? |
|
Oh, or is it choking on the |
It seems that on Lua 5.4 when calling conn:receive() without arguments, a lightuserdata related to the luaL_Buffer ends up in position 2. Since this is not a number, luaL_optstring() complains.
|
@pkulchenko Oh sorry I must have scrolled past that PR. Subtly different behavior from what I did tho. |
|
Before #334 get merged, we can use @pkulchenko 's fork to install, I made a gist: |
|
will this ever be patched or is luasocket abandoned? |
|
@Nomarian It's not quite abandoned. Per #292 the original author is interested in another maintainer stepping up. I'm interested in doing that and we have several other people who are willing to help, but so far they haven't pulled the trigger and passed the buck. I do hope to get this patched up — this issue in particular has started to break some of my old projects and needs fixing urgently. |
- Bump supported lua versions Lua version 5.1 and up are all widely used across the Lua ecosystem, therefor supporting Lua >= 5.1 is preferable. - Replace luasocket with lua-curl Luasocket is likely a simplier option, as on mac/brew, the CURL_DIR flag is required for luacurl to be able to find curl, however luasocket currently cannot make HTTP requests with Lua >= 5.4.3: lunarmodules/luasocket#331 lua-curl is a suitable alternative. - Replace bit + base64 modules with base64 package The bit module, which base64 relied on, was throwing an error while running the base64 test file. As these were files copied from github with no newer versions, both lib/bit.lua and lib/base64.lua have been replaced with the base64 package: https://github.com/iskolbin/lbase64 There are two differences: 1. The base64 package adds padding, whereas the previous implementation didn't - this doesn't matter however, as the collector doesn't care if padding is present in base64 2. The previous implemenation threw an error when trying to encode an empty string, this behaviour has been replaced by checking for an empty string on the variable passed into base64.encode
Bump supported lua versions Lua version 5.1 and up are all widely used across the Lua ecosystem, therefor supporting Lua >= 5.1 is preferable. Replace luasocket with lua-curl Luasocket is likely a simplier option, as on mac/brew, the CURL_DIR flag is required for luacurl to be able to find curl, however luasocket currently cannot make HTTP requests with Lua >= 5.4.3: lunarmodules/luasocket#331 lua-curl is a good alternative. Replace bit + base64 modules with base64 package The bit module, which base64 relied on, was throwing an error while running the base64 test file. As these were files copied from github with no newer versions, both lib/bit.lua and lib/base64.lua have been replaced with the base64 package: https://github.com/iskolbin/lbase64 There are two differences: 1. The base64 package adds padding, whereas the previous implementation didn't - this doesn't matter however, as the collector doesn't care if padding is present in base64 2. The previous implemenation threw an error when trying to encode an empty string, this behaviour has been replaced by checking for an empty string on the variable passed into base64.encode Update set and fix tests Make :toString() return in key sorted order, for use in error message comparison
Bump supported lua versions Lua version 5.1 and up are all widely used across the Lua ecosystem, therefor supporting Lua >= 5.1 is preferable. Replace luasocket with lua-curl Luasocket is likely a simplier option, as on mac/brew, the CURL_DIR flag is required for luacurl to be able to find curl, however luasocket currently cannot make HTTP requests with Lua >= 5.4.3: lunarmodules/luasocket#331 lua-curl is a good alternative. Replace bit + base64 modules with base64 package The bit module, which base64 relied on, was throwing an error while running the base64 test file. As these were files copied from github with no newer versions, both lib/bit.lua and lib/base64.lua have been replaced with the base64 package: https://github.com/iskolbin/lbase64 There are two differences: 1. The base64 package adds padding, whereas the previous implementation didn't - this doesn't matter however, as the collector doesn't care if padding is present in base64 2. The previous implemenation threw an error when trying to encode an empty string, this behaviour has been replaced by checking for an empty string on the variable passed into base64.encode Update set and fix tests Make :toString() return in key sorted order, for use in error message comparison
* Refurbish dependencies (close #17) Bump supported lua versions Lua version 5.1 and up are all widely used across the Lua ecosystem, therefor supporting Lua >= 5.1 is preferable. Replace luasocket with lua-curl Luasocket is likely a simpler option, as on mac/brew, the CURL_DIR flag is required for luacurl to be able to find curl, however luasocket currently cannot make HTTP requests with Lua >= 5.4.3: lunarmodules/luasocket#331 lua-curl is a good alternative. Replace bit + base64 modules with base64 package The bit module, which base64 relied on, was throwing an error while running the base64 test file. As these were files copied from github with no newer versions, both lib/bit.lua and lib/base64.lua have been replaced with the base64 package: https://github.com/iskolbin/lbase64 There are two differences: 1. The base64 package adds padding, whereas the previous implementation didn't - this doesn't matter, however, as the collector doesn't care if padding is present in base64 2. The previous implementation threw an error when trying to encode an empty string, this behaviour has been replaced by checking for an empty string on the variable passed into base64.encode Update set and fix tests Make :toString() return in key sorted order, for use in error message comparison Add maintainer quickstart to README
|
The repository is now under the lunarmodules github organisation. We should be able to move forward with a solution now. |
PR: #19 Bump supported lua versions Lua version 5.1 and up are all widely used across the Lua ecosystem, therefor supporting Lua >= 5.1 is preferable. Replace luasocket with lua-curl Luasocket is likely a simpler option, as on mac/brew, the CURL_DIR flag is required for luacurl to be able to find curl, however luasocket currently cannot make HTTP requests with Lua >= 5.4.3: lunarmodules/luasocket#331 lua-curl is a good alternative. Replace bit + base64 modules with base64 package The bit module, which base64 relied on, was throwing an error while running the base64 test file. As these were files copied from github with no newer versions, both lib/bit.lua and lib/base64.lua have been replaced with the base64 package: https://github.com/iskolbin/lbase64 There are two differences: 1. The base64 package adds padding, whereas the previous implementation didn't - this doesn't matter, however, as the collector doesn't care if padding is present in base64 2. The previous implementation threw an error when trying to encode an empty string, this behaviour has been replaced by checking for an empty string on the variable passed into base64.encode Update set and fix tests Make :toString() return in key sorted order, for use in error message comparison Add maintainer quickstart to README
Luasocket bug with Lua 5.4.3
Short Description
HTTP calls do not work with Luasocket 5.4.3 and luasocket.
System Info
Lua: 5.4.3
Luasocket: LuaSocket 3.0-rc1
Distro Archlinux
Test code:
Requires
lua-socketandlua-secto be installed.If testing using lua5.3, then
lua53-socketlua53-secneed to be installed.Expected output:
Observed output:
Explanation
HTTP call does not work. Diving into the source code to see what might be the cause yields the line:
As you can see in the above code block, line 54 does not pass any arguments, so the argument that is passed will be
selfbecause of the:used in the function call.I can confirm that this was working before my recent update to lua 5.4.3
So, mostly the recent update is what broke it as luasocket has not been updated for quite some time now.
Not sure if there needs to be some support for 5.4.3 that needs to be built into luasocket
The text was updated successfully, but these errors were encountered: