Lines Matching refs:config

108                                 struct OperationConfig *config,
333 struct OperationConfig *config = per->config; /* for the macro below */
335 (void)config;
349 void single_transfer_cleanup(struct OperationConfig *config)
351 if(config) {
352 struct State *state = &config->state;
379 struct OperationConfig *config = per->config;
382 if(!curl || !config)
399 if(!config->synthetic_error && result &&
407 else if(config->failwithbody) {
420 if(!result && config->xattr && outs->fopened && outs->stream) {
423 warnf(config->global, "Error setting extended attributes on '%s': %s",
435 if(!cond_unmet && !tool_create_output_file(outs, config))
458 (!config->retry_maxtime ||
460 config->retry_maxtime*1000L)) ) {
477 else if(config->retry_connrefused &&
485 ((config->failonerror || config->failwithbody) &&
535 if(result && !retry && config->retry_all_errors)
563 if(config->retry_maxtime) {
567 (seconds + retry_after > config->retry_maxtime)) {
568 warnf(config->global, "The Retry-After: time would "
576 warnf(config->global, "Problem %s. "
582 if(!config->retry_delay) {
590 notef(config->global,
599 errorf(config->global, "Failed to truncate file");
613 errorf(config->global, "Failed seeking to end of file");
637 errorf(config->global, "curl: (%d) Failed writing body", result);
639 if(result && config->rm_partial) {
655 if(!result && config->remote_time && outs->s_isreg && outs->filename) {
663 if(config->writeout)
664 ourWriteOut(config, per, result);
695 struct OperationConfig *config,
713 result = ipfs_url_rewrite(uh, schemep, url, config);
720 config->synthetic_error = TRUE;
737 struct OperationConfig *config,
746 struct State *state = &config->state;
751 if(config->postfields) {
752 if(config->use_httpget) {
755 httpgetfields = state->httpgetfields = config->postfields;
756 config->postfields = NULL;
757 if(SetHTTPrequest(config,
758 (config->no_body?HTTPREQ_HEAD:HTTPREQ_GET),
759 &config->httpreq)) {
765 if(SetHTTPrequest(config, HTTPREQ_SIMPLEPOST, &config->httpreq))
769 single_transfer_cleanup(config);
775 state->urlnode = config->url_list;
779 while(config->state.urlnode) {
783 urlnode = config->state.urlnode;
793 config->state.urlnode = urlnode->next;
797 warnf(config->global, "Got more output options than URLs");
815 if(!config->globoff && infiles && !inglob) {
822 config->state.inglob = inglob;
850 if(!config->globoff) {
882 if(config->etag_compare_file) {
888 FILE *file = fopen(config->etag_compare_file, FOPEN_READTEXT);
889 if(!file && !config->etag_save_file) {
891 "Failed to open %s", config->etag_compare_file);
914 pe = add2list(&config->headers, header);
925 if(config->etag_save_file) {
927 if(strcmp(config->etag_save_file, "-")) {
928 FILE *newfile = fopen(config->etag_save_file, "wb");
931 "Skip this transfer", config->etag_save_file);
937 etag_save->filename = config->etag_save_file;
968 if(SetHTTPrequest(config, HTTPREQ_PUT, &config->httpreq)) {
976 per->config = config;
985 if(config->headerfile) {
987 if(strcmp(config->headerfile, "-")) {
999 if(!per->prev || per->prev->config != config) {
1000 newfile = fopen(config->headerfile, "wb");
1004 newfile = fopen(config->headerfile, "ab");
1007 errorf(global, "Failed to open %s", config->headerfile);
1012 heads->filename = config->headerfile;
1076 if(!*per->outfile && !config->content_disposition) {
1099 if(config->output_dir && *config->output_dir) {
1100 char *d = aprintf("%s/%s", config->output_dir, per->outfile);
1111 if(config->create_dirs) {
1119 && config->content_disposition) {
1124 if(config->resume_from_current) {
1131 config->resume_from = fileinfo.st_size;
1134 config->resume_from = 0;
1137 if(config->resume_from) {
1154 outs->init = config->resume_from;
1178 if(config->authtype & (1UL << bitcheck++)) {
1191 if(config->proxyanyauth || (authbits>1)) {
1209 if(per->uploadfile && config->resume_from_current)
1210 config->resume_from = -1; /* -1 will then force get-it-yourself */
1218 /* progress meter is per download, so restore config
1224 if(httpgetfields || config->query) {
1225 char *q = httpgetfields ? httpgetfields : config->query;
1235 config->synthetic_error = TRUE;
1257 !config->use_ascii) {
1264 config->terminal_binary_ok =
1273 result = url_proto(&per->this_url, config, &use_proto);
1286 if(!config->tcp_nodelay)
1289 if(config->tcp_fastopen)
1325 if(config->recvpersecond &&
1326 (config->recvpersecond < BUFFER_SIZE))
1328 my_setopt(curl, CURLOPT_BUFFERSIZE, (long)config->recvpersecond);
1336 if(config->no_body)
1339 if(config->oauth_bearer)
1340 my_setopt_str(curl, CURLOPT_XOAUTH2_BEARER, config->oauth_bearer);
1342 my_setopt_str(curl, CURLOPT_PROXY, config->proxy);
1344 if(config->proxy && result) {
1346 config->synthetic_error = TRUE;
1352 if(config->proxy)
1353 my_setopt_enum(curl, CURLOPT_PROXYTYPE, config->proxyver);
1355 my_setopt_str(curl, CURLOPT_PROXYUSERPWD, config->proxyuserpwd);
1358 my_setopt(curl, CURLOPT_HTTPPROXYTUNNEL, config->proxytunnel?1L:0L);
1361 if(config->preproxy)
1362 my_setopt_str(curl, CURLOPT_PRE_PROXY, config->preproxy);
1365 if(config->proxyanyauth)
1368 else if(config->proxynegotiate)
1371 else if(config->proxyntlm)
1374 else if(config->proxydigest)
1377 else if(config->proxybasic)
1382 my_setopt_str(curl, CURLOPT_NOPROXY, config->noproxy);
1385 config->suppress_connect_headers?1L:0L);
1387 my_setopt(curl, CURLOPT_FAILONERROR, config->failonerror?1L:0L);
1388 my_setopt(curl, CURLOPT_REQUEST_TARGET, config->request_target);
1390 my_setopt(curl, CURLOPT_DIRLISTONLY, config->dirlistonly?1L:0L);
1391 my_setopt(curl, CURLOPT_APPEND, config->ftp_append?1L:0L);
1393 if(config->netrc_opt)
1395 else if(config->netrc || config->netrc_file)
1400 if(config->netrc_file)
1401 my_setopt_str(curl, CURLOPT_NETRC_FILE, config->netrc_file);
1403 my_setopt(curl, CURLOPT_TRANSFERTEXT, config->use_ascii?1L:0L);
1404 if(config->login_options)
1405 my_setopt_str(curl, CURLOPT_LOGIN_OPTIONS, config->login_options);
1406 my_setopt_str(curl, CURLOPT_USERPWD, config->userpwd);
1407 my_setopt_str(curl, CURLOPT_RANGE, config->range);
1412 my_setopt(curl, CURLOPT_TIMEOUT_MS, config->timeout_ms);
1414 switch(config->httpreq) {
1416 if(config->resume_from) {
1422 curlx_dyn_ptr(&config->postdata));
1424 (curl_off_t)curlx_dyn_len(&config->postdata));
1429 curl_mime_free(config->mimepost);
1430 config->mimepost = NULL;
1431 if(config->resume_from) {
1436 result = tool2curlmime(curl, config->mimeroot, &config->mimepost);
1438 my_setopt_mimepost(curl, CURLOPT_MIMEPOST, config->mimepost);
1448 if(config->mime_options)
1449 my_setopt(curl, CURLOPT_MIME_OPTIONS, config->mime_options);
1452 if(config->authtype)
1453 my_setopt_bitmask(curl, CURLOPT_HTTPAUTH, (long)config->authtype);
1455 my_setopt_slist(curl, CURLOPT_HTTPHEADER, config->headers);
1458 my_setopt_str(curl, CURLOPT_REFERER, config->referer);
1459 my_setopt_str(curl, CURLOPT_USERAGENT, config->useragent);
1466 config->followlocation?1L:0L);
1468 config->unrestricted_auth?1L:0L);
1469 my_setopt_str(curl, CURLOPT_AWS_SIGV4, config->aws_sigv4);
1470 my_setopt(curl, CURLOPT_AUTOREFERER, config->autoreferer?1L:0L);
1473 if(config->proxyheaders) {
1474 my_setopt_slist(curl, CURLOPT_PROXYHEADER, config->proxyheaders);
1479 my_setopt(curl, CURLOPT_MAXREDIRS, config->maxredirs);
1481 if(config->httpversion)
1482 my_setopt_enum(curl, CURLOPT_HTTP_VERSION, config->httpversion);
1488 if(config->post301)
1490 if(config->post302)
1492 if(config->post303)
1497 if(config->encoding)
1501 if(config->tr_encoding)
1505 config->http09_allowed ? 1L : 0L);
1514 my_setopt_str(curl, CURLOPT_FTPPORT, config->ftpport);
1516 config->low_speed_limit);
1517 my_setopt(curl, CURLOPT_LOW_SPEED_TIME, config->low_speed_time);
1519 config->sendpersecond);
1521 config->recvpersecond);
1523 if(config->use_resume)
1524 my_setopt(curl, CURLOPT_RESUME_FROM_LARGE, config->resume_from);
1528 my_setopt_str(curl, CURLOPT_KEYPASSWD, config->key_passwd);
1529 my_setopt_str(curl, CURLOPT_PROXY_KEYPASSWD, config->proxy_key_passwd);
1534 my_setopt_str(curl, CURLOPT_SSH_PRIVATE_KEYFILE, config->key);
1536 my_setopt_str(curl, CURLOPT_SSH_PUBLIC_KEYFILE, config->pubkey);
1541 config->hostpubmd5);
1546 config->hostpubsha256);
1549 if(config->ssh_compression)
1553 if(config->cacert)
1554 my_setopt_str(curl, CURLOPT_CAINFO, config->cacert);
1555 if(config->proxy_cacert)
1556 my_setopt_str(curl, CURLOPT_PROXY_CAINFO, config->proxy_cacert);
1558 if(config->capath) {
1559 result = res_setopt_str(curl, CURLOPT_CAPATH, config->capath);
1570 if(config->proxy_capath || config->capath) {
1572 (config->proxy_capath ?
1573 config->proxy_capath :
1574 config->capath));
1577 if(config->proxy_capath) {
1586 if(config->crlfile)
1587 my_setopt_str(curl, CURLOPT_CRLFILE, config->crlfile);
1588 if(config->proxy_crlfile)
1589 my_setopt_str(curl, CURLOPT_PROXY_CRLFILE, config->proxy_crlfile);
1590 else if(config->crlfile) /* CURLOPT_PROXY_CRLFILE default is crlfile */
1591 my_setopt_str(curl, CURLOPT_PROXY_CRLFILE, config->crlfile);
1593 if(config->pinnedpubkey)
1594 my_setopt_str(curl, CURLOPT_PINNEDPUBLICKEY, config->pinnedpubkey);
1596 if(config->ssl_ec_curves)
1597 my_setopt_str(curl, CURLOPT_SSL_EC_CURVES, config->ssl_ec_curves);
1599 if(config->writeout)
1603 /* Check if config->cert is a PKCS#11 URI and set the
1604 * config->cert_type if necessary */
1605 if(config->cert) {
1606 if(!config->cert_type) {
1607 if(is_pkcs11_uri(config->cert)) {
1608 config->cert_type = strdup("ENG");
1613 /* Check if config->key is a PKCS#11 URI and set the
1614 * config->key_type if necessary */
1615 if(config->key) {
1616 if(!config->key_type) {
1617 if(is_pkcs11_uri(config->key)) {
1618 config->key_type = strdup("ENG");
1623 /* Check if config->proxy_cert is a PKCS#11 URI and set the
1624 * config->proxy_type if necessary */
1625 if(config->proxy_cert) {
1626 if(!config->proxy_cert_type) {
1627 if(is_pkcs11_uri(config->proxy_cert)) {
1628 config->proxy_cert_type = strdup("ENG");
1633 /* Check if config->proxy_key is a PKCS#11 URI and set the
1634 * config->proxy_key_type if necessary */
1635 if(config->proxy_key) {
1636 if(!config->proxy_key_type) {
1637 if(is_pkcs11_uri(config->proxy_key)) {
1638 config->proxy_key_type = strdup("ENG");
1649 if(config->cert && (strlen(config->cert) > 8) &&
1650 (memcmp(config->cert, "loadmem=",8) == 0)) {
1651 FILE *fInCert = fopen(config->cert + 8, "rb");
1684 my_setopt_str(curl, CURLOPT_SSLCERT, config->cert);
1685 my_setopt_str(curl, CURLOPT_PROXY_SSLCERT, config->proxy_cert);
1686 my_setopt_str(curl, CURLOPT_SSLCERTTYPE, config->cert_type);
1688 config->proxy_cert_type);
1692 if(config->key && (strlen(config->key) > 8) &&
1693 (memcmp(config->key, "loadmem=",8) == 0)) {
1694 FILE *fInCert = fopen(config->key + 8, "rb");
1727 my_setopt_str(curl, CURLOPT_SSLKEY, config->key);
1728 my_setopt_str(curl, CURLOPT_PROXY_SSLKEY, config->proxy_key);
1729 my_setopt_str(curl, CURLOPT_SSLKEYTYPE, config->key_type);
1731 config->proxy_key_type);
1732 if(config->insecure_ok) {
1742 if(config->doh_insecure_ok) {
1747 if(config->proxy_insecure_ok) {
1755 if(config->verifystatus)
1758 if(config->doh_verifystatus)
1761 if(config->falsestart)
1765 config->ssl_version | config->ssl_version_max);
1766 if(config->proxy)
1768 config->proxy_ssl_version);
1772 (config->ssl_allow_beast ?
1774 (config->ssl_no_revoke ?
1776 (config->ssl_revoke_best_effort ?
1778 (config->native_ca_store ?
1780 (config->ssl_auto_client_cert ?
1789 (config->proxy_ssl_allow_beast ?
1791 (config->proxy_ssl_auto_client_cert ?
1793 (config->proxy_native_ca_store ?
1801 if(config->path_as_is)
1805 !config->insecure_ok) {
1821 if(config->no_body || config->remote_time) {
1826 my_setopt(curl, CURLOPT_CRLF, config->crlf?1L:0L);
1827 my_setopt_slist(curl, CURLOPT_QUOTE, config->quote);
1828 my_setopt_slist(curl, CURLOPT_POSTQUOTE, config->postquote);
1829 my_setopt_slist(curl, CURLOPT_PREQUOTE, config->prequote);
1831 if(config->cookies) {
1838 for(cl = config->cookies; cl; cl = cl->next) {
1839 if(cl == config->cookies)
1856 if(config->cookiefiles) {
1859 for(cfl = config->cookiefiles; cfl; cfl = cfl->next)
1864 if(config->cookiejar)
1865 my_setopt_str(curl, CURLOPT_COOKIEJAR, config->cookiejar);
1868 my_setopt(curl, CURLOPT_COOKIESESSION, config->cookiesession?1L:0L);
1870 my_setopt_enum(curl, CURLOPT_TIMECONDITION, (long)config->timecond);
1871 my_setopt(curl, CURLOPT_TIMEVALUE_LARGE, config->condtime);
1872 my_setopt_str(curl, CURLOPT_CUSTOMREQUEST, config->customrequest);
1873 customrequest_helper(config, config->httpreq, config->customrequest);
1877 my_setopt_str(curl, CURLOPT_INTERFACE, config->iface);
1878 my_setopt_str(curl, CURLOPT_KRBLEVEL, config->krblevel);
1879 progressbarinit(&per->progressbar, config);
1897 if(config->dns_servers)
1898 my_setopt_str(curl, CURLOPT_DNS_SERVERS, config->dns_servers);
1901 if(config->dns_interface)
1902 my_setopt_str(curl, CURLOPT_DNS_INTERFACE, config->dns_interface);
1903 if(config->dns_ipv4_addr)
1904 my_setopt_str(curl, CURLOPT_DNS_LOCAL_IP4, config->dns_ipv4_addr);
1905 if(config->dns_ipv6_addr)
1906 my_setopt_str(curl, CURLOPT_DNS_LOCAL_IP6, config->dns_ipv6_addr);
1909 my_setopt_slist(curl, CURLOPT_TELNETOPTIONS, config->telnet_options);
1912 my_setopt(curl, CURLOPT_CONNECTTIMEOUT_MS, config->connecttimeout_ms);
1914 if(config->doh_url)
1915 my_setopt_str(curl, CURLOPT_DOH_URL, config->doh_url);
1917 if(config->cipher_list)
1918 my_setopt_str(curl, CURLOPT_SSL_CIPHER_LIST, config->cipher_list);
1920 if(config->proxy_cipher_list)
1922 config->proxy_cipher_list);
1924 if(config->cipher13_list)
1925 my_setopt_str(curl, CURLOPT_TLS13_CIPHERS, config->cipher13_list);
1927 if(config->proxy_cipher13_list)
1929 config->proxy_cipher13_list);
1932 if(config->disable_epsv)
1937 if(config->disable_eprt)
1943 my_setopt(curl, CURLOPT_DEBUGDATA, config);
1948 if(config->engine) {
1949 result = res_setopt_str(curl, CURLOPT_SSLENGINE, config->engine);
1957 (long)(config->ftp_create_dirs?
1962 if(config->max_filesize)
1964 config->max_filesize);
1966 my_setopt(curl, CURLOPT_IPRESOLVE, config->ip_version);
1969 if(config->ftp_ssl_reqd)
1973 else if(config->ftp_ssl)
1977 else if(config->ftp_ssl_control)
1981 if(config->ftp_ssl_ccc)
1983 (long)config->ftp_ssl_ccc_mode);
1986 if(config->socks5_gssapi_nec)
1990 if(config->socks5_auth)
1992 (long)config->socks5_auth);
1995 if(config->proxy_service_name)
1997 config->proxy_service_name);
2000 if(config->service_name)
2002 config->service_name);
2005 my_setopt_str(curl, CURLOPT_FTP_ACCOUNT, config->ftp_account);
2006 my_setopt(curl, CURLOPT_IGNORE_CONTENT_LENGTH, config->ignorecl?1L:0L);
2009 my_setopt(curl, CURLOPT_FTP_SKIP_PASV_IP, config->ftp_skip_ip?1L:0L);
2014 (long)config->ftp_filemethod);
2017 if(config->localport) {
2018 my_setopt(curl, CURLOPT_LOCALPORT, config->localport);
2019 my_setopt_str(curl, CURLOPT_LOCALPORTRANGE, config->localportrange);
2024 config->ftp_alternative_to_user);
2027 if(config->disable_sessionid)
2032 if(config->raw) {
2038 if(!config->nokeepalive) {
2040 if(config->alivetime) {
2041 my_setopt(curl, CURLOPT_TCP_KEEPIDLE, config->alivetime);
2042 my_setopt(curl, CURLOPT_TCP_KEEPINTVL, config->alivetime);
2049 if(config->tftp_blksize && proto_tftp)
2050 my_setopt(curl, CURLOPT_TFTP_BLKSIZE, config->tftp_blksize);
2052 if(config->mail_from)
2053 my_setopt_str(curl, CURLOPT_MAIL_FROM, config->mail_from);
2055 if(config->mail_rcpt)
2056 my_setopt_slist(curl, CURLOPT_MAIL_RCPT, config->mail_rcpt);
2060 config->mail_rcpt_allowfails ? 1L : 0L);
2063 if(config->ftp_pret)
2066 if(config->create_file_mode)
2067 my_setopt(curl, CURLOPT_NEW_FILE_PERMS, config->create_file_mode);
2069 if(config->proto_present)
2070 my_setopt_str(curl, CURLOPT_PROTOCOLS_STR, config->proto_str);
2071 if(config->proto_redir_present)
2073 config->proto_redir_str);
2075 if(config->content_disposition
2085 hdrcbdata->config = config;
2090 if(config->resolve)
2092 my_setopt_slist(curl, CURLOPT_RESOLVE, config->resolve);
2094 if(config->connect_to)
2096 my_setopt_slist(curl, CURLOPT_CONNECT_TO, config->connect_to);
2100 if(config->tls_username)
2102 config->tls_username);
2103 if(config->tls_password)
2105 config->tls_password);
2106 if(config->tls_authtype)
2108 config->tls_authtype);
2109 if(config->proxy_tls_username)
2111 config->proxy_tls_username);
2112 if(config->proxy_tls_password)
2114 config->proxy_tls_password);
2115 if(config->proxy_tls_authtype)
2117 config->proxy_tls_authtype);
2121 if(config->gssapi_delegation)
2123 config->gssapi_delegation);
2125 if(config->mail_auth)
2126 my_setopt_str(curl, CURLOPT_MAIL_AUTH, config->mail_auth);
2129 if(config->sasl_authzid)
2130 my_setopt_str(curl, CURLOPT_SASL_AUTHZID, config->sasl_authzid);
2133 if(config->sasl_ir)
2136 if(config->noalpn) {
2141 if(config->unix_socket_path) {
2142 if(config->abstract_unix_socket) {
2144 config->unix_socket_path);
2148 config->unix_socket_path);
2153 if(config->proto_default)
2154 my_setopt_str(curl, CURLOPT_DEFAULT_PROTOCOL, config->proto_default);
2157 if(config->expect100timeout_ms > 0)
2159 config->expect100timeout_ms);
2162 if(config->tftp_no_options && proto_tftp)
2166 if(config->happy_eyeballs_timeout_ms != CURL_HET_DEFAULT)
2168 config->happy_eyeballs_timeout_ms);
2171 if(config->haproxy_protocol)
2175 if(config->haproxy_clientip)
2177 config->haproxy_clientip);
2179 if(config->disallow_username_in_url)
2182 if(config->altsvc)
2183 my_setopt_str(curl, CURLOPT_ALTSVC, config->altsvc);
2185 if(config->hsts)
2186 my_setopt_str(curl, CURLOPT_HSTS, config->hsts);
2189 per->retry_sleep_default = (config->retry_delay) ?
2190 config->retry_delay*1000L : RETRY_SLEEP_DEFAULT; /* ms */
2191 per->retry_numretries = config->req_retry;
2223 config->state.urlnode = urlnode->next;
2234 single_transfer_cleanup(config);
2533 /* setup a transfer for the given config */
2535 struct OperationConfig *config,
2544 if(!config->url_list || !config->url_list->url) {
2559 if(!config->cacert &&
2560 !config->capath &&
2561 (!config->insecure_ok || (config->doh_url && !config->doh_insecure_ok))) {
2588 config->cacert = strdup(env);
2589 if(!config->cacert) {
2599 config->capath = strdup(env);
2600 if(!config->capath) {
2611 config->cacert = strdup(env);
2612 if(!config->cacert) {
2615 free(config->capath);
2627 result = FindWin32CACert(config, tls_backend_info->backend,
2636 result = single_transfer(global, config, share, capath_from_env, added);
2690 clean_getout(per->config);
2695 /* Reset the global config variables */