Home | History | Annotate | Download | only in src
      1 #ifndef HEADER_CURL_TOOL_CFGABLE_H
      2 #define HEADER_CURL_TOOL_CFGABLE_H
      3 /***************************************************************************
      4  *                                  _   _ ____  _
      5  *  Project                     ___| | | |  _ \| |
      6  *                             / __| | | | |_) | |
      7  *                            | (__| |_| |  _ <| |___
      8  *                             \___|\___/|_| \_\_____|
      9  *
     10  * Copyright (C) 1998 - 2019, Daniel Stenberg, <daniel (at) haxx.se>, et al.
     11  *
     12  * This software is licensed as described in the file COPYING, which
     13  * you should have received as part of this distribution. The terms
     14  * are also available at https://curl.haxx.se/docs/copyright.html.
     15  *
     16  * You may opt to use, copy, modify, merge, publish, distribute and/or sell
     17  * copies of the Software, and permit persons to whom the Software is
     18  * furnished to do so, under the terms of the COPYING file.
     19  *
     20  * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
     21  * KIND, either express or implied.
     22  *
     23  ***************************************************************************/
     24 #include "tool_setup.h"
     25 
     26 #include "tool_sdecls.h"
     27 
     28 #include "tool_metalink.h"
     29 
     30 #include "tool_formparse.h"
     31 
     32 typedef enum {
     33   ERR_NONE,
     34   ERR_BINARY_TERMINAL = 1, /* binary to terminal detected */
     35   ERR_LAST
     36 } curl_error;
     37 
     38 struct GlobalConfig;
     39 
     40 struct OperationConfig {
     41   CURL *easy;               /* A copy of the handle from GlobalConfig */
     42   bool remote_time;
     43   char *random_file;
     44   char *egd_file;
     45   char *useragent;
     46   char *cookie;             /* single line with specified cookies */
     47   char *cookiejar;          /* write to this file */
     48   char *cookiefile;         /* read from this file */
     49   char *altsvc;             /* alt-svc cache file name */
     50   bool cookiesession;       /* new session? */
     51   bool encoding;            /* Accept-Encoding please */
     52   bool tr_encoding;         /* Transfer-Encoding please */
     53   unsigned long authtype;   /* auth bitmask */
     54   bool use_resume;
     55   bool resume_from_current;
     56   bool disable_epsv;
     57   bool disable_eprt;
     58   bool ftp_pret;
     59   long proto;
     60   bool proto_present;
     61   long proto_redir;
     62   bool proto_redir_present;
     63   char *proto_default;
     64   curl_off_t resume_from;
     65   char *postfields;
     66   curl_off_t postfieldsize;
     67   char *referer;
     68   double timeout;
     69   double connecttimeout;
     70   long maxredirs;
     71   curl_off_t max_filesize;
     72   char *headerfile;
     73   char *ftpport;
     74   char *iface;
     75   long localport;
     76   long localportrange;
     77   unsigned short porttouse;
     78   char *range;
     79   long low_speed_limit;
     80   long low_speed_time;
     81   char *dns_servers;   /* dot notation: 1.1.1.1;2.2.2.2 */
     82   char *dns_interface; /* interface name */
     83   char *dns_ipv4_addr; /* dot notation */
     84   char *dns_ipv6_addr; /* dot notation */
     85   char *userpwd;
     86   char *login_options;
     87   char *tls_username;
     88   char *tls_password;
     89   char *tls_authtype;
     90   char *proxy_tls_username;
     91   char *proxy_tls_password;
     92   char *proxy_tls_authtype;
     93   char *proxyuserpwd;
     94   char *proxy;
     95   int proxyver;             /* set to CURLPROXY_HTTP* define */
     96   char *noproxy;
     97   char *mail_from;
     98   struct curl_slist *mail_rcpt;
     99   char *mail_auth;
    100   bool sasl_ir;             /* Enable/disable SASL initial response */
    101   bool proxytunnel;
    102   bool ftp_append;          /* APPE on ftp */
    103   bool use_ascii;           /* select ascii or text transfer */
    104   bool autoreferer;         /* automatically set referer */
    105   bool failonerror;         /* fail on (HTTP) errors */
    106   bool show_headers;        /* show headers to data output */
    107   bool no_body;             /* don't get the body */
    108   bool dirlistonly;         /* only get the FTP dir list */
    109   bool followlocation;      /* follow http redirects */
    110   bool unrestricted_auth;   /* Continue to send authentication (user+password)
    111                                when following ocations, even when hostname
    112                                changed */
    113   bool netrc_opt;
    114   bool netrc;
    115   char *netrc_file;
    116   struct getout *url_list;  /* point to the first node */
    117   struct getout *url_last;  /* point to the last/current node */
    118   struct getout *url_get;   /* point to the node to fill in URL */
    119   struct getout *url_out;   /* point to the node to fill in outfile */
    120   struct getout *url_ul;    /* point to the node to fill in upload */
    121   char *doh_url;
    122   char *cipher_list;
    123   char *proxy_cipher_list;
    124   char *cipher13_list;
    125   char *proxy_cipher13_list;
    126   char *cert;
    127   char *proxy_cert;
    128   char *cert_type;
    129   char *proxy_cert_type;
    130   char *cacert;
    131   char *proxy_cacert;
    132   char *capath;
    133   char *proxy_capath;
    134   char *crlfile;
    135   char *proxy_crlfile;
    136   char *pinnedpubkey;
    137   char *proxy_pinnedpubkey;
    138   char *key;
    139   char *proxy_key;
    140   char *key_type;
    141   char *proxy_key_type;
    142   char *key_passwd;
    143   char *proxy_key_passwd;
    144   char *pubkey;
    145   char *hostpubmd5;
    146   char *engine;
    147   bool crlf;
    148   char *customrequest;
    149   char *krblevel;
    150   char *request_target;
    151   long httpversion;
    152   bool http09_allowed;
    153   bool nobuffer;
    154   bool readbusy;            /* set when reading input returns EAGAIN */
    155   bool globoff;
    156   bool use_httpget;
    157   bool insecure_ok;         /* set TRUE to allow insecure SSL connects */
    158   bool proxy_insecure_ok;   /* set TRUE to allow insecure SSL connects
    159                                for proxy */
    160   bool terminal_binary_ok;
    161   bool verifystatus;
    162   bool create_dirs;
    163   bool ftp_create_dirs;
    164   bool ftp_skip_ip;
    165   bool proxynegotiate;
    166   bool proxyntlm;
    167   bool proxydigest;
    168   bool proxybasic;
    169   bool proxyanyauth;
    170   char *writeout;           /* %-styled format string to output */
    171   struct curl_slist *quote;
    172   struct curl_slist *postquote;
    173   struct curl_slist *prequote;
    174   long ssl_version;
    175   long ssl_version_max;
    176   long proxy_ssl_version;
    177   long ip_version;
    178   curl_TimeCond timecond;
    179   curl_off_t condtime;
    180   struct curl_slist *headers;
    181   struct curl_slist *proxyheaders;
    182   tool_mime *mimeroot;
    183   tool_mime *mimecurrent;
    184   curl_mime *mimepost;
    185   struct curl_slist *telnet_options;
    186   struct curl_slist *resolve;
    187   struct curl_slist *connect_to;
    188   HttpReq httpreq;
    189 
    190   /* for bandwidth limiting features: */
    191   curl_off_t sendpersecond; /* send to peer */
    192   curl_off_t recvpersecond; /* receive from peer */
    193 
    194   bool ftp_ssl;
    195   bool ftp_ssl_reqd;
    196   bool ftp_ssl_control;
    197   bool ftp_ssl_ccc;
    198   int ftp_ssl_ccc_mode;
    199   char *preproxy;
    200   int socks5_gssapi_nec;    /* The NEC reference server does not protect the
    201                                encryption type exchange */
    202   unsigned long socks5_auth;/* auth bitmask for socks5 proxies */
    203   char *proxy_service_name; /* set authentication service name for HTTP and
    204                                SOCKS5 proxies */
    205   char *service_name;       /* set authentication service name for DIGEST-MD5,
    206                                Kerberos 5 and SPNEGO */
    207 
    208   bool tcp_nodelay;
    209   bool tcp_fastopen;
    210   long req_retry;           /* number of retries */
    211   bool retry_connrefused;   /* set connection refused as a transient error */
    212   long retry_delay;         /* delay between retries (in seconds) */
    213   long retry_maxtime;       /* maximum time to keep retrying */
    214 
    215   char *ftp_account;        /* for ACCT */
    216   char *ftp_alternative_to_user;  /* send command if USER/PASS fails */
    217   int ftp_filemethod;
    218   long tftp_blksize;        /* TFTP BLKSIZE option */
    219   bool tftp_no_options;     /* do not send TFTP options requests */
    220   bool ignorecl;            /* --ignore-content-length */
    221   bool disable_sessionid;
    222 
    223   bool raw;
    224   bool post301;
    225   bool post302;
    226   bool post303;
    227   bool nokeepalive;         /* for keepalive needs */
    228   long alivetime;
    229   bool content_disposition; /* use Content-disposition filename */
    230 
    231   int default_node_flags;   /* default flags to search for each 'node', which
    232                                is basically each given URL to transfer */
    233 
    234   bool xattr;               /* store metadata in extended attributes */
    235   long gssapi_delegation;
    236   bool ssl_allow_beast;     /* allow this SSL vulnerability */
    237   bool proxy_ssl_allow_beast; /* allow this SSL vulnerability for proxy*/
    238 
    239   bool ssl_no_revoke;       /* disable SSL certificate revocation checks */
    240   /*bool proxy_ssl_no_revoke; */
    241 
    242   bool use_metalink;        /* process given URLs as metalink XML file */
    243   metalinkfile *metalinkfile_list; /* point to the first node */
    244   metalinkfile *metalinkfile_last; /* point to the last/current node */
    245 #ifdef CURLDEBUG
    246   bool test_event_based;
    247 #endif
    248   char *oauth_bearer;             /* OAuth 2.0 bearer token */
    249   bool nonpn;                     /* enable/disable TLS NPN extension */
    250   bool noalpn;                    /* enable/disable TLS ALPN extension */
    251   char *unix_socket_path;         /* path to Unix domain socket */
    252   bool abstract_unix_socket;      /* path to an abstract Unix domain socket */
    253   bool falsestart;
    254   bool path_as_is;
    255   double expect100timeout;
    256   bool suppress_connect_headers;  /* suppress proxy CONNECT response headers
    257                                      from user callbacks */
    258   curl_error synthetic_error;     /* if non-zero, it overrides any libcurl
    259                                      error */
    260   bool ssh_compression;           /* enable/disable SSH compression */
    261   long happy_eyeballs_timeout_ms; /* happy eyeballs timeout in milliseconds.
    262                                      0 is valid. default: CURL_HET_DEFAULT. */
    263   bool haproxy_protocol;          /* whether to send HAProxy protocol v1 */
    264   bool disallow_username_in_url;  /* disallow usernames in URLs */
    265   struct GlobalConfig *global;
    266   struct OperationConfig *prev;
    267   struct OperationConfig *next;   /* Always last in the struct */
    268 };
    269 
    270 struct GlobalConfig {
    271   CURL *easy;                     /* Once we have one, we keep it here */
    272   int showerror;                  /* -1 == unset, default => show errors
    273                                       0 => -s is used to NOT show errors
    274                                       1 => -S has been used to show errors */
    275   bool mute;                      /* don't show messages, --silent given */
    276   bool noprogress;                /* don't show progress bar --silent given */
    277   bool isatty;                    /* Updated internally if output is a tty */
    278   FILE *errors;                   /* Error stream, defaults to stderr */
    279   bool errors_fopened;            /* Whether error stream isn't stderr */
    280   char *trace_dump;               /* file to dump the network trace to */
    281   FILE *trace_stream;
    282   bool trace_fopened;
    283   trace tracetype;
    284   bool tracetime;                 /* include timestamp? */
    285   int progressmode;               /* CURL_PROGRESS_BAR / CURL_PROGRESS_STATS */
    286   char *libcurl;                  /* Output libcurl code to this file name */
    287   bool fail_early;                /* exit on first transfer error */
    288   bool styled_output;             /* enable fancy output style detection */
    289   struct OperationConfig *first;
    290   struct OperationConfig *current;
    291   struct OperationConfig *last;   /* Always last in the struct */
    292 };
    293 
    294 void config_init(struct OperationConfig *config);
    295 void config_free(struct OperationConfig *config);
    296 
    297 #endif /* HEADER_CURL_TOOL_CFGABLE_H */
    298