mirror of
https://github.com/brunoos/luasec.git
synced 2024-11-07 22:18:27 +01:00
Fix for LibreSSL/OPENSSL_NO_COMP
This commit is contained in:
parent
f514e9fb1b
commit
4c7339cace
@ -400,24 +400,29 @@ static int meth_want(lua_State *L)
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the compression method used.
|
||||
*/
|
||||
static int meth_compression(lua_State *L)
|
||||
{
|
||||
const COMP_METHOD *comp;
|
||||
p_ssl ssl = (p_ssl)luaL_checkudata(L, 1, "SSL:Connection");
|
||||
if (ssl->state != LSEC_STATE_CONNECTED) {
|
||||
lua_pushnil(L);
|
||||
lua_pushstring(L, "closed");
|
||||
return 2;
|
||||
}
|
||||
|
||||
#if !defined(OPENSSL_NO_COMP)
|
||||
const COMP_METHOD *comp;
|
||||
comp = SSL_get_current_compression(ssl->ssl);
|
||||
if (comp)
|
||||
lua_pushstring(L, SSL_COMP_get_name(comp));
|
||||
else
|
||||
lua_pushnil(L);
|
||||
#else
|
||||
lua_pushnil(L);
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user