add postfields and header curl option

Origin commit data
------------------
Branch: ni/coolstream
Commit: 35898bb7fd
Author: Jacek Jendrzej <overx300@gmail.com>
Date: 2016-03-25 (Fri, 25 Mar 2016)


------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
Jacek Jendrzej
2016-03-25 20:20:48 +01:00
parent 9ce2437cd4
commit 92bee24774

View File

@@ -137,8 +137,10 @@ int CLuaInstCurl::CurlDownload(lua_State *L)
o, outputfile string when empty then save to string
as secund return value
A, userAgent string empty
P, postfields string empty
v, verbose bool false
s, silent bool false
h, header bool false
connectTimeout number 20
ipv4 bool false
ipv6 bool false
@@ -219,6 +221,9 @@ Example:
std::string userAgent = "";
tableLookup(L, "A", userAgent) || tableLookup(L, "userAgent", userAgent);
std::string postfields = "";//specify data to POST to server
tableLookup(L, "P", postfields) || tableLookup(L, "postfields", postfields);
bool verbose = false;
tableLookup(L, "v", verbose) || tableLookup(L, "verbose", verbose);
@@ -226,6 +231,9 @@ Example:
if (!verbose)
tableLookup(L, "s", silent) || tableLookup(L, "silent", silent);
bool pass_header = false;//pass headers to the data stream
tableLookup(L, "header", pass_header);
lua_Integer connectTimeout = 20;
tableLookup(L, "connectTimeout", connectTimeout);
@@ -261,6 +269,9 @@ Example:
if (!userAgent.empty())
curl_easy_setopt(curl_handle, CURLOPT_USERAGENT, userAgent.c_str());
if (!postfields.empty())
curl_easy_setopt(curl_handle, CURLOPT_POSTFIELDS, postfields.c_str());
if (ipv4 && ipv6)
curl_easy_setopt(curl_handle, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_WHATEVER);
else if (ipv4)
@@ -280,6 +291,7 @@ Example:
curl_easy_setopt(curl_handle, CURLOPT_MAXREDIRS, (long)maxRedirs);
curl_easy_setopt(curl_handle, CURLOPT_NOPROGRESS, (silent)?1L:0L);
curl_easy_setopt(curl_handle, CURLOPT_VERBOSE, (verbose)?1L:0L);
curl_easy_setopt(curl_handle, CURLOPT_HEADER, (pass_header)?1L:0L);
progressData pgd;