Change. Unset httppost options with stream also unset readfunction.
This commit is contained in:
parent
db7e541e09
commit
2da7106ebb
15
src/lceasy.c
15
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);
|
||||
}
|
||||
|
||||
lcurl_storage_get_i(L, p->storage, CURLOPT_HTTPPOST);
|
||||
if(!lua_isnil(L, -1)){
|
||||
lcurl_hpost_t *form = lcurl_gethpost_at(L, -1);
|
||||
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);
|
||||
|
||||
//! @fixme unset readdata/readfunction for
|
||||
// curl_easy_setopt(p->curl, CURLOPT_READFUNCTION, 0);
|
||||
}
|
||||
|
||||
lua_settop(L, 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, -1, LCURL_STORAGE_KV);
|
||||
if(lua_istable(L, -1)){
|
||||
lua_rawgeti(L, -2, i);
|
||||
lua_remove(L, -2);
|
||||
lua_rawgeti(L, -1, i);
|
||||
lua_remove(L, -2);
|
||||
}
|
||||
else
|
||||
lua_pop(L, 2);
|
||||
lua_remove(L, -2);
|
||||
}
|
||||
|
||||
struct curl_slist* lcurl_storage_remove_slist(lua_State *L, int storage, int idx){
|
||||
|
Loading…
x
Reference in New Issue
Block a user