Change. Unset httppost options with stream also unset readfunction.
This commit is contained in:
parent
db7e541e09
commit
2da7106ebb
17
src/lceasy.c
17
src/lceasy.c
@ -393,10 +393,19 @@ static int lcurl_easy_unset_HTTPPOST(lua_State *L){
|
|||||||
return lcurl_fail_ex(L, p->err_mode, LCURL_ERROR_EASY, code);
|
return lcurl_fail_ex(L, p->err_mode, LCURL_ERROR_EASY, code);
|
||||||
}
|
}
|
||||||
|
|
||||||
lcurl_storage_remove_i(L, p->storage, CURLOPT_HTTPPOST);
|
lcurl_storage_get_i(L, p->storage, CURLOPT_HTTPPOST);
|
||||||
|
if(!lua_isnil(L, -1)){
|
||||||
//! @fixme unset readdata/readfunction for
|
lcurl_hpost_t *form = lcurl_gethpost_at(L, -1);
|
||||||
// curl_easy_setopt(p->curl, CURLOPT_READFUNCTION, 0);
|
if(form->stream){
|
||||||
|
/* with stream we do not set CURLOPT_READDATA but
|
||||||
|
we also unset it to be sure that there no way to
|
||||||
|
call default curl reader with our READDATA
|
||||||
|
*/
|
||||||
|
curl_easy_setopt(p->curl, CURLOPT_READFUNCTION, 0);
|
||||||
|
curl_easy_setopt(p->curl, CURLOPT_READDATA, 0);
|
||||||
|
}
|
||||||
|
lcurl_storage_remove_i(L, p->storage, CURLOPT_HTTPPOST);
|
||||||
|
}
|
||||||
|
|
||||||
lua_settop(L, 1);
|
lua_settop(L, 1);
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -62,12 +62,10 @@ void lcurl_storage_get_i(lua_State *L, int storage, int i){
|
|||||||
lua_rawgeti(L, LCURL_LUA_REGISTRY, storage);
|
lua_rawgeti(L, LCURL_LUA_REGISTRY, storage);
|
||||||
lua_rawgeti(L, -1, LCURL_STORAGE_KV);
|
lua_rawgeti(L, -1, LCURL_STORAGE_KV);
|
||||||
if(lua_istable(L, -1)){
|
if(lua_istable(L, -1)){
|
||||||
lua_rawgeti(L, -2, i);
|
lua_rawgeti(L, -1, i);
|
||||||
lua_remove(L, -2);
|
|
||||||
lua_remove(L, -2);
|
lua_remove(L, -2);
|
||||||
}
|
}
|
||||||
else
|
lua_remove(L, -2);
|
||||||
lua_pop(L, 2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct curl_slist* lcurl_storage_remove_slist(lua_State *L, int storage, int idx){
|
struct curl_slist* lcurl_storage_remove_slist(lua_State *L, int storage, int idx){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user