Skip to content
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

ssl.https.request dont work #171

Closed
YarickDarknet opened this issue Apr 22, 2021 · 6 comments
Closed

ssl.https.request dont work #171

YarickDarknet opened this issue Apr 22, 2021 · 6 comments

Comments

@YarickDarknet
Copy link

lua: /usr/share/lua/5.4/ssl/https.lua:66: bad argument #2 to 'method' (string expected, got light userdata) stack traceback: [C]: in function 'socket.http.request' /usr/share/lua/5.4/ssl/https.lua:132: in function 'ssl.https.request'

@brunoos
Copy link
Member

brunoos commented Apr 23, 2021

Can you give a small code example of the problem?

You can see the documentation of https.request at:
http://w3.impa.br/~diego/software/luasocket/http.html#request

@carlocab
Copy link

Seeing this error at Homebrew CI too. In particular, it's this problem: luarocks/luarocks#1302

Will try to extract an example, but currently my way of reproducing it is to install luasec then try to install any other rock.

@YarickDarknet
Copy link
Author

@brunoos
Copy link
Member

brunoos commented Apr 23, 2021

The problem seems to be with luasocket... luasec's https is a wrapper to luasocket's http module.
Could it be luaL_Buffer problem in Lua 5.4.3?

@update:
I did a wrong test, I don't know if the problem is with luasocket yet...

@brunoos
Copy link
Member

brunoos commented Apr 23, 2021

It seems Lua 5.4.3 broke luasocket... it works fine with Lua 5.4.2.

Maybe, it broke luasec too.

@brunoos
Copy link
Member

brunoos commented Apr 23, 2021

The function buffer_meth_receive expects 3 parameters, with parameters 2 and 3 being optional.

However, luaL_buffinit can push values into the stack and that is breaking the function if 2 or 3 are missing.

One solution is always push nothing for 2 and 3 if they are missing. Something ugly like this seems to work:

int buffer_meth_receive(lua_State *L, p_buffer buf) {
+    if (lua_gettop(L) < 3) lua_settop(L, 3);
    int err = IO_DONE, top = lua_gettop(L);

Of course, all the code needs to be reviewed now (and other functions).

@brunoos brunoos closed this as completed Apr 26, 2021
carlocab added a commit to carlocab/homebrew-core that referenced this issue May 28, 2021
This updates resource `luasec` to include a fix for lunarmodules/luasec#171.

Also, update the homepage. The original one no longer works.
BrewTestBot pushed a commit to Homebrew/homebrew-core that referenced this issue May 28, 2021
This updates resource `luasec` to include a fix for lunarmodules/luasec#171.

Also, update the homepage. The original one no longer works.

Closes #78231.

Signed-off-by: Nanda H Krishna <me@nandahkrishna.com>
Signed-off-by: BrewTestBot <1589480+BrewTestBot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants