Add. Support set null as array in multi API
This commit is contained in:
parent
e3b5c928b5
commit
4a70bcbd2f
@ -424,11 +424,17 @@ static int lcurl_opt_set_string_array_(lua_State *L, int opt){
|
||||
lcurl_multi_t *p = lcurl_getmulti(L);
|
||||
CURLMcode code;
|
||||
int n;
|
||||
|
||||
if (lutil_is_null(L, 2)) {
|
||||
n = 0;
|
||||
}
|
||||
else {
|
||||
luaL_argcheck(L, lua_type(L, 2) == LUA_TTABLE, 2, "array expected");
|
||||
n = lua_rawlen(L, 2);
|
||||
}
|
||||
|
||||
if(n == 0){
|
||||
char *val[] = {NULL};
|
||||
code = curl_multi_setopt(p->curl, opt, val);
|
||||
code = curl_multi_setopt(p->curl, opt, 0);
|
||||
}
|
||||
else{
|
||||
int i;
|
||||
|
@ -1064,11 +1064,12 @@ end
|
||||
|
||||
local _ENV = TEST_CASE'set_null' if ENABLE then
|
||||
|
||||
local c
|
||||
local c, m
|
||||
|
||||
function teardown()
|
||||
if c then c:close() end
|
||||
c = nil
|
||||
if m then m:close() end
|
||||
m, c = nil
|
||||
end
|
||||
|
||||
function test_string()
|
||||
@ -1109,6 +1110,14 @@ function test_slist_via_table()
|
||||
assert_not_match("X%-Custom:%s*value\r\n", headers)
|
||||
end
|
||||
|
||||
function test_multi_set_array()
|
||||
m = curl.multi()
|
||||
m:setopt_pipelining_site_bl{
|
||||
'127.0.0.1'
|
||||
}
|
||||
assert_equal(m, m:setopt_pipelining_site_bl(null))
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
RUN()
|
||||
|
Loading…
x
Reference in New Issue
Block a user