Fix. Easy cleanup unref wrong reference
Fix. Read buffer use size_t as offset Change. Use httpbin.org as test server ```Lua -- Test case for easy:close() form = curl.form() e = curl.easy{httpheader = {}} e:close() form:free() ```
This commit is contained in:
parent
f9db68d41e
commit
05272ea096
@ -87,7 +87,6 @@ static int lcurl_easy_cleanup(lua_State *L){
|
||||
p->rbuffer.ref = LUA_NOREF;
|
||||
|
||||
for(i = 0; i < LCURL_LIST_COUNT; ++i){
|
||||
luaL_unref(L, LCURL_LUA_REGISTRY, p->lists[i]);
|
||||
p->lists[i] = LUA_NOREF;
|
||||
}
|
||||
|
||||
@ -696,7 +695,7 @@ static size_t lcurl_read_callback(lua_State *L,
|
||||
assert(rbuffer->ref == LUA_NOREF);
|
||||
|
||||
n = lcurl_util_push_cb(L, rd);
|
||||
lua_pushnumber(L, ret);
|
||||
lua_pushinteger(L, ret);
|
||||
if(lua_pcall(L, n, LUA_MULTRET, 0)) return CURL_READFUNC_ABORT;
|
||||
|
||||
if(lua_isnoneornil(L, top + 1)){
|
||||
@ -786,7 +785,7 @@ static int lcurl_xferinfo_callback(void *arg, curl_off_t dltotal, curl_off_t dln
|
||||
if(lua_isboolean(L, top + 1))
|
||||
ret = lua_toboolean(L, top + 1)?0:1;
|
||||
else{
|
||||
ret = (size_t)lua_tonumber(L, top + 1);
|
||||
ret = lua_tointeger(L, top + 1);
|
||||
if(ret == 0) ret = 1; else ret = 0;
|
||||
}
|
||||
}
|
||||
|
@ -19,8 +19,8 @@ typedef struct lcurl_callback_tag{
|
||||
}lcurl_callback_t;
|
||||
|
||||
typedef struct lcurl_read_buffer_tag{
|
||||
int ref;
|
||||
int off;
|
||||
int ref;
|
||||
size_t off;
|
||||
}lcurl_read_buffer_t;
|
||||
|
||||
int lcurl_storage_init(lua_State *L);
|
||||
|
@ -5,7 +5,8 @@ local curl = require "lcurl"
|
||||
-- i.e. 1 means that CURLPAUSE_CONT will be performed immediately after pause.)
|
||||
local WAIT_COUNT = 32
|
||||
|
||||
local RESOURCE_URL = "http://www.rfc-editor.org/rfc/rfc2543.txt"
|
||||
local SIZE = 100 * 1024
|
||||
local RESOURCE_URL = "http://httpbin.org/bytes/" .. SIZE
|
||||
|
||||
local State = {
|
||||
PAUSE = 0, -- write function should return CURL_WRITEFUNC_PAUSE
|
||||
|
Loading…
x
Reference in New Issue
Block a user