tool_cfgable.c
Go to the documentation of this file.
1 /***************************************************************************
2  * _ _ ____ _
3  * Project ___| | | | _ \| |
4  * / __| | | | |_) | |
5  * | (__| |_| | _ <| |___
6  * \___|\___/|_| \_\_____|
7  *
8  * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
9  *
10  * This software is licensed as described in the file COPYING, which
11  * you should have received as part of this distribution. The terms
12  * are also available at https://curl.haxx.se/docs/copyright.html.
13  *
14  * You may opt to use, copy, modify, merge, publish, distribute and/or sell
15  * copies of the Software, and permit persons to whom the Software is
16  * furnished to do so, under the terms of the COPYING file.
17  *
18  * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19  * KIND, either express or implied.
20  *
21  ***************************************************************************/
22 #include "tool_setup.h"
23 
24 #include "tool_cfgable.h"
25 #include "tool_main.h"
26 
27 #include "memdebug.h" /* keep this as LAST include */
28 
30 {
31  memset(config, 0, sizeof(struct OperationConfig));
32 
33  config->postfieldsize = -1;
34  config->use_httpget = FALSE;
35  config->create_dirs = FALSE;
36  config->maxredirs = DEFAULT_MAXREDIRS;
37  config->proto = CURLPROTO_ALL; /* FIXME: better to read from library */
38  config->proto_present = FALSE;
39  config->proto_redir = CURLPROTO_ALL & /* All except FILE, SCP and SMB */
42  config->proto_redir_present = FALSE;
43  config->proto_default = NULL;
44  config->tcp_nodelay = TRUE; /* enabled by default */
45 }
46 
48 {
49  struct getout *urlnode;
50 
51  Curl_safefree(config->random_file);
52  Curl_safefree(config->egd_file);
53  Curl_safefree(config->useragent);
54  Curl_safefree(config->cookie);
55  Curl_safefree(config->cookiejar);
56  Curl_safefree(config->cookiefile);
57 
58  Curl_safefree(config->postfields);
59  Curl_safefree(config->referer);
60 
61  Curl_safefree(config->headerfile);
62  Curl_safefree(config->ftpport);
63  Curl_safefree(config->iface);
64 
65  Curl_safefree(config->range);
66 
67  Curl_safefree(config->userpwd);
68  Curl_safefree(config->tls_username);
69  Curl_safefree(config->tls_password);
70  Curl_safefree(config->tls_authtype);
74  Curl_safefree(config->proxyuserpwd);
75  Curl_safefree(config->proxy);
76 
80  Curl_safefree(config->dns_servers);
81 
82  Curl_safefree(config->noproxy);
83 
84  Curl_safefree(config->mail_from);
86  Curl_safefree(config->mail_auth);
87 
88  Curl_safefree(config->netrc_file);
89 
90  urlnode = config->url_list;
91  while(urlnode) {
92  struct getout *next = urlnode->next;
93  Curl_safefree(urlnode->url);
94  Curl_safefree(urlnode->outfile);
95  Curl_safefree(urlnode->infile);
96  Curl_safefree(urlnode);
97  urlnode = next;
98  }
99  config->url_list = NULL;
100  config->url_last = NULL;
101  config->url_get = NULL;
102  config->url_out = NULL;
103 
104  Curl_safefree(config->cipher_list);
106  Curl_safefree(config->cert);
107  Curl_safefree(config->proxy_cert);
108  Curl_safefree(config->cert_type);
110  Curl_safefree(config->cacert);
111  Curl_safefree(config->proxy_cacert);
112  Curl_safefree(config->capath);
113  Curl_safefree(config->proxy_capath);
114  Curl_safefree(config->crlfile);
115  Curl_safefree(config->pinnedpubkey);
116  Curl_safefree(config->proxy_crlfile);
117  Curl_safefree(config->key);
118  Curl_safefree(config->proxy_key);
119  Curl_safefree(config->key_type);
120  Curl_safefree(config->proxy_key_type);
121  Curl_safefree(config->key_passwd);
123  Curl_safefree(config->pubkey);
124  Curl_safefree(config->hostpubmd5);
125  Curl_safefree(config->engine);
126  Curl_safefree(config->request_target);
127  Curl_safefree(config->customrequest);
128  Curl_safefree(config->krblevel);
129 
130  Curl_safefree(config->oauth_bearer);
131 
133  Curl_safefree(config->writeout);
134  Curl_safefree(config->proto_default);
135 
136  curl_slist_free_all(config->quote);
138  curl_slist_free_all(config->prequote);
139 
140  curl_slist_free_all(config->headers);
142 
143  if(config->mimepost) {
144  curl_mime_free(config->mimepost);
145  config->mimepost = NULL;
146  }
147  config->mimecurrent = NULL;
148 
150  curl_slist_free_all(config->resolve);
152 
153  Curl_safefree(config->preproxy);
155  Curl_safefree(config->service_name);
156 
157  Curl_safefree(config->ftp_account);
159 }
160 
162 {
163  struct OperationConfig *last = config;
164 
165  /* Free each of the structures in reverse order */
166  while(last) {
167  struct OperationConfig *prev = last->prev;
168 
169  free_config_fields(last);
170  free(last);
171 
172  last = prev;
173  }
174 }
#define free(ptr)
Definition: curl_memory.h:130
struct getout * next
Definition: tool_sdecls.h:104
#define CURLPROTO_FILE
Definition: curl.h:854
#define CURLPROTO_SCP
Definition: curl.h:848
curl_off_t postfieldsize
Definition: tool_cfgable.h:63
struct curl_slist * quote
Definition: tool_cfgable.h:162
#define CURLPROTO_ALL
Definition: curl.h:872
#define CURLPROTO_SMB
Definition: curl.h:870
static void free_config_fields(struct OperationConfig *config)
Definition: tool_cfgable.c:47
struct OperationConfig * prev
Definition: tool_cfgable.h:252
Definition: ws_ssl.c:25
char * proxyuserpwd
Definition: tool_cfgable.h:90
struct getout * url_last
Definition: tool_cfgable.h:114
struct curl_slist * telnet_options
Definition: tool_cfgable.h:175
CURL_EXTERN void curl_mime_free(curl_mime *mime)
Definition: mime.c:1110
char * dns_ipv6_addr
Definition: tool_cfgable.h:81
char * proxy_service_name
Definition: tool_cfgable.h:193
#define DEFAULT_MAXREDIRS
Definition: tool_main.h:26
struct curl_slist * headers
Definition: tool_cfgable.h:171
#define CURLPROTO_SMBS
Definition: curl.h:871
void config_free(struct OperationConfig *config)
Definition: tool_cfgable.c:161
struct curl_slist * prequote
Definition: tool_cfgable.h:164
char * customrequest
Definition: tool_cfgable.h:140
char * infile
Definition: tool_sdecls.h:107
struct curl_slist * connect_to
Definition: tool_cfgable.h:177
char * dns_servers
Definition: tool_cfgable.h:78
char * unix_socket_path
Definition: tool_cfgable.h:241
char * ftp_alternative_to_user
Definition: tool_cfgable.h:206
struct curl_slist * resolve
Definition: tool_cfgable.h:176
struct curl_httppost * last
Definition: unit1308.c:46
struct getout * url_get
Definition: tool_cfgable.h:115
char * proxy_tls_password
Definition: tool_cfgable.h:88
#define FALSE
struct getout * url_out
Definition: tool_cfgable.h:116
char * proxy_crlfile
Definition: tool_cfgable.h:128
char * dns_interface
Definition: tool_cfgable.h:79
curl_mime * mimecurrent
Definition: tool_cfgable.h:174
char * outfile
Definition: tool_sdecls.h:106
curl_mime * mimepost
Definition: tool_cfgable.h:173
bool proto_redir_present
Definition: tool_cfgable.h:59
struct curl_slist * postquote
Definition: tool_cfgable.h:163
#define Curl_safefree(ptr)
Definition: memdebug.h:170
char * tls_authtype
Definition: tool_cfgable.h:86
char * proxy_tls_authtype
Definition: tool_cfgable.h:89
struct getout * url_list
Definition: tool_cfgable.h:113
char * proxy_cert_type
Definition: tool_cfgable.h:122
char * url
Definition: tool_sdecls.h:105
struct curl_slist * proxyheaders
Definition: tool_cfgable.h:172
char * dns_ipv4_addr
Definition: tool_cfgable.h:80
char * proxy_key_type
Definition: tool_cfgable.h:133
char * tls_username
Definition: tool_cfgable.h:84
#define TRUE
char * proto_default
Definition: tool_cfgable.h:60
char * request_target
Definition: tool_cfgable.h:142
char * proxy_cipher_list
Definition: tool_cfgable.h:118
char * proxy_key_passwd
Definition: tool_cfgable.h:135
CURL_EXTERN void curl_slist_free_all(struct curl_slist *)
Definition: slist.c:129
void config_init(struct OperationConfig *config)
Definition: tool_cfgable.c:29
char * tls_password
Definition: tool_cfgable.h:85
char * random_file
Definition: tool_cfgable.h:41
char * proxy_tls_username
Definition: tool_cfgable.h:87
struct curl_slist * mail_rcpt
Definition: tool_cfgable.h:95


rc_tagdetect_client
Author(s): Monika Florek-Jasinska , Raphael Schaller
autogenerated on Sat Feb 13 2021 03:42:16