26 #define ENABLE_CURLX_PRINTF 49 #define GetStr(str,val) do { \ 55 *(str) = strdup((val)); \ 57 return PARAM_NO_MEM; \ 104 {
"*q",
"ftp-create-dirs",
ARG_BOOL},
130 {
"$V",
"retry-connrefused",
ARG_BOOL},
133 {
"$k",
"proxy-negotiate",
ARG_BOOL},
137 {
"$p",
"ignore-content-length",
ARG_BOOL},
138 {
"$q",
"ftp-skip-pasv-ip",
ARG_BOOL},
143 {
"$u",
"ftp-alternative-to-user",
ARG_STRING},
150 {
"$x",
"ftp-ssl-control",
ARG_BOOL},
162 {
"$7",
"socks5-gssapi-nec",
ARG_BOOL},
186 {
"$S",
"tftp-no-options",
ARG_BOOL},
190 {
"$Y",
"suppress-connect-headers",
ARG_BOOL},
195 {
"03",
"http2-prior-knowledge",
ARG_NONE},
232 {
"En",
"ssl-allow-beast",
ARG_BOOL},
249 {
"E4",
"proxy-ssl-allow-beast",
ARG_BOOL},
269 {
"j",
"junk-session-cookies",
ARG_BOOL},
270 {
"J",
"remote-header-name",
ARG_BOOL},
275 {
"Lt",
"location-trusted",
ARG_BOOL},
285 {
"Oa",
"remote-name-all",
ARG_BOOL},
322 size_t param_length = strlen(cert_parameter);
324 const char *param_place = NULL;
325 char *certname_place = NULL;
330 if(param_length == 0)
337 if(!strncmp(cert_parameter,
"pkcs11:", 7) ||
338 !strpbrk(cert_parameter,
":\\")) {
339 *certname =
strdup(cert_parameter);
343 certname_place =
malloc(param_length + 1);
347 *certname = certname_place;
348 param_place = cert_parameter;
349 while(*param_place) {
350 span = strcspn(param_place,
":\\");
351 strncpy(certname_place, param_place, span);
353 certname_place += span;
356 switch(*param_place) {
361 switch(*param_place) {
363 *certname_place++ =
'\\';
366 *certname_place++ =
'\\';
370 *certname_place++ =
':';
374 *certname_place++ =
'\\';
375 *certname_place++ = *param_place;
388 (param_place == &cert_parameter[1]) &&
389 (cert_parameter[2] ==
'\\' || cert_parameter[2] ==
'/') &&
390 (
ISALPHA(cert_parameter[0])) ) {
395 *certname_place++ =
':';
403 if(strlen(param_place) > 0) {
404 *passphrase =
strdup(param_place);
410 *certname_place =
'\0';
435 char subletter =
'\0';
437 const char *parse = NULL;
441 bool longopt =
FALSE;
442 bool singleopt =
FALSE;
449 if((
'-' != flag[0]) ||
450 ((
'-' == flag[0]) && (
'-' == flag[1]))) {
452 const char *word = (
'-' == flag[0]) ? flag + 2 : flag;
453 size_t fnam = strlen(word);
456 if(!strncmp(word,
"no-", 3)) {
462 for(j = 0; j <
sizeof(
aliases)/
sizeof(aliases[0]); j++) {
494 letter = (char)*parse;
499 subletter = parse[1];
503 for(j = 0; j <
sizeof(
aliases)/
sizeof(aliases[0]); j++) {
504 if(letter == aliases[j].letter[0]) {
516 if(!longopt && parse[1]) {
517 nextarg = (
char *)&parse[1];
574 warnf(global,
"--trace overrides an earlier trace/verbose option\n");
584 "--trace-ascii overrides an earlier trace/verbose option\n");
596 warnf(global,
"unsupported rate\n");
602 else if(strlen(unit) > 1)
608 value *= 1024*1024*1024;
623 warnf(global,
"unsupported rate unit. Use G, M, K or B!\n");
726 config->
crlf = toggle;
730 if(strcmp(nextarg,
"-")) {
733 warnf(global,
"Failed to open %s!\n", nextarg);
767 config->
xattr = toggle;
883 rc = sscanf(nextarg,
"%d - %d",
893 warnf(global,
"bad range input\n");
924 #ifdef CURL_DISABLE_LIBCURL_OPTION 926 "--libcurl option was disabled at build-time!\n");
933 config->
raw = toggle;
1005 int mlmaj, mlmin, mlpatch;
1006 metalink_get_version(&mlmaj, &mlmin, &mlpatch);
1007 if((mlmaj*10000)+(mlmin*100) + mlpatch < CURL_REQ_LIBMETALINK_VERS) {
1009 "--metalink option cannot be used because the version of " 1010 "the linked libmetalink library is too old. " 1011 "Required: %d.%d.%d, found %d.%d.%d\n",
1012 CURL_REQ_LIBMETALINK_MAJOR,
1013 CURL_REQ_LIBMETALINK_MINOR,
1014 CURL_REQ_LIBMETALINK_PATCH,
1015 mlmaj, mlmin, mlpatch);
1021 warnf(global,
"--metalink option is ignored because the binary is " 1022 "built without the Metalink support.\n");
1031 config->test_event_based = toggle;
1033 warnf(global,
"--test-event is ignored unless a debug build!\n");
1162 if(nextarg[0] ==
'@') {
1165 else if(strchr(nextarg,
'=')) {
1183 if(strcmp(nextarg,
"-")) {
1198 char *postdata = NULL;
1201 bool raw_mode = (subletter ==
'r');
1203 if(subletter ==
'e') {
1210 const char *
p = strchr(nextarg,
'=');
1215 p = strchr(nextarg,
'@');
1225 if(
'@' == is_file) {
1227 if(!strcmp(
"-", p)) {
1232 file = fopen(p,
"rb");
1235 "Couldn't read data from file \"%s\", this makes " 1236 "an empty POST.\n", nextarg);
1241 if(file && (file != stdin))
1249 size = strlen(postdata);
1266 size_t outlen = nlen + strlen(enc) + 2;
1267 char *n =
malloc(outlen);
1273 snprintf(n, outlen,
"%.*s=%s", nlen, nextarg, enc);
1287 else if(
'@' == *nextarg && !raw_mode) {
1292 if(!strcmp(
"-", nextarg)) {
1294 if(subletter ==
'b')
1298 file = fopen(nextarg,
"rb");
1300 warnf(global,
"Couldn't read data from file \"%s\", this makes " 1301 "an empty POST.\n", nextarg);
1304 if(subletter ==
'b')
1310 size = strlen(postdata);
1313 if(file && (file != stdin))
1327 GetStr(&postdata, nextarg);
1329 size = strlen(postdata);
1332 #ifdef CURL_DOES_CONVERSIONS 1333 if(subletter !=
'b') {
1335 if(convert_to_network(postdata, strlen(postdata))) {
1384 char *
ptr = strstr(nextarg,
";auto");
1622 if(subletter ==
'a') {
1637 if(nextarg[0] ==
'@') {
1641 bool use_stdin = !strcmp(&nextarg[1],
"-");
1644 warnf(global,
"Failed to open %s!\n", &nextarg[1]);
1650 char *h = strtok(
string,
"\r\n");
1652 if(subletter ==
'p')
1658 h = strtok(NULL,
"\r\n");
1669 if(subletter ==
'p')
1697 "--include and --remote-header-name cannot be combined.\n");
1707 warnf(global,
"error trying read config from the '%s' file\n",
1735 "built-in manual was disabled at build-time!\n");
1752 config->
netrc = toggle;
1765 if(subletter ==
'a') {
1828 switch(nextarg[0]) {
1851 if(
ISDIGIT(*nextarg) && !strchr(nextarg,
'-')) {
1855 warnf(global,
"unsupported range point\n");
1859 "A specified range MUST include at least one dash (-). " 1860 "Appending one for you!\n");
1870 tmp_range = nextarg;
1871 while(*tmp_range !=
'\0') {
1872 if(!
ISDIGIT(*tmp_range) && *tmp_range !=
'-' && *tmp_range !=
',') {
1873 warnf(global,
"Invalid character is found in given range. " 1874 "A specified range MUST have only digits in " 1875 "\'start\'-\'stop\'. The server's response to this " 1876 "request is uncertain.\n");
1964 "-v, --verbose overrides an earlier trace/verbose option\n");
1978 if(
'@' == *nextarg) {
1984 if(!strcmp(
"-", nextarg)) {
1993 if(file && (file != stdin))
1998 warnf(global,
"Failed to read %s", fname);
2060 if(-1 ==
stat(nextarg, &statbuf)) {
2064 "Illegal date format for -z, --time-cond (and not " 2065 "a file name). Disabling time condition. " 2066 "See curl_getdate(3) for valid date syntax.\n");
2070 config->
condtime = statbuf.st_mtime;
2079 }
while(!longopt && !singleopt && *++parse && !*usedarg);
2089 char *orig_opt = NULL;
2093 for(i = 1, stillflags =
TRUE; i < argc && !
result; i++) {
2096 if(stillflags && (
'-' == argv[i][0])) {
2099 char *flag = argv[
i];
2101 if(!strcmp(
"--", argv[i]))
2106 nextarg = (i < (argc - 1)) ? argv[i + 1] : NULL;
2108 result =
getparameter(flag, nextarg, &passarg, config, operation);
2117 if(operation->
next) {
2132 operation = operation->
next;
2138 else if(!result && passarg)
2146 result =
getparameter((
char *)
"--url", argv[i], &used, config,
2157 if(orig_opt && strcmp(
":", orig_opt))
2158 helpf(config->
errors,
"option %s: %s\n", orig_opt, reason);
struct curl_slist * quote
CURL_EXTERN void curl_free(void *p)
struct OperationConfig * prev
CURL_EXTERN char * curl_easy_escape(CURL *handle, const char *string, int length)
#define CURL_VERSION_LIBZ
struct curl_slist * telnet_options
int stat(const char *path, struct stat *buffer)
char * proxy_service_name
struct curl_slist * headers
UNITTEST_START char * ptr
struct OperationConfig * last
struct curl_slist * prequote
#define CURL_VERSION_TLSAUTH_SRP
struct curl_slist * connect_to
struct GlobalConfig * global
UNITTEST_START int result
#define CURL_VERSION_NTLM
char * ftp_alternative_to_user
struct curl_slist * resolve
memcpy(filename, filename1, strlen(filename1))
#define CURLAUTH_NEGOTIATE
curl_off_t curlx_uztoso(size_t uznum)
char * proxy_tls_password
bool abstract_unix_socket
CURLofft curlx_strtoofft(const char *str, char **endp, int base, curl_off_t *num)
#define CURL_VERSION_NTLM_WB
CURL_TYPEOF_CURL_OFF_T curl_off_t
struct OperationConfig * next
CURL_EXTERN int curl_strequal(const char *s1, const char *s2)
bool proxy_ssl_allow_beast
struct curl_slist * postquote
#define Curl_safefree(ptr)
char * proxy_tls_authtype
struct curl_slist * proxyheaders
CURL_EXTERN time_t curl_getdate(const char *p, const time_t *unused)
unsigned long socks5_auth
UNITTEST_START int * value
bool suppress_connect_headers
CURL_EXTERN int curl_strnequal(const char *s1, const char *s2, size_t n)
#define CURL_VERSION_KERBEROS4
struct OperationConfig * first
#define CURL_VERSION_SPNEGO
char * proxy_tls_username
struct curl_slist * mail_rcpt
#define CURL_FORMAT_CURL_OFF_T