Merge pull request #114 from moteus/master

Add. __tostring metamethod to http post.
This commit is contained in:
Alexey Melnichuk 2017-08-28 09:57:57 +03:00 committed by GitHub
commit 14a9246abe
2 changed files with 7 additions and 0 deletions

View File

@ -569,6 +569,7 @@ static const struct luaL_Reg lcurl_hpost_methods[] = {
{"get", lcurl_hpost_get },
{"free", lcurl_hpost_free },
{"__gc", lcurl_hpost_free },
{"__tostring", lcurl_hpost_to_s },
{NULL,NULL}
};

View File

@ -187,6 +187,12 @@ static const char* LCURL_USERVAL = "LCURL Uservalues";
static int luaopen_lcurl_(lua_State *L, const struct luaL_Reg *func){
if(!LCURL_INIT){
/* Note from libcurl documentation.
*
* The environment it sets up is constant for the life of the program
* and is the same for every program, so multiple calls have the same
* effect as one call. ... This function is not thread safe.
*/
curl_global_init(CURL_GLOBAL_DEFAULT);
LCURL_INIT = 1;
}