Skip to content

Commit 14a9246

Browse files
authored
Merge pull request #114 from moteus/master
Add. __tostring metamethod to http post.
2 parents b0ed65f + 4c39154 commit 14a9246

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

src/lchttppost.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -569,6 +569,7 @@ static const struct luaL_Reg lcurl_hpost_methods[] = {
569569
{"get", lcurl_hpost_get },
570570
{"free", lcurl_hpost_free },
571571
{"__gc", lcurl_hpost_free },
572+
{"__tostring", lcurl_hpost_to_s },
572573

573574
{NULL,NULL}
574575
};

src/lcurl.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,12 @@ static const char* LCURL_USERVAL = "LCURL Uservalues";
187187

188188
static int luaopen_lcurl_(lua_State *L, const struct luaL_Reg *func){
189189
if(!LCURL_INIT){
190+
/* Note from libcurl documentation.
191+
*
192+
* The environment it sets up is constant for the life of the program
193+
* and is the same for every program, so multiple calls have the same
194+
* effect as one call. ... This function is not thread safe.
195+
*/
190196
curl_global_init(CURL_GLOBAL_DEFAULT);
191197
LCURL_INIT = 1;
192198
}

0 commit comments

Comments
 (0)