mirror of
https://github.com/ctruLua/ctruLua.git
synced 2025-10-28 08:49:30 +00:00
Added ":addTrustedRootCA()" to the httpc contexts, close #8, Added some values in ctr.
I didn't test :addTrustedRootCA(), but it's just a simple string-to-char+size function.
This commit is contained in:
parent
9db21c7831
commit
6a9fbbb133
6 changed files with 38 additions and 8 deletions
|
|
@ -218,6 +218,21 @@ static int httpc_getResponseHeader(lua_State *L) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
/***
|
||||
Add a trusted RootCA cert to a context.
|
||||
@function :addTrustedRootCA
|
||||
@tparam string DER certificate
|
||||
*/
|
||||
static int httpc_addTrustedRootCA(lua_State *L) {
|
||||
httpcContext *context = lua_touserdata(L, 1);
|
||||
u32 certsize;
|
||||
u8* cert = (u8*)luaL_checklstring(L, 2, (size_t*)&certsize);
|
||||
|
||||
httpcAddTrustedRootCA(context, cert, certsize);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// object
|
||||
static const struct luaL_Reg httpc_methods[] = {
|
||||
{"open", httpc_open },
|
||||
|
|
@ -229,6 +244,7 @@ static const struct luaL_Reg httpc_methods[] = {
|
|||
{"close", httpc_close },
|
||||
{"addPostData", httpc_addPostData },
|
||||
{"getResponseHeader", httpc_getResponseHeader },
|
||||
{"addTrustedRootCA", httpc_addTrustedRootCA },
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue