Comments (11)
Can you provide any assurance on the layout of t_context
?
At least that the SSL_CTX*
will remain the first element of the struct?
from luasec.
I think it is possible keep it as first field.
But I want to be clear that I see t_context, t_ssl, etc., as internal structures.
If we need some kind of access to these structures, it would be saver to think in a standard C API to retrieve OpenSSL objects from LuaSec.
from luasec.
If we need some kind of access to these structures, it would be saver to think in a standard C API to retrieve OpenSSL objects from LuaSec.
Ahha. I just noticed lsec_checkcontext
exists.
from luasec.
Could you add a lsec_testcontext
to go along with that?
from luasec.
@brunoos ?
from luasec.
sorry, what is lsec_testcontext
?
from luasec.
sorry, what is lsec_testcontext ?
Analogous to luaL_testudata
vs luaL_checkudata
.
It would test the argument to see if it's a valid context; if so, return a pointer to the SSL_CTX
. if not, return NULL
.
from luasec.
ok... the easy way is use luaL_testudata
, but there is no such function in Lua 5.1.
It should be re-implemented (or imported from 5.2 or 5.3).
Do you think another way?
/*-- Compat - Lua 5.1 --------------------------------------------------------*/
#if (LUA_VERSION_NUM == 501)
#define luaL_testudata(L, ud, tname) testudata(L, ud, tname)
static void *testudata (lua_State *L, int ud, const char *tname) {
void *p = lua_touserdata(L, ud);
if (p != NULL) { /* value is a userdata? */
if (lua_getmetatable(L, ud)) { /* does it have a metatable? */
luaL_getmetatable(L, tname); /* get correct metatable */
if (!lua_rawequal(L, -1, -2)) /* not the same? */
p = NULL; /* value is a userdata with wrong metatable */
lua_pop(L, 2); /* remove both metatables */
return p;
}
}
return NULL; /* value is not a userdata with a metatable */
}
#endif
from luasec.
the easy way is use luaL_testudata, but there is no such function in Lua 5.1.
It should be re-implemented (or imported from 5.2 or 5.3).
Ah, I didn't realise it was new in 5.2/5.3.
Your implementation looks fine, alternatively you could copy the implementation from: https://github.com/keplerproject/lua-compat-5.3/blob/master/c-api/compat-5.3.c#L219
from luasec.
@brunoos do you need anything from me for this one?
from luasec.
Added in 96401bd
awesome!
from luasec.
Related Issues (20)
- ssl.https.request dont work HOT 6
- Off by one in `cert:validat(notafter)` HOT 2
- [HTTPS] Problems with memory consumption when loading the CA certificate HOT 5
- skip response headers messages HOT 2
- SSL Handshake fails without an error message HOT 2
- Compilation fails with >=openssl-3.0.0 HOT 1
- Can't compile source code in luasec.vcxproj HOT 1
- method `conn:shutdown()` is missing HOT 4
- Is openssl 1.0.2 supported with lua 5.1 release? HOT 2
- Docker container crashed when lua calling ssl.so library HOT 4
- Android shared library
- Sumneko's Lua language server shows a warning for passing 2 variables to a function with only 1 argument in https.lua HOT 1
- New release HOT 4
- Failed to install with mingw64 HOT 6
- Installation on an embedded Lua v5.1 (with no Lua Rocks) HOT 12
- tls-psk regress after #194 HOT 3
- Failed VS2022 BUILD | openssl-3.2.0 and crypt32.lib
- Emerged on Gentoo version 1.3.2, and I see it by path /usr/share/lua/5.1/ssl/https.lua, but expected for version 5.4
- Does this library support DTLS? HOT 1
- getting information about client HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from luasec.