Add. setopt_share
method to easy interface.
This commit is contained in:
parent
18c97805c1
commit
ecac8bba1a
@ -287,21 +287,29 @@ function setopt_progressfunction() end
|
|||||||
--
|
--
|
||||||
function setopt_progressfunction() end
|
function setopt_progressfunction() end
|
||||||
|
|
||||||
--- Set HTTP multipart/formdata
|
--- Set HTTP multipart/formdata.
|
||||||
--
|
--
|
||||||
-- Caller does not have to save data.
|
-- Caller does not have to save data.
|
||||||
--
|
--
|
||||||
-- @tparam httpform data
|
-- @tparam httpform data
|
||||||
-- @return[1] self
|
-- @return[1] self
|
||||||
function setopt_httpform() end
|
function setopt_httppost() end
|
||||||
|
|
||||||
--- Set HTTP multipart/formdata
|
--- Set HTTP multipart/formdata.
|
||||||
--
|
--
|
||||||
-- @tparam string data
|
-- @tparam string data
|
||||||
-- @tparam[opt=#data] number length
|
-- @tparam[opt=#data] number length
|
||||||
-- @return[1] self
|
-- @return[1] self
|
||||||
function setopt_postfields() end
|
function setopt_postfields() end
|
||||||
|
|
||||||
|
--- Set curl share object.
|
||||||
|
--
|
||||||
|
-- Caller does not have to save data.
|
||||||
|
--
|
||||||
|
-- @tparam share data
|
||||||
|
-- @return[1] self
|
||||||
|
function setopt_share() end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Muli curl object
|
--- Muli curl object
|
||||||
|
18
src/lceasy.c
18
src/lceasy.c
@ -3,6 +3,7 @@
|
|||||||
#include "lcerror.h"
|
#include "lcerror.h"
|
||||||
#include "lcutils.h"
|
#include "lcutils.h"
|
||||||
#include "lchttppost.h"
|
#include "lchttppost.h"
|
||||||
|
#include "lcshare.h"
|
||||||
|
|
||||||
static const char *LCURL_ERROR_TAG = "LCURL_ERROR_TAG";
|
static const char *LCURL_ERROR_TAG = "LCURL_ERROR_TAG";
|
||||||
|
|
||||||
@ -247,6 +248,20 @@ static int lcurl_easy_set_HTTPPOST(lua_State *L){
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int lcurl_easy_set_SHARE(lua_State *L){
|
||||||
|
lcurl_easy_t *p = lcurl_geteasy(L);
|
||||||
|
lcurl_share_t *sh = lcurl_getshare_at(L, 2);
|
||||||
|
CURLcode code = curl_easy_setopt(p->curl, CURLOPT_SHARE, sh->curl);
|
||||||
|
if(code != CURLE_OK){
|
||||||
|
return lcurl_fail_ex(L, p->err_mode, LCURL_ERROR_EASY, code);
|
||||||
|
}
|
||||||
|
|
||||||
|
lcurl_storage_preserve_value(L, p->storage, 2);
|
||||||
|
|
||||||
|
lua_settop(L, 1);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
//}
|
//}
|
||||||
|
|
||||||
//{ info
|
//{ info
|
||||||
@ -611,6 +626,7 @@ static int lcurl_easy_setopt(lua_State *L){
|
|||||||
#include "lcopteasy.h"
|
#include "lcopteasy.h"
|
||||||
OPT_ENTRY(postfields, POSTFIELDS, TTT, 0)
|
OPT_ENTRY(postfields, POSTFIELDS, TTT, 0)
|
||||||
OPT_ENTRY(httppost, HTTPPOST, TTT, 0)
|
OPT_ENTRY(httppost, HTTPPOST, TTT, 0)
|
||||||
|
OPT_ENTRY(share, SHARE, TTT, 0)
|
||||||
OPT_ENTRY(writefunction, WRITEFUNCTION, TTT, 0)
|
OPT_ENTRY(writefunction, WRITEFUNCTION, TTT, 0)
|
||||||
OPT_ENTRY(readfunction, READFUNCTION, TTT, 0)
|
OPT_ENTRY(readfunction, READFUNCTION, TTT, 0)
|
||||||
OPT_ENTRY(headerfunction, HEADERFUNCTION, TTT, 0)
|
OPT_ENTRY(headerfunction, HEADERFUNCTION, TTT, 0)
|
||||||
@ -643,6 +659,7 @@ static const struct luaL_Reg lcurl_easy_methods[] = {
|
|||||||
#include "lcopteasy.h"
|
#include "lcopteasy.h"
|
||||||
OPT_ENTRY(postfields, POSTFIELDS, TTT, 0)
|
OPT_ENTRY(postfields, POSTFIELDS, TTT, 0)
|
||||||
OPT_ENTRY(httppost, HTTPPOST, TTT, 0)
|
OPT_ENTRY(httppost, HTTPPOST, TTT, 0)
|
||||||
|
OPT_ENTRY(share, SHARE, TTT, 0)
|
||||||
OPT_ENTRY(writefunction, WRITEFUNCTION, TTT, 0)
|
OPT_ENTRY(writefunction, WRITEFUNCTION, TTT, 0)
|
||||||
OPT_ENTRY(readfunction, READFUNCTION, TTT, 0)
|
OPT_ENTRY(readfunction, READFUNCTION, TTT, 0)
|
||||||
OPT_ENTRY(headerfunction, HEADERFUNCTION, TTT, 0)
|
OPT_ENTRY(headerfunction, HEADERFUNCTION, TTT, 0)
|
||||||
@ -671,6 +688,7 @@ static const lcurl_const_t lcurl_easy_opt[] = {
|
|||||||
#include "lcopteasy.h"
|
#include "lcopteasy.h"
|
||||||
OPT_ENTRY(postfields, POSTFIELDS, TTT, 0)
|
OPT_ENTRY(postfields, POSTFIELDS, TTT, 0)
|
||||||
OPT_ENTRY(httppost, HTTPPOST, TTT, 0)
|
OPT_ENTRY(httppost, HTTPPOST, TTT, 0)
|
||||||
|
OPT_ENTRY(share, SHARE, TTT, 0)
|
||||||
OPT_ENTRY(writefunction, WRITEFUNCTION, TTT, 0)
|
OPT_ENTRY(writefunction, WRITEFUNCTION, TTT, 0)
|
||||||
OPT_ENTRY(readfunction, READFUNCTION, TTT, 0)
|
OPT_ENTRY(readfunction, READFUNCTION, TTT, 0)
|
||||||
OPT_ENTRY(headerfunction, HEADERFUNCTION, TTT, 0)
|
OPT_ENTRY(headerfunction, HEADERFUNCTION, TTT, 0)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user