curl tool: reviewed code moved to tool_*.[ch] files
my_setopt and my_setopt_str no longer ignores curl_easy_setopt result. Fixed some OOM handling issues.
This commit is contained in:
parent
3c3aa09c65
commit
fb3845a438
@ -10,9 +10,19 @@ SOURCEPATH ../../../src
|
|||||||
SOURCE \
|
SOURCE \
|
||||||
main.c hugehelp.c urlglob.c writeout.c writeenv.c \
|
main.c hugehelp.c urlglob.c writeout.c writeenv.c \
|
||||||
getpass.c homedir.c curlutil.c xattr.c \
|
getpass.c homedir.c curlutil.c xattr.c \
|
||||||
tool_bname.c tool_cfgable.c tool_convert.c tool_dirhie.c \
|
tool_bname.c \
|
||||||
tool_doswin.c tool_easysrc.c tool_mfiles.c tool_msgs.c \
|
tool_cfgable.c \
|
||||||
tool_myfunc.c tool_progress.c tool_setopt.c tool_vms.c
|
tool_convert.c \
|
||||||
|
tool_dirhie.c \
|
||||||
|
tool_doswin.c \
|
||||||
|
tool_easysrc.c \
|
||||||
|
tool_libinfo.c \
|
||||||
|
tool_mfiles.c \
|
||||||
|
tool_msgs.c \
|
||||||
|
tool_myfunc.c \
|
||||||
|
tool_progress.c \
|
||||||
|
tool_setopt.c \
|
||||||
|
tool_vms.c
|
||||||
|
|
||||||
SOURCEPATH ../../../lib
|
SOURCEPATH ../../../lib
|
||||||
SOURCE \
|
SOURCE \
|
||||||
|
@ -16,16 +16,36 @@ CURLX_ONES = $(top_srcdir)/lib/strtoofft.c \
|
|||||||
|
|
||||||
CURL_CFILES = main.c hugehelp.c urlglob.c writeout.c writeenv.c \
|
CURL_CFILES = main.c hugehelp.c urlglob.c writeout.c writeenv.c \
|
||||||
getpass.c homedir.c curlutil.c xattr.c \
|
getpass.c homedir.c curlutil.c xattr.c \
|
||||||
tool_bname.c tool_cfgable.c tool_convert.c tool_dirhie.c \
|
tool_bname.c \
|
||||||
tool_doswin.c tool_easysrc.c tool_mfiles.c tool_msgs.c \
|
tool_cfgable.c \
|
||||||
tool_myfunc.c tool_progress.c tool_setopt.c tool_vms.c
|
tool_convert.c \
|
||||||
|
tool_dirhie.c \
|
||||||
|
tool_doswin.c \
|
||||||
|
tool_easysrc.c \
|
||||||
|
tool_libinfo.c \
|
||||||
|
tool_mfiles.c \
|
||||||
|
tool_msgs.c \
|
||||||
|
tool_myfunc.c \
|
||||||
|
tool_progress.c \
|
||||||
|
tool_setopt.c \
|
||||||
|
tool_vms.c
|
||||||
|
|
||||||
CURL_HFILES = hugehelp.h setup.h config-win32.h config-mac.h \
|
CURL_HFILES = hugehelp.h setup.h config-win32.h config-mac.h \
|
||||||
config-riscos.h urlglob.h version.h xattr.h \
|
config-riscos.h urlglob.h version.h xattr.h \
|
||||||
writeout.h writeenv.h getpass.h homedir.h curlutil.h \
|
writeout.h writeenv.h getpass.h homedir.h curlutil.h \
|
||||||
tool_bname.h tool_cfgable.h tool_convert.h tool_dirhie.h \
|
tool_bname.h \
|
||||||
tool_doswin.h tool_easysrc.h tool_mfiles.h tool_msgs.h \
|
tool_cfgable.h \
|
||||||
tool_myfunc.h tool_progress.h tool_sdecls.h tool_setopt.h \
|
tool_convert.h \
|
||||||
|
tool_dirhie.h \
|
||||||
|
tool_doswin.h \
|
||||||
|
tool_easysrc.h \
|
||||||
|
tool_libinfo.h \
|
||||||
|
tool_mfiles.h \
|
||||||
|
tool_msgs.h \
|
||||||
|
tool_myfunc.h \
|
||||||
|
tool_progress.h \
|
||||||
|
tool_sdecls.h \
|
||||||
|
tool_setopt.h \
|
||||||
tool_vms.h
|
tool_vms.h
|
||||||
|
|
||||||
curl_SOURCES = $(CURL_CFILES) $(CURLX_ONES) $(CURL_HFILES)
|
curl_SOURCES = $(CURL_CFILES) $(CURLX_ONES) $(CURL_HFILES)
|
||||||
|
@ -147,6 +147,7 @@ RELEASE_OBJS= \
|
|||||||
tool_dirhier.obj \
|
tool_dirhier.obj \
|
||||||
tool_doswinr.obj \
|
tool_doswinr.obj \
|
||||||
tool_easysrcr.obj \
|
tool_easysrcr.obj \
|
||||||
|
tool_libinfor.obj \
|
||||||
tool_mfilesr.obj \
|
tool_mfilesr.obj \
|
||||||
tool_msgsr.obj \
|
tool_msgsr.obj \
|
||||||
tool_myfuncr.obj \
|
tool_myfuncr.obj \
|
||||||
@ -173,6 +174,7 @@ DEBUG_OBJS= \
|
|||||||
tool_dirhied.obj \
|
tool_dirhied.obj \
|
||||||
tool_doswind.obj \
|
tool_doswind.obj \
|
||||||
tool_easysrcd.obj \
|
tool_easysrcd.obj \
|
||||||
|
tool_libinfod.obj \
|
||||||
tool_mfilesd.obj \
|
tool_mfilesd.obj \
|
||||||
tool_msgsd.obj \
|
tool_msgsd.obj \
|
||||||
tool_myfuncd.obj \
|
tool_myfuncd.obj \
|
||||||
@ -334,6 +336,8 @@ tool_doswinr.obj: tool_doswin.c
|
|||||||
$(CCR) $(CFLAGS) /Fo"$@" tool_doswin.c
|
$(CCR) $(CFLAGS) /Fo"$@" tool_doswin.c
|
||||||
tool_easysrcr.obj: tool_easysrc.c
|
tool_easysrcr.obj: tool_easysrc.c
|
||||||
$(CCR) $(CFLAGS) /Fo"$@" tool_easysrc.c
|
$(CCR) $(CFLAGS) /Fo"$@" tool_easysrc.c
|
||||||
|
tool_libinfor.obj: tool_libinfo.c
|
||||||
|
$(CCR) $(CFLAGS) /Fo"$@" tool_libinfo.c
|
||||||
tool_mfilesr.obj: tool_mfiles.c
|
tool_mfilesr.obj: tool_mfiles.c
|
||||||
$(CCR) $(CFLAGS) /Fo"$@" tool_mfiles.c
|
$(CCR) $(CFLAGS) /Fo"$@" tool_mfiles.c
|
||||||
tool_msgsr.obj: tool_msgs.c
|
tool_msgsr.obj: tool_msgs.c
|
||||||
@ -384,6 +388,8 @@ tool_doswind.obj: tool_doswin.c
|
|||||||
$(CCD) $(CFLAGS) /Fo"$@" tool_doswin.c
|
$(CCD) $(CFLAGS) /Fo"$@" tool_doswin.c
|
||||||
tool_easysrcd.obj: tool_easysrc.c
|
tool_easysrcd.obj: tool_easysrc.c
|
||||||
$(CCD) $(CFLAGS) /Fo"$@" tool_easysrc.c
|
$(CCD) $(CFLAGS) /Fo"$@" tool_easysrc.c
|
||||||
|
tool_libinfod.obj: tool_libinfo.c
|
||||||
|
$(CCD) $(CFLAGS) /Fo"$@" tool_libinfo.c
|
||||||
tool_mfilesd.obj: tool_mfiles.c
|
tool_mfilesd.obj: tool_mfiles.c
|
||||||
$(CCD) $(CFLAGS) /Fo"$@" tool_mfiles.c
|
$(CCD) $(CFLAGS) /Fo"$@" tool_mfiles.c
|
||||||
tool_msgsd.obj: tool_msgs.c
|
tool_msgsd.obj: tool_msgs.c
|
||||||
|
230
src/main.c
230
src/main.c
@ -98,6 +98,7 @@
|
|||||||
#include "tool_dirhie.h"
|
#include "tool_dirhie.h"
|
||||||
#include "tool_doswin.h"
|
#include "tool_doswin.h"
|
||||||
#include "tool_easysrc.h"
|
#include "tool_easysrc.h"
|
||||||
|
#include "tool_libinfo.h"
|
||||||
#include "tool_mfiles.h"
|
#include "tool_mfiles.h"
|
||||||
#include "tool_msgs.h"
|
#include "tool_msgs.h"
|
||||||
#include "tool_myfunc.h"
|
#include "tool_myfunc.h"
|
||||||
@ -506,9 +507,6 @@ struct LongShort {
|
|||||||
bool extraparam;
|
bool extraparam;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* global variable to hold info about libcurl */
|
|
||||||
static curl_version_info_data *curlinfo;
|
|
||||||
|
|
||||||
static int parseconfig(const char *filename,
|
static int parseconfig(const char *filename,
|
||||||
struct Configurable *config);
|
struct Configurable *config);
|
||||||
static char *my_get_line(FILE *fp);
|
static char *my_get_line(FILE *fp);
|
||||||
@ -3740,7 +3738,10 @@ operate(struct Configurable *config, int argc, argv_item_t argv[])
|
|||||||
config->outs = &outs;
|
config->outs = &outs;
|
||||||
|
|
||||||
/* we get libcurl info right away */
|
/* we get libcurl info right away */
|
||||||
curlinfo = curl_version_info(CURLVERSION_NOW);
|
if(get_libcurl_info() != CURLE_OK) {
|
||||||
|
clean_getout(config);
|
||||||
|
return CURLE_FAILED_INIT;
|
||||||
|
}
|
||||||
|
|
||||||
errorbuffer[0]=0; /* prevent junk from being output */
|
errorbuffer[0]=0; /* prevent junk from being output */
|
||||||
|
|
||||||
@ -4348,9 +4349,6 @@ operate(struct Configurable *config, int argc, argv_item_t argv[])
|
|||||||
if(uploadfilesize != -1)
|
if(uploadfilesize != -1)
|
||||||
my_setopt(curl, CURLOPT_INFILESIZE_LARGE, uploadfilesize);
|
my_setopt(curl, CURLOPT_INFILESIZE_LARGE, uploadfilesize);
|
||||||
my_setopt_str(curl, CURLOPT_URL, url); /* what to fetch */
|
my_setopt_str(curl, CURLOPT_URL, url); /* what to fetch */
|
||||||
my_setopt_str(curl, CURLOPT_PROXY, config->proxy); /* proxy to use */
|
|
||||||
if(config->proxy)
|
|
||||||
my_setopt(curl, CURLOPT_PROXYTYPE, config->proxyver);
|
|
||||||
my_setopt(curl, CURLOPT_NOPROGRESS, config->noprogress);
|
my_setopt(curl, CURLOPT_NOPROGRESS, config->noprogress);
|
||||||
if(config->no_body) {
|
if(config->no_body) {
|
||||||
my_setopt(curl, CURLOPT_NOBODY, 1);
|
my_setopt(curl, CURLOPT_NOBODY, 1);
|
||||||
@ -4359,6 +4357,43 @@ operate(struct Configurable *config, int argc, argv_item_t argv[])
|
|||||||
else
|
else
|
||||||
my_setopt(curl, CURLOPT_HEADER, config->include_headers);
|
my_setopt(curl, CURLOPT_HEADER, config->include_headers);
|
||||||
|
|
||||||
|
#if !defined(CURL_DISABLE_PROXY)
|
||||||
|
{
|
||||||
|
/* TODO: Make this a run-time check instead of compile-time one. */
|
||||||
|
|
||||||
|
my_setopt_str(curl, CURLOPT_PROXY, config->proxy);
|
||||||
|
my_setopt_str(curl, CURLOPT_PROXYUSERPWD, config->proxyuserpwd);
|
||||||
|
|
||||||
|
/* new in libcurl 7.3 */
|
||||||
|
my_setopt(curl, CURLOPT_HTTPPROXYTUNNEL, config->proxytunnel);
|
||||||
|
|
||||||
|
/* new in libcurl 7.5 */
|
||||||
|
if(config->proxy)
|
||||||
|
my_setopt(curl, CURLOPT_PROXYTYPE, config->proxyver);
|
||||||
|
|
||||||
|
/* new in libcurl 7.10 */
|
||||||
|
if(config->socksproxy) {
|
||||||
|
my_setopt_str(curl, CURLOPT_PROXY, config->socksproxy);
|
||||||
|
my_setopt(curl, CURLOPT_PROXYTYPE, config->socksver);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* new in libcurl 7.10.6 */
|
||||||
|
if(config->proxyanyauth)
|
||||||
|
my_setopt(curl, CURLOPT_PROXYAUTH, CURLAUTH_ANY);
|
||||||
|
else if(config->proxynegotiate)
|
||||||
|
my_setopt(curl, CURLOPT_PROXYAUTH, CURLAUTH_GSSNEGOTIATE);
|
||||||
|
else if(config->proxyntlm)
|
||||||
|
my_setopt(curl, CURLOPT_PROXYAUTH, CURLAUTH_NTLM);
|
||||||
|
else if(config->proxydigest)
|
||||||
|
my_setopt(curl, CURLOPT_PROXYAUTH, CURLAUTH_DIGEST);
|
||||||
|
else if(config->proxybasic)
|
||||||
|
my_setopt(curl, CURLOPT_PROXYAUTH, CURLAUTH_BASIC);
|
||||||
|
|
||||||
|
/* new in libcurl 7.19.4 */
|
||||||
|
my_setopt(curl, CURLOPT_NOPROXY, config->noproxy);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
my_setopt(curl, CURLOPT_FAILONERROR, config->failonerror);
|
my_setopt(curl, CURLOPT_FAILONERROR, config->failonerror);
|
||||||
my_setopt(curl, CURLOPT_UPLOAD, uploadfile?TRUE:FALSE);
|
my_setopt(curl, CURLOPT_UPLOAD, uploadfile?TRUE:FALSE);
|
||||||
my_setopt(curl, CURLOPT_DIRLISTONLY, config->dirlistonly);
|
my_setopt(curl, CURLOPT_DIRLISTONLY, config->dirlistonly);
|
||||||
@ -4374,20 +4409,25 @@ operate(struct Configurable *config, int argc, argv_item_t argv[])
|
|||||||
if(config->netrc_file)
|
if(config->netrc_file)
|
||||||
my_setopt(curl, CURLOPT_NETRC_FILE, config->netrc_file);
|
my_setopt(curl, CURLOPT_NETRC_FILE, config->netrc_file);
|
||||||
|
|
||||||
my_setopt(curl, CURLOPT_FOLLOWLOCATION, config->followlocation);
|
|
||||||
my_setopt(curl, CURLOPT_UNRESTRICTED_AUTH, config->unrestricted_auth);
|
|
||||||
my_setopt(curl, CURLOPT_TRANSFERTEXT, config->use_ascii);
|
my_setopt(curl, CURLOPT_TRANSFERTEXT, config->use_ascii);
|
||||||
my_setopt_str(curl, CURLOPT_USERPWD, config->userpwd);
|
my_setopt_str(curl, CURLOPT_USERPWD, config->userpwd);
|
||||||
my_setopt_str(curl, CURLOPT_PROXYUSERPWD, config->proxyuserpwd);
|
|
||||||
my_setopt(curl, CURLOPT_NOPROXY, config->noproxy);
|
|
||||||
my_setopt_str(curl, CURLOPT_RANGE, config->range);
|
my_setopt_str(curl, CURLOPT_RANGE, config->range);
|
||||||
my_setopt(curl, CURLOPT_ERRORBUFFER, errorbuffer);
|
my_setopt(curl, CURLOPT_ERRORBUFFER, errorbuffer);
|
||||||
my_setopt(curl, CURLOPT_TIMEOUT, config->timeout);
|
my_setopt(curl, CURLOPT_TIMEOUT, config->timeout);
|
||||||
|
|
||||||
|
if(built_in_protos & CURLPROTO_HTTP) {
|
||||||
|
|
||||||
|
my_setopt(curl, CURLOPT_FOLLOWLOCATION,
|
||||||
|
config->followlocation);
|
||||||
|
my_setopt(curl, CURLOPT_UNRESTRICTED_AUTH,
|
||||||
|
config->unrestricted_auth);
|
||||||
|
|
||||||
switch(config->httpreq) {
|
switch(config->httpreq) {
|
||||||
case HTTPREQ_SIMPLEPOST:
|
case HTTPREQ_SIMPLEPOST:
|
||||||
my_setopt_str(curl, CURLOPT_POSTFIELDS, config->postfields);
|
my_setopt_str(curl, CURLOPT_POSTFIELDS,
|
||||||
my_setopt(curl, CURLOPT_POSTFIELDSIZE_LARGE, config->postfieldsize);
|
config->postfields);
|
||||||
|
my_setopt(curl, CURLOPT_POSTFIELDSIZE_LARGE,
|
||||||
|
config->postfieldsize);
|
||||||
break;
|
break;
|
||||||
case HTTPREQ_POST:
|
case HTTPREQ_POST:
|
||||||
my_setopt(curl, CURLOPT_HTTPPOST, config->httppost);
|
my_setopt(curl, CURLOPT_HTTPPOST, config->httppost);
|
||||||
@ -4395,9 +4435,37 @@ operate(struct Configurable *config, int argc, argv_item_t argv[])
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
my_setopt_str(curl, CURLOPT_REFERER, config->referer);
|
my_setopt_str(curl, CURLOPT_REFERER, config->referer);
|
||||||
my_setopt(curl, CURLOPT_AUTOREFERER, config->autoreferer);
|
my_setopt(curl, CURLOPT_AUTOREFERER, config->autoreferer);
|
||||||
my_setopt_str(curl, CURLOPT_USERAGENT, config->useragent);
|
my_setopt_str(curl, CURLOPT_USERAGENT, config->useragent);
|
||||||
|
my_setopt(curl, CURLOPT_HTTPHEADER, config->headers);
|
||||||
|
|
||||||
|
/* new in libcurl 7.5 */
|
||||||
|
my_setopt(curl, CURLOPT_MAXREDIRS, config->maxredirs);
|
||||||
|
|
||||||
|
/* new in libcurl 7.9.1 */
|
||||||
|
if(config->httpversion)
|
||||||
|
my_setopt(curl, CURLOPT_HTTP_VERSION, config->httpversion);
|
||||||
|
|
||||||
|
/* new in libcurl 7.10.6 (default is Basic) */
|
||||||
|
if(config->authtype)
|
||||||
|
my_setopt(curl, CURLOPT_HTTPAUTH, config->authtype);
|
||||||
|
|
||||||
|
/* curl 7.19.1 (the 301 version existed in 7.18.2) */
|
||||||
|
my_setopt(curl, CURLOPT_POSTREDIR, config->post301 |
|
||||||
|
(config->post302 ? CURL_REDIR_POST_302 : FALSE));
|
||||||
|
|
||||||
|
/* new in libcurl 7.21.6 */
|
||||||
|
if(config->encoding)
|
||||||
|
my_setopt_str(curl, CURLOPT_ACCEPT_ENCODING, "");
|
||||||
|
|
||||||
|
/* new in libcurl 7.21.6 */
|
||||||
|
if(config->tr_encoding)
|
||||||
|
my_setopt(curl, CURLOPT_TRANSFER_ENCODING, 1);
|
||||||
|
|
||||||
|
} /* (built_in_protos & CURLPROTO_HTTP) */
|
||||||
|
|
||||||
my_setopt_str(curl, CURLOPT_FTPPORT, config->ftpport);
|
my_setopt_str(curl, CURLOPT_FTPPORT, config->ftpport);
|
||||||
my_setopt(curl, CURLOPT_LOW_SPEED_LIMIT,
|
my_setopt(curl, CURLOPT_LOW_SPEED_LIMIT,
|
||||||
config->low_speed_limit);
|
config->low_speed_limit);
|
||||||
@ -4408,55 +4476,67 @@ operate(struct Configurable *config, int argc, argv_item_t argv[])
|
|||||||
config->recvpersecond);
|
config->recvpersecond);
|
||||||
my_setopt(curl, CURLOPT_RESUME_FROM_LARGE,
|
my_setopt(curl, CURLOPT_RESUME_FROM_LARGE,
|
||||||
config->use_resume?config->resume_from:0);
|
config->use_resume?config->resume_from:0);
|
||||||
my_setopt_str(curl, CURLOPT_COOKIE, config->cookie);
|
|
||||||
my_setopt(curl, CURLOPT_HTTPHEADER, config->headers);
|
|
||||||
my_setopt(curl, CURLOPT_SSLCERT, config->cert);
|
my_setopt(curl, CURLOPT_SSLCERT, config->cert);
|
||||||
my_setopt_str(curl, CURLOPT_SSLCERTTYPE, config->cert_type);
|
my_setopt_str(curl, CURLOPT_SSLCERTTYPE, config->cert_type);
|
||||||
my_setopt(curl, CURLOPT_SSLKEY, config->key);
|
my_setopt(curl, CURLOPT_SSLKEY, config->key);
|
||||||
my_setopt_str(curl, CURLOPT_SSLKEYTYPE, config->key_type);
|
my_setopt_str(curl, CURLOPT_SSLKEYTYPE, config->key_type);
|
||||||
my_setopt_str(curl, CURLOPT_KEYPASSWD, config->key_passwd);
|
my_setopt_str(curl, CURLOPT_KEYPASSWD, config->key_passwd);
|
||||||
|
|
||||||
/* SSH private key uses the same command-line option as SSL private
|
if(built_in_protos & (CURLPROTO_SCP|CURLPROTO_SFTP)) {
|
||||||
key */
|
|
||||||
|
/* SSH and SSL private key uses same command-line option */
|
||||||
|
/* new in libcurl 7.16.1 */
|
||||||
my_setopt_str(curl, CURLOPT_SSH_PRIVATE_KEYFILE, config->key);
|
my_setopt_str(curl, CURLOPT_SSH_PRIVATE_KEYFILE, config->key);
|
||||||
|
/* new in libcurl 7.16.1 */
|
||||||
my_setopt_str(curl, CURLOPT_SSH_PUBLIC_KEYFILE, config->pubkey);
|
my_setopt_str(curl, CURLOPT_SSH_PUBLIC_KEYFILE, config->pubkey);
|
||||||
|
|
||||||
/* SSH host key md5 checking allows us to fail if we are
|
/* new in libcurl 7.17.1: SSH host key md5 checking allows us
|
||||||
* not talking to who we think we should
|
to fail if we are not talking to who we think we should */
|
||||||
*/
|
|
||||||
my_setopt_str(curl, CURLOPT_SSH_HOST_PUBLIC_KEY_MD5,
|
my_setopt_str(curl, CURLOPT_SSH_HOST_PUBLIC_KEY_MD5,
|
||||||
config->hostpubmd5);
|
config->hostpubmd5);
|
||||||
|
}
|
||||||
|
|
||||||
/* default to strict verifyhost */
|
|
||||||
/* my_setopt(curl, CURLOPT_SSL_VERIFYHOST, 2); */
|
|
||||||
if(config->cacert || config->capath) {
|
|
||||||
if(config->cacert)
|
if(config->cacert)
|
||||||
my_setopt_str(curl, CURLOPT_CAINFO, config->cacert);
|
my_setopt_str(curl, CURLOPT_CAINFO, config->cacert);
|
||||||
|
|
||||||
if(config->capath)
|
if(config->capath)
|
||||||
my_setopt_str(curl, CURLOPT_CAPATH, config->capath);
|
my_setopt_str(curl, CURLOPT_CAPATH, config->capath);
|
||||||
my_setopt(curl, CURLOPT_SSL_VERIFYPEER, TRUE);
|
|
||||||
}
|
|
||||||
if(config->crlfile)
|
if(config->crlfile)
|
||||||
my_setopt_str(curl, CURLOPT_CRLFILE, config->crlfile);
|
my_setopt_str(curl, CURLOPT_CRLFILE, config->crlfile);
|
||||||
if(config->insecure_ok) {
|
|
||||||
/* new stuff needed for libcurl 7.10 */
|
|
||||||
my_setopt(curl, CURLOPT_SSL_VERIFYPEER, FALSE);
|
|
||||||
my_setopt(curl, CURLOPT_SSL_VERIFYHOST, 1);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
char *home = homedir();
|
|
||||||
char *file = aprintf("%s/%sssh/known_hosts", home, DOT_CHAR);
|
|
||||||
Curl_safefree(home);
|
|
||||||
|
|
||||||
if(file) {
|
if(curlinfo->features & CURL_VERSION_SSL) {
|
||||||
my_setopt_str(curl, CURLOPT_SSH_KNOWNHOSTS, file);
|
if(config->insecure_ok) {
|
||||||
curl_free(file);
|
my_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);
|
||||||
|
my_setopt(curl, CURLOPT_SSL_VERIFYHOST, 1L);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
my_setopt(curl, CURLOPT_SSL_VERIFYPEER, 1L);
|
||||||
|
/* libcurl default is strict verifyhost -> 2L */
|
||||||
|
/* my_setopt(curl, CURLOPT_SSL_VERIFYHOST, 2L); */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(built_in_protos & (CURLPROTO_SCP|CURLPROTO_SFTP)) {
|
||||||
|
if(!config->insecure_ok) {
|
||||||
|
char *home;
|
||||||
|
char *file;
|
||||||
|
res = CURLE_OUT_OF_MEMORY;
|
||||||
|
home = homedir();
|
||||||
|
if(home) {
|
||||||
|
file = aprintf("%s/%sssh/known_hosts", home, DOT_CHAR);
|
||||||
|
if(file) {
|
||||||
|
/* new in curl 7.19.6 */
|
||||||
|
res = res_setopt_str(curl, CURLOPT_SSH_KNOWNHOSTS, file);
|
||||||
|
curl_free(file);
|
||||||
|
if(res == CURLE_UNKNOWN_OPTION)
|
||||||
|
/* libssh2 version older than 1.1.1 */
|
||||||
|
res = CURLE_OK;
|
||||||
|
}
|
||||||
|
free(home);
|
||||||
|
}
|
||||||
|
if(res) {
|
||||||
/* Free the list of remaining URLs and globbed upload files
|
/* Free the list of remaining URLs and globbed upload files
|
||||||
* to force curl to exit immediately
|
* to force curl to exit immediately */
|
||||||
*/
|
|
||||||
if(urls) {
|
if(urls) {
|
||||||
glob_cleanup(urls);
|
glob_cleanup(urls);
|
||||||
urls = NULL;
|
urls = NULL;
|
||||||
@ -4465,28 +4545,39 @@ operate(struct Configurable *config, int argc, argv_item_t argv[])
|
|||||||
glob_cleanup(inglob);
|
glob_cleanup(inglob);
|
||||||
inglob = NULL;
|
inglob = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
res = CURLE_OUT_OF_MEMORY;
|
|
||||||
goto quit_urls;
|
goto quit_urls;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(config->no_body || config->remote_time) {
|
if(config->no_body || config->remote_time) {
|
||||||
/* no body or use remote time */
|
/* no body or use remote time */
|
||||||
my_setopt(curl, CURLOPT_FILETIME, TRUE);
|
my_setopt(curl, CURLOPT_FILETIME, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
my_setopt(curl, CURLOPT_MAXREDIRS, config->maxredirs);
|
|
||||||
my_setopt(curl, CURLOPT_CRLF, config->crlf);
|
my_setopt(curl, CURLOPT_CRLF, config->crlf);
|
||||||
my_setopt(curl, CURLOPT_QUOTE, config->quote);
|
my_setopt(curl, CURLOPT_QUOTE, config->quote);
|
||||||
my_setopt(curl, CURLOPT_POSTQUOTE, config->postquote);
|
my_setopt(curl, CURLOPT_POSTQUOTE, config->postquote);
|
||||||
my_setopt(curl, CURLOPT_PREQUOTE, config->prequote);
|
my_setopt(curl, CURLOPT_PREQUOTE, config->prequote);
|
||||||
|
|
||||||
|
#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_COOKIES)
|
||||||
|
{
|
||||||
|
/* TODO: Make this a run-time check instead of compile-time one. */
|
||||||
|
|
||||||
|
if(config->cookie)
|
||||||
|
my_setopt_str(curl, CURLOPT_COOKIE, config->cookie);
|
||||||
|
|
||||||
|
if(config->cookiefile)
|
||||||
my_setopt_str(curl, CURLOPT_COOKIEFILE, config->cookiefile);
|
my_setopt_str(curl, CURLOPT_COOKIEFILE, config->cookiefile);
|
||||||
/* cookie jar was added in 7.9 */
|
|
||||||
|
/* new in libcurl 7.9 */
|
||||||
if(config->cookiejar)
|
if(config->cookiejar)
|
||||||
my_setopt_str(curl, CURLOPT_COOKIEJAR, config->cookiejar);
|
my_setopt_str(curl, CURLOPT_COOKIEJAR, config->cookiejar);
|
||||||
/* cookie session added in 7.9.7 */
|
|
||||||
|
/* new in libcurl 7.9.7 */
|
||||||
my_setopt(curl, CURLOPT_COOKIESESSION, config->cookiesession);
|
my_setopt(curl, CURLOPT_COOKIESESSION, config->cookiesession);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
my_setopt(curl, CURLOPT_SSLVERSION, config->ssl_version);
|
my_setopt(curl, CURLOPT_SSLVERSION, config->ssl_version);
|
||||||
my_setopt(curl, CURLOPT_TIMECONDITION, config->timecond);
|
my_setopt(curl, CURLOPT_TIMECONDITION, config->timecond);
|
||||||
@ -4495,7 +4586,6 @@ operate(struct Configurable *config, int argc, argv_item_t argv[])
|
|||||||
my_setopt(curl, CURLOPT_STDERR, config->errors);
|
my_setopt(curl, CURLOPT_STDERR, config->errors);
|
||||||
|
|
||||||
/* three new ones in libcurl 7.3: */
|
/* three new ones in libcurl 7.3: */
|
||||||
my_setopt(curl, CURLOPT_HTTPPROXYTUNNEL, config->proxytunnel);
|
|
||||||
my_setopt_str(curl, CURLOPT_INTERFACE, config->iface);
|
my_setopt_str(curl, CURLOPT_INTERFACE, config->iface);
|
||||||
my_setopt_str(curl, CURLOPT_KRBLEVEL, config->krblevel);
|
my_setopt_str(curl, CURLOPT_KRBLEVEL, config->krblevel);
|
||||||
|
|
||||||
@ -4519,9 +4609,6 @@ operate(struct Configurable *config, int argc, argv_item_t argv[])
|
|||||||
if(config->cipher_list)
|
if(config->cipher_list)
|
||||||
my_setopt_str(curl, CURLOPT_SSL_CIPHER_LIST, config->cipher_list);
|
my_setopt_str(curl, CURLOPT_SSL_CIPHER_LIST, config->cipher_list);
|
||||||
|
|
||||||
if(config->httpversion)
|
|
||||||
my_setopt(curl, CURLOPT_HTTP_VERSION, config->httpversion);
|
|
||||||
|
|
||||||
/* new in libcurl 7.9.2: */
|
/* new in libcurl 7.9.2: */
|
||||||
if(config->disable_epsv)
|
if(config->disable_epsv)
|
||||||
/* disable it */
|
/* disable it */
|
||||||
@ -4532,10 +4619,6 @@ operate(struct Configurable *config, int argc, argv_item_t argv[])
|
|||||||
/* disable it */
|
/* disable it */
|
||||||
my_setopt(curl, CURLOPT_FTP_USE_EPRT, FALSE);
|
my_setopt(curl, CURLOPT_FTP_USE_EPRT, FALSE);
|
||||||
|
|
||||||
/* new in libcurl 7.10.6 (default is Basic) */
|
|
||||||
if(config->authtype)
|
|
||||||
my_setopt(curl, CURLOPT_HTTPAUTH, config->authtype);
|
|
||||||
|
|
||||||
if(config->tracetype != TRACE_NONE) {
|
if(config->tracetype != TRACE_NONE) {
|
||||||
my_setopt(curl, CURLOPT_DEBUGFUNCTION, my_trace);
|
my_setopt(curl, CURLOPT_DEBUGFUNCTION, my_trace);
|
||||||
my_setopt(curl, CURLOPT_DEBUGDATA, config);
|
my_setopt(curl, CURLOPT_DEBUGDATA, config);
|
||||||
@ -4550,25 +4633,9 @@ operate(struct Configurable *config, int argc, argv_item_t argv[])
|
|||||||
my_setopt(curl, CURLOPT_SSLENGINE_DEFAULT, 1);
|
my_setopt(curl, CURLOPT_SSLENGINE_DEFAULT, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(config->encoding)
|
|
||||||
my_setopt_str(curl, CURLOPT_ACCEPT_ENCODING, "");
|
|
||||||
|
|
||||||
if(config->tr_encoding)
|
|
||||||
my_setopt(curl, CURLOPT_TRANSFER_ENCODING, 1);
|
|
||||||
|
|
||||||
/* new in curl 7.10.7, extended in 7.19.4 but this only sets 0 or 1 */
|
/* new in curl 7.10.7, extended in 7.19.4 but this only sets 0 or 1 */
|
||||||
my_setopt(curl, CURLOPT_FTP_CREATE_MISSING_DIRS,
|
my_setopt(curl, CURLOPT_FTP_CREATE_MISSING_DIRS,
|
||||||
config->ftp_create_dirs);
|
config->ftp_create_dirs);
|
||||||
if(config->proxyanyauth)
|
|
||||||
my_setopt(curl, CURLOPT_PROXYAUTH, CURLAUTH_ANY);
|
|
||||||
else if(config->proxynegotiate)
|
|
||||||
my_setopt(curl, CURLOPT_PROXYAUTH, CURLAUTH_GSSNEGOTIATE);
|
|
||||||
else if(config->proxyntlm)
|
|
||||||
my_setopt(curl, CURLOPT_PROXYAUTH, CURLAUTH_NTLM);
|
|
||||||
else if(config->proxydigest)
|
|
||||||
my_setopt(curl, CURLOPT_PROXYAUTH, CURLAUTH_DIGEST);
|
|
||||||
else if(config->proxybasic)
|
|
||||||
my_setopt(curl, CURLOPT_PROXYAUTH, CURLAUTH_BASIC);
|
|
||||||
|
|
||||||
/* new in curl 7.10.8 */
|
/* new in curl 7.10.8 */
|
||||||
if(config->max_filesize)
|
if(config->max_filesize)
|
||||||
@ -4598,13 +4665,10 @@ operate(struct Configurable *config, int argc, argv_item_t argv[])
|
|||||||
if(config->ftp_ssl_ccc)
|
if(config->ftp_ssl_ccc)
|
||||||
my_setopt(curl, CURLOPT_FTP_SSL_CCC, config->ftp_ssl_ccc_mode);
|
my_setopt(curl, CURLOPT_FTP_SSL_CCC, config->ftp_ssl_ccc_mode);
|
||||||
|
|
||||||
/* new in curl 7.11.1, modified in 7.15.2 */
|
|
||||||
if(config->socksproxy) {
|
|
||||||
my_setopt_str(curl, CURLOPT_PROXY, config->socksproxy);
|
|
||||||
my_setopt(curl, CURLOPT_PROXYTYPE, config->socksver);
|
|
||||||
}
|
|
||||||
|
|
||||||
#if defined(HAVE_GSSAPI) || defined(USE_WINDOWS_SSPI)
|
#if defined(HAVE_GSSAPI) || defined(USE_WINDOWS_SSPI)
|
||||||
|
{
|
||||||
|
/* TODO: Make this a run-time check instead of compile-time one. */
|
||||||
|
|
||||||
/* new in curl 7.19.4 */
|
/* new in curl 7.19.4 */
|
||||||
if(config->socks5_gssapi_service)
|
if(config->socks5_gssapi_service)
|
||||||
my_setopt_str(curl, CURLOPT_SOCKS5_GSSAPI_SERVICE,
|
my_setopt_str(curl, CURLOPT_SOCKS5_GSSAPI_SERVICE,
|
||||||
@ -4614,6 +4678,7 @@ operate(struct Configurable *config, int argc, argv_item_t argv[])
|
|||||||
if(config->socks5_gssapi_nec)
|
if(config->socks5_gssapi_nec)
|
||||||
my_setopt_str(curl, CURLOPT_SOCKS5_GSSAPI_NEC,
|
my_setopt_str(curl, CURLOPT_SOCKS5_GSSAPI_NEC,
|
||||||
config->socks5_gssapi_nec);
|
config->socks5_gssapi_nec);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
/* curl 7.13.0 */
|
/* curl 7.13.0 */
|
||||||
my_setopt_str(curl, CURLOPT_FTP_ACCOUNT, config->ftp_account);
|
my_setopt_str(curl, CURLOPT_FTP_ACCOUNT, config->ftp_account);
|
||||||
@ -4654,10 +4719,6 @@ operate(struct Configurable *config, int argc, argv_item_t argv[])
|
|||||||
my_setopt(curl, CURLOPT_SOCKOPTDATA, config);
|
my_setopt(curl, CURLOPT_SOCKOPTDATA, config);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* curl 7.19.1 (the 301 version existed in 7.18.2) */
|
|
||||||
my_setopt(curl, CURLOPT_POSTREDIR, config->post301 |
|
|
||||||
(config->post302 ? CURL_REDIR_POST_302 : FALSE));
|
|
||||||
|
|
||||||
/* curl 7.20.0 */
|
/* curl 7.20.0 */
|
||||||
if(config->tftp_blksize)
|
if(config->tftp_blksize)
|
||||||
my_setopt(curl, CURLOPT_TFTP_BLKSIZE, config->tftp_blksize);
|
my_setopt(curl, CURLOPT_TFTP_BLKSIZE, config->tftp_blksize);
|
||||||
@ -4694,10 +4755,17 @@ operate(struct Configurable *config, int argc, argv_item_t argv[])
|
|||||||
my_setopt(curl, CURLOPT_RESOLVE, config->resolve);
|
my_setopt(curl, CURLOPT_RESOLVE, config->resolve);
|
||||||
|
|
||||||
/* new in 7.21.4 */
|
/* new in 7.21.4 */
|
||||||
|
if(curlinfo->features & CURL_VERSION_TLSAUTH_SRP) {
|
||||||
if(config->tls_username)
|
if(config->tls_username)
|
||||||
my_setopt_str(curl, CURLOPT_TLSAUTH_USERNAME, config->tls_username);
|
my_setopt_str(curl, CURLOPT_TLSAUTH_USERNAME,
|
||||||
|
config->tls_username);
|
||||||
if(config->tls_password)
|
if(config->tls_password)
|
||||||
my_setopt_str(curl, CURLOPT_TLSAUTH_PASSWORD, config->tls_password);
|
my_setopt_str(curl, CURLOPT_TLSAUTH_PASSWORD,
|
||||||
|
config->tls_password);
|
||||||
|
if(config->tls_authtype)
|
||||||
|
my_setopt_str(curl, CURLOPT_TLSAUTH_TYPE,
|
||||||
|
config->tls_authtype);
|
||||||
|
}
|
||||||
|
|
||||||
/* new in 7.22.0 */
|
/* new in 7.22.0 */
|
||||||
if(config->gssapi_delegation)
|
if(config->gssapi_delegation)
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
# include <curl/curl.h>
|
# include <curl/curl.h>
|
||||||
# include "tool_cfgable.h"
|
# include "tool_cfgable.h"
|
||||||
|
# include "tool_libinfo.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "tool_bname.h"
|
#include "tool_bname.h"
|
||||||
@ -251,10 +252,8 @@ CURLcode FindWin32CACert(struct Configurable *config, const char *bundle_file)
|
|||||||
{
|
{
|
||||||
CURLcode result = CURLE_OK;
|
CURLcode result = CURLE_OK;
|
||||||
|
|
||||||
curl_version_info_data *info = curl_version_info(CURLVERSION_NOW);
|
/* search and set cert file only if libcurl supports SSL */
|
||||||
|
if(curlinfo->features & CURL_VERSION_SSL) {
|
||||||
/* search and set cert file only if "we" support SSL */
|
|
||||||
if(info->features & CURL_VERSION_SSL) {
|
|
||||||
|
|
||||||
DWORD res_len;
|
DWORD res_len;
|
||||||
DWORD buf_tchar_size = PATH_MAX + 1;
|
DWORD buf_tchar_size = PATH_MAX + 1;
|
||||||
|
102
src/tool_libinfo.c
Normal file
102
src/tool_libinfo.c
Normal file
@ -0,0 +1,102 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* _ _ ____ _
|
||||||
|
* Project ___| | | | _ \| |
|
||||||
|
* / __| | | | |_) | |
|
||||||
|
* | (__| |_| | _ <| |___
|
||||||
|
* \___|\___/|_| \_\_____|
|
||||||
|
*
|
||||||
|
* Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
|
*
|
||||||
|
* This software is licensed as described in the file COPYING, which
|
||||||
|
* you should have received as part of this distribution. The terms
|
||||||
|
* are also available at http://curl.haxx.se/docs/copyright.html.
|
||||||
|
*
|
||||||
|
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||||
|
* copies of the Software, and permit persons to whom the Software is
|
||||||
|
* furnished to do so, under the terms of the COPYING file.
|
||||||
|
*
|
||||||
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||||
|
* KIND, either express or implied.
|
||||||
|
*
|
||||||
|
***************************************************************************/
|
||||||
|
#include "setup.h"
|
||||||
|
|
||||||
|
#include <curl/curl.h>
|
||||||
|
|
||||||
|
#include "rawstr.h"
|
||||||
|
|
||||||
|
#define ENABLE_CURLX_PRINTF
|
||||||
|
/* use our own printf() functions */
|
||||||
|
#include "curlx.h"
|
||||||
|
|
||||||
|
#include "tool_libinfo.h"
|
||||||
|
|
||||||
|
#include "memdebug.h" /* keep this as LAST include */
|
||||||
|
|
||||||
|
/* global variable definitions, for libcurl run-time info */
|
||||||
|
|
||||||
|
curl_version_info_data *curlinfo = NULL;
|
||||||
|
long built_in_protos = 0;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* libcurl_info_init: retrieves run-time information about libcurl,
|
||||||
|
* setting a global pointer 'curlinfo' to libcurl's run-time info
|
||||||
|
* struct, and a global bit pattern 'built_in_protos' composed of
|
||||||
|
* CURLPROTO_* bits indicating which protocols are actually built
|
||||||
|
* into library being used.
|
||||||
|
*/
|
||||||
|
|
||||||
|
CURLcode get_libcurl_info(void)
|
||||||
|
{
|
||||||
|
static struct proto_name_pattern {
|
||||||
|
const char *proto_name;
|
||||||
|
long proto_pattern;
|
||||||
|
} const possibly_built_in[] = {
|
||||||
|
{ "dict", CURLPROTO_DICT },
|
||||||
|
{ "file", CURLPROTO_FILE },
|
||||||
|
{ "ftp", CURLPROTO_FTP },
|
||||||
|
{ "ftps", CURLPROTO_FTPS },
|
||||||
|
{ "gopher", CURLPROTO_GOPHER },
|
||||||
|
{ "http", CURLPROTO_HTTP },
|
||||||
|
{ "https", CURLPROTO_HTTPS },
|
||||||
|
{ "imap", CURLPROTO_IMAP },
|
||||||
|
{ "imaps", CURLPROTO_IMAPS },
|
||||||
|
{ "ldap", CURLPROTO_LDAP },
|
||||||
|
{ "ldaps", CURLPROTO_LDAPS },
|
||||||
|
{ "pop3", CURLPROTO_POP3 },
|
||||||
|
{ "pop3s", CURLPROTO_POP3S },
|
||||||
|
{ "rtmp", CURLPROTO_RTMP },
|
||||||
|
{ "rtsp", CURLPROTO_RTSP },
|
||||||
|
{ "scp", CURLPROTO_SCP },
|
||||||
|
{ "sftp", CURLPROTO_SFTP },
|
||||||
|
{ "smtp", CURLPROTO_SMTP },
|
||||||
|
{ "smtps", CURLPROTO_SMTPS },
|
||||||
|
{ "telnet", CURLPROTO_TELNET },
|
||||||
|
{ "tftp", CURLPROTO_TFTP },
|
||||||
|
{ NULL, 0 }
|
||||||
|
};
|
||||||
|
|
||||||
|
struct proto_name_pattern const *p;
|
||||||
|
const char *const *proto;
|
||||||
|
|
||||||
|
/* Pointer to libcurl's run-time version information */
|
||||||
|
curlinfo = curl_version_info(CURLVERSION_NOW);
|
||||||
|
if(!curlinfo)
|
||||||
|
return CURLE_FAILED_INIT;
|
||||||
|
|
||||||
|
/* Build CURLPROTO_* bit pattern with libcurl's built-in protocols */
|
||||||
|
built_in_protos = 0;
|
||||||
|
if(curlinfo->protocols) {
|
||||||
|
for(proto = curlinfo->protocols; *proto; proto++) {
|
||||||
|
for(p = possibly_built_in; p->proto_name; p++) {
|
||||||
|
if(curlx_raw_equal(*proto, p->proto_name)) {
|
||||||
|
built_in_protos |= p->proto_pattern;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return CURLE_OK;
|
||||||
|
}
|
||||||
|
|
34
src/tool_libinfo.h
Normal file
34
src/tool_libinfo.h
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
#ifndef HEADER_CURL_TOOL_LIBINFO_H
|
||||||
|
#define HEADER_CURL_TOOL_LIBINFO_H
|
||||||
|
/***************************************************************************
|
||||||
|
* _ _ ____ _
|
||||||
|
* Project ___| | | | _ \| |
|
||||||
|
* / __| | | | |_) | |
|
||||||
|
* | (__| |_| | _ <| |___
|
||||||
|
* \___|\___/|_| \_\_____|
|
||||||
|
*
|
||||||
|
* Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
|
*
|
||||||
|
* This software is licensed as described in the file COPYING, which
|
||||||
|
* you should have received as part of this distribution. The terms
|
||||||
|
* are also available at http://curl.haxx.se/docs/copyright.html.
|
||||||
|
*
|
||||||
|
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||||
|
* copies of the Software, and permit persons to whom the Software is
|
||||||
|
* furnished to do so, under the terms of the COPYING file.
|
||||||
|
*
|
||||||
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||||
|
* KIND, either express or implied.
|
||||||
|
*
|
||||||
|
***************************************************************************/
|
||||||
|
#include "setup.h"
|
||||||
|
|
||||||
|
/* global variable declarations, for libcurl run-time info */
|
||||||
|
|
||||||
|
extern curl_version_info_data *curlinfo;
|
||||||
|
extern long built_in_protos;
|
||||||
|
|
||||||
|
CURLcode get_libcurl_info(void);
|
||||||
|
|
||||||
|
#endif /* HEADER_CURL_TOOL_LIBINFO_H */
|
||||||
|
|
@ -29,22 +29,18 @@ CURLcode tool_setopt(CURL *curl, bool str, struct Configurable *config,
|
|||||||
/*
|
/*
|
||||||
* Macros used in operate()
|
* Macros used in operate()
|
||||||
*/
|
*/
|
||||||
#if 0
|
|
||||||
#define my_setopt(x,y,z) do { \
|
#define my_setopt(x,y,z) do { \
|
||||||
res = tool_setopt(x, FALSE, config, #y, y, z); \
|
res = tool_setopt(x, FALSE, config, #y, y, z); \
|
||||||
if(res) \
|
if(res) \
|
||||||
goto quit_curl; \
|
goto show_error; \
|
||||||
} WHILE_FALSE
|
} WHILE_FALSE
|
||||||
|
|
||||||
#define my_setopt_str(x,y,z) do { \
|
#define my_setopt_str(x,y,z) do { \
|
||||||
res = tool_setopt(x, TRUE, config, #y, y, z); \
|
res = tool_setopt(x, TRUE, config, #y, y, z); \
|
||||||
if(res) \
|
if(res) \
|
||||||
goto quit_curl; \
|
goto show_error; \
|
||||||
} WHILE_FALSE
|
} WHILE_FALSE
|
||||||
#else
|
|
||||||
#define my_setopt(x,y,z) tool_setopt(x, FALSE, config, #y, y, z)
|
|
||||||
#define my_setopt_str(x,y,z) tool_setopt(x, TRUE, config, #y, y, z)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define res_setopt(x,y,z) tool_setopt(x, FALSE, config, #y, y, z)
|
#define res_setopt(x,y,z) tool_setopt(x, FALSE, config, #y, y, z)
|
||||||
|
|
||||||
|
@ -195,6 +195,10 @@ SOURCE=.\tool_easysrc.c
|
|||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\tool_libinfo.c
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=.\tool_mfiles.c
|
SOURCE=.\tool_mfiles.c
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
@ -299,6 +303,10 @@ SOURCE=.\tool_easysrc.h
|
|||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\tool_libinfo.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=.\tool_mfiles.h
|
SOURCE=.\tool_mfiles.h
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
Loading…
x
Reference in New Issue
Block a user