Skip to content

Commit af5a1c7

Browse files
committed
Merge branch 'master' into libcurl_7_74_0
2 parents bb3d6df + cb7a59c commit af5a1c7

File tree

4 files changed

+43
-12
lines changed

4 files changed

+43
-12
lines changed

appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ install:
3636
)
3737
- if not exist c:\hererocks (
3838
pip install hererocks &&
39-
hererocks c:\hererocks --%LUA% --target %HR_TARGET% -rlatest
39+
hererocks c:\hererocks --%LUA% --target %HR_TARGET% -r2.4.4
4040
)
4141
- call c:\hererocks\bin\activate
4242
- luarocks show luarocks-fetch-gitrec >nul 2>&1 || luarocks install luarocks-fetch-gitrec

src/lceasy.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,10 @@ static int lcurl_easy_reset(lua_State *L){
306306
lua_settop(L, 1);
307307

308308
if(p->storage != LUA_NOREF){
309+
int i;
310+
for (i = 0; i < LCURL_LIST_COUNT; ++i) {
311+
p->lists[i] = LUA_NOREF;
312+
}
309313
lcurl_storage_free(L, p->storage);
310314
p->storage = lcurl_storage_init(L);
311315
lua_settop(L, 1);

src/lcurl.c

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,18 @@
2525
# define LCURL_EXPORT_API LUALIB_API
2626
#endif
2727

28+
static const char* LCURL_REGISTRY = "LCURL Registry";
29+
static const char* LCURL_USERVAL = "LCURL Uservalues";
30+
#if LCURL_CURL_VER_GE(7,56,0)
31+
static const char* LCURL_MIME_EASY_MAP = "LCURL Mime easy";
32+
#endif
33+
34+
#if LCURL_CURL_VER_GE(7,56,0)
35+
#define NUP 3
36+
#else
37+
#define NUP 2
38+
#endif
39+
2840
static int lcurl_easy_new_safe(lua_State *L){
2941
return lcurl_easy_create(L, LCURL_ERROR_RETURN);
3042
}
@@ -166,6 +178,11 @@ static int lcurl_version(lua_State *L){
166178
return 1;
167179
}
168180

181+
static int lcurl_debug_getregistry(lua_State *L) {
182+
lua_rawgetp(L, LUA_REGISTRYINDEX, LCURL_REGISTRY);
183+
return 1;
184+
}
185+
169186
static int push_upper(lua_State *L, const char *str){
170187
char buffer[128];
171188
size_t i, n = strlen(str);
@@ -322,6 +339,8 @@ static const struct luaL_Reg lcurl_functions[] = {
322339
{"easy_option_by_id", lcurl_easy_option_by_id },
323340
{"easy_option_by_name", lcurl_easy_option_by_name },
324341
#endif
342+
343+
{"__getregistry", lcurl_debug_getregistry},
325344

326345
{NULL,NULL}
327346
};
@@ -343,6 +362,8 @@ static const struct luaL_Reg lcurl_functions_safe[] = {
343362
{"easy_option_by_name", lcurl_easy_option_by_name },
344363
#endif
345364

365+
{ "__getregistry", lcurl_debug_getregistry },
366+
346367
{NULL,NULL}
347368
};
348369

@@ -357,17 +378,6 @@ static const lcurl_const_t lcurl_flags[] = {
357378

358379
static volatile int LCURL_INIT = 0;
359380

360-
static const char* LCURL_REGISTRY = "LCURL Registry";
361-
static const char* LCURL_USERVAL = "LCURL Uservalues";
362-
#if LCURL_CURL_VER_GE(7,56,0)
363-
static const char* LCURL_MIME_EASY_MAP = "LCURL Mime easy";
364-
#endif
365-
366-
#if LCURL_CURL_VER_GE(7,56,0)
367-
#define NUP 3
368-
#else
369-
#define NUP 2
370-
#endif
371381

372382
#if LCURL_CURL_VER_GE(7,56,0)
373383
#define LCURL_PUSH_NUP(L) lua_pushvalue(L, -NUP-1);lua_pushvalue(L, -NUP-1);lua_pushvalue(L, -NUP-1);

test/test_easy.lua

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1103,6 +1103,23 @@ function test_set_empty_array()
11031103
assert_not_match("X%-Custom:%s*value\r\n", headers)
11041104
end
11051105

1106+
function test_reset_slist()
1107+
c = curl.easy {
1108+
httpheader = {'X-Foo: 1'},
1109+
resolve = {'example.com:80:127.0.0.1'}
1110+
}
1111+
1112+
c:reset()
1113+
1114+
c:setopt{
1115+
httpheader = {'X-Foo: 2'},
1116+
resolve = {'example.com:80:127.0.0.1'}
1117+
}
1118+
1119+
local body, headers = assert_string(dump_request(c))
1120+
assert_match("X%-Foo:%s2\r\n", headers)
1121+
end
1122+
11061123
end
11071124

11081125
local _ENV = TEST_CASE'set_null' if ENABLE then

0 commit comments

Comments
 (0)