diff --git a/src/lchttppost.c b/src/lchttppost.c index 65c4ff0..0200339 100644 --- a/src/lchttppost.c +++ b/src/lchttppost.c @@ -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} }; diff --git a/src/lcurl.c b/src/lcurl.c index eca1f10..512fe0c 100644 --- a/src/lcurl.c +++ b/src/lcurl.c @@ -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; }