tool_formparse.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 "mime.h"
25 #include "strcase.h"
26 
27 #define ENABLE_CURLX_PRINTF
28 /* use our own printf() functions */
29 #include "curlx.h"
30 
31 #include "tool_cfgable.h"
32 #include "tool_convert.h"
33 #include "tool_msgs.h"
34 #include "tool_formparse.h"
35 
36 #include "memdebug.h" /* keep this as LAST include */
37 
38 
39 /*
40  * helper function to get a word from form param
41  * after call get_parm_word, str either point to string end
42  * or point to any of end chars.
43  */
44 static char *get_param_word(char **str, char **end_pos)
45 {
46  char *ptr = *str;
47  char *word_begin = NULL;
48  char *ptr2;
49  char *escape = NULL;
50  const char *end_chars = ";,";
51 
52  /* the first non-space char is here */
53  word_begin = ptr;
54  if(*ptr == '"') {
55  ++ptr;
56  while(*ptr) {
57  if(*ptr == '\\') {
58  if(ptr[1] == '\\' || ptr[1] == '"') {
59  /* remember the first escape position */
60  if(!escape)
61  escape = ptr;
62  /* skip escape of back-slash or double-quote */
63  ptr += 2;
64  continue;
65  }
66  }
67  if(*ptr == '"') {
68  *end_pos = ptr;
69  if(escape) {
70  /* has escape, we restore the unescaped string here */
71  ptr = ptr2 = escape;
72  do {
73  if(*ptr == '\\' && (ptr[1] == '\\' || ptr[1] == '"'))
74  ++ptr;
75  *ptr2++ = *ptr++;
76  }
77  while(ptr < *end_pos);
78  *end_pos = ptr2;
79  }
80  while(*ptr && NULL == strchr(end_chars, *ptr))
81  ++ptr;
82  *str = ptr;
83  return word_begin + 1;
84  }
85  ++ptr;
86  }
87  /* end quote is missing, treat it as non-quoted. */
88  ptr = word_begin;
89  }
90 
91  while(*ptr && NULL == strchr(end_chars, *ptr))
92  ++ptr;
93  *str = *end_pos = ptr;
94  return word_begin;
95 }
96 
97 /* Append slist item and return -1 if failed. */
98 static int slist_append(struct curl_slist **plist, const char *data)
99 {
100  struct curl_slist *s = curl_slist_append(*plist, data);
101 
102  if(!s)
103  return -1;
104 
105  *plist = s;
106  return 0;
107 }
108 
109 /* Read headers from a file and append to list. */
111  const char *filename, FILE *fp,
112  struct curl_slist **pheaders)
113 {
114  size_t hdrlen = 0;
115  size_t pos = 0;
116  int c;
117  bool incomment = FALSE;
118  int lineno = 1;
119  char hdrbuf[999]; /* Max. header length + 1. */
120 
121  for(;;) {
122  c = getc(fp);
123  if(c == EOF || (!pos && !ISSPACE(c))) {
124  /* Strip and flush the current header. */
125  while(hdrlen && ISSPACE(hdrbuf[hdrlen - 1]))
126  hdrlen--;
127  if(hdrlen) {
128  hdrbuf[hdrlen] = '\0';
129  if(slist_append(pheaders, hdrbuf)) {
130  fprintf(config->global->errors,
131  "Out of memory for field headers!\n");
132  return -1;
133  }
134  hdrlen = 0;
135  }
136  }
137 
138  switch(c) {
139  case EOF:
140  if(ferror(fp)) {
141  fprintf(config->global->errors,
142  "Header file %s read error: %s\n", filename, strerror(errno));
143  return -1;
144  }
145  return 0; /* Done. */
146  case '\r':
147  continue; /* Ignore. */
148  case '\n':
149  pos = 0;
150  incomment = FALSE;
151  lineno++;
152  continue;
153  case '#':
154  if(!pos)
155  incomment = TRUE;
156  break;
157  }
158 
159  pos++;
160  if(!incomment) {
161  if(hdrlen == sizeof hdrbuf - 1) {
162  warnf(config->global, "File %s line %d: header too long (truncated)\n",
163  filename, lineno);
164  c = ' ';
165  }
166  if(hdrlen <= sizeof hdrbuf - 1)
167  hdrbuf[hdrlen++] = (char) c;
168  }
169  }
170  /* NOTREACHED */
171 }
172 
173 static int get_param_part(struct OperationConfig *config, char **str,
174  char **pdata, char **ptype, char **pfilename,
175  char **pencoder, struct curl_slist **pheaders)
176 {
177  char *p = *str;
178  char *type = NULL;
179  char *filename = NULL;
180  char *encoder = NULL;
181  char *endpos;
182  char *tp;
183  char sep;
184  char type_major[128] = "";
185  char type_minor[128] = "";
186  char *endct = NULL;
187  struct curl_slist *headers = NULL;
188 
189  if(ptype)
190  *ptype = NULL;
191  if(pfilename)
192  *pfilename = NULL;
193  if(pheaders)
194  *pheaders = NULL;
195  if(pencoder)
196  *pencoder = NULL;
197  while(ISSPACE(*p))
198  p++;
199  tp = p;
200  *pdata = get_param_word(&p, &endpos);
201  /* If not quoted, strip trailing spaces. */
202  if(*pdata == tp)
203  while(endpos > *pdata && ISSPACE(endpos[-1]))
204  endpos--;
205  sep = *p;
206  *endpos = '\0';
207  while(sep == ';') {
208  while(ISSPACE(*++p))
209  ;
210 
211  if(!endct && checkprefix("type=", p)) {
212  for(p += 5; ISSPACE(*p); p++)
213  ;
214  /* set type pointer */
215  type = p;
216 
217  /* verify that this is a fine type specifier */
218  if(2 != sscanf(type, "%127[^/ ]/%127[^;, \n]", type_major, type_minor)) {
219  warnf(config->global, "Illegally formatted content-type field!\n");
220  curl_slist_free_all(headers);
221  return -1; /* illegal content-type syntax! */
222  }
223 
224  /* now point beyond the content-type specifier */
225  endpos = type + strlen(type_major) + strlen(type_minor) + 1;
226  for(p = endpos; ISSPACE(*p); p++)
227  ;
228  while(*p && *p != ';' && *p != ',')
229  p++;
230  endct = p;
231  sep = *p;
232  }
233  else if(checkprefix("filename=", p)) {
234  if(endct) {
235  *endct = '\0';
236  endct = NULL;
237  }
238  for(p += 9; ISSPACE(*p); p++)
239  ;
240  tp = p;
241  filename = get_param_word(&p, &endpos);
242  /* If not quoted, strip trailing spaces. */
243  if(filename == tp)
244  while(endpos > filename && ISSPACE(endpos[-1]))
245  endpos--;
246  sep = *p;
247  *endpos = '\0';
248  }
249  else if(checkprefix("headers=", p)) {
250  if(endct) {
251  *endct = '\0';
252  endct = NULL;
253  }
254  p += 8;
255  if(*p == '@' || *p == '<') {
256  char *hdrfile;
257  FILE *fp;
258  /* Read headers from a file. */
259 
260  do {
261  p++;
262  } while(ISSPACE(*p));
263  tp = p;
264  hdrfile = get_param_word(&p, &endpos);
265  /* If not quoted, strip trailing spaces. */
266  if(hdrfile == tp)
267  while(endpos > hdrfile && ISSPACE(endpos[-1]))
268  endpos--;
269  sep = *p;
270  *endpos = '\0';
271  /* TODO: maybe special fopen for VMS? */
272  fp = fopen(hdrfile, FOPEN_READTEXT);
273  if(!fp)
274  warnf(config->global, "Cannot read from %s: %s\n", hdrfile,
275  strerror(errno));
276  else {
277  int i = read_field_headers(config, hdrfile, fp, &headers);
278 
279  fclose(fp);
280  if(i) {
281  curl_slist_free_all(headers);
282  return -1;
283  }
284  }
285  }
286  else {
287  char *hdr;
288 
289  while(ISSPACE(*p))
290  p++;
291  tp = p;
292  hdr = get_param_word(&p, &endpos);
293  /* If not quoted, strip trailing spaces. */
294  if(hdr == tp)
295  while(endpos > hdr && ISSPACE(endpos[-1]))
296  endpos--;
297  sep = *p;
298  *endpos = '\0';
299  if(slist_append(&headers, hdr)) {
300  fprintf(config->global->errors, "Out of memory for field header!\n");
301  curl_slist_free_all(headers);
302  return -1;
303  }
304  }
305  }
306  else if(checkprefix("encoder=", p)) {
307  if(endct) {
308  *endct = '\0';
309  endct = NULL;
310  }
311  for(p += 8; ISSPACE(*p); p++)
312  ;
313  tp = p;
314  encoder = get_param_word(&p, &endpos);
315  /* If not quoted, strip trailing spaces. */
316  if(encoder == tp)
317  while(endpos > encoder && ISSPACE(endpos[-1]))
318  endpos--;
319  sep = *p;
320  *endpos = '\0';
321  }
322  else {
323  /* unknown prefix, skip to next block */
324  char *unknown = get_param_word(&p, &endpos);
325 
326  sep = *p;
327  if(endct)
328  endct = p;
329  else {
330  *endpos = '\0';
331  if(*unknown)
332  warnf(config->global, "skip unknown form field: %s\n", unknown);
333  }
334  }
335  }
336 
337  /* Terminate and strip content type. */
338  if(type) {
339  if(!endct)
340  endct = type + strlen(type);
341  while(endct > type && ISSPACE(endct[-1]))
342  endct--;
343  *endct = '\0';
344  }
345 
346  if(ptype)
347  *ptype = type;
348  else if(type)
349  warnf(config->global, "Field content type not allowed here: %s\n", type);
350 
351  if(pfilename)
352  *pfilename = filename;
353  else if(filename)
354  warnf(config->global,
355  "Field file name not allowed here: %s\n", filename);
356 
357  if(pencoder)
358  *pencoder = encoder;
359  else if(encoder)
360  warnf(config->global,
361  "Field encoder not allowed here: %s\n", encoder);
362 
363  if(pheaders)
364  *pheaders = headers;
365  else if(headers) {
366  warnf(config->global,
367  "Field headers not allowed here: %s\n", headers->data);
368  curl_slist_free_all(headers);
369  }
370 
371  *str = p;
372  return sep & 0xFF;
373 }
374 
375 /* Check if file is "-". If so, use a callback to read OUR stdin (to
376  * workaround Windows DLL file handle caveat).
377  * Else use curl_mime_filedata(). */
378 static CURLcode file_or_stdin(curl_mimepart *part, const char *file)
379 {
380  if(strcmp(file, "-"))
381  return curl_mime_filedata(part, file);
382 
383  return curl_mime_data_cb(part, -1, (curl_read_callback) fread,
384  (curl_seek_callback) fseek, NULL, stdin);
385 }
386 
387 
388 /***************************************************************************
389  *
390  * formparse()
391  *
392  * Reads a 'name=value' parameter and builds the appropriate linked list.
393  *
394  * Specify files to upload with 'name=@filename', or 'name=@"filename"'
395  * in case the filename contain ',' or ';'. Supports specified
396  * given Content-Type of the files. Such as ';type=<content-type>'.
397  *
398  * If literal_value is set, any initial '@' or '<' in the value string
399  * loses its special meaning, as does any embedded ';type='.
400  *
401  * You may specify more than one file for a single name (field). Specify
402  * multiple files by writing it like:
403  *
404  * 'name=@filename,filename2,filename3'
405  *
406  * or use double-quotes quote the filename:
407  *
408  * 'name=@"filename","filename2","filename3"'
409  *
410  * If you want content-types specified for each too, write them like:
411  *
412  * 'name=@filename;type=image/gif,filename2,filename3'
413  *
414  * If you want custom headers added for a single part, write them in a separate
415  * file and do like this:
416  *
417  * 'name=foo;headers=@headerfile' or why not
418  * 'name=@filemame;headers=@headerfile'
419  *
420  * To upload a file, but to fake the file name that will be included in the
421  * formpost, do like this:
422  *
423  * 'name=@filename;filename=/dev/null' or quote the faked filename like:
424  * 'name=@filename;filename="play, play, and play.txt"'
425  *
426  * If filename/path contains ',' or ';', it must be quoted by double-quotes,
427  * else curl will fail to figure out the correct filename. if the filename
428  * tobe quoted contains '"' or '\', '"' and '\' must be escaped by backslash.
429  *
430  * This function uses curl_formadd to fulfill it's job. Is heavily based on
431  * the old curl_formparse code.
432  *
433  ***************************************************************************/
434 
436  const char *input,
437  curl_mime **mimepost,
438  curl_mime **mimecurrent,
439  bool literal_value)
440 {
441  /* input MUST be a string in the format 'name=contents' and we'll
442  build a linked list with the info */
443  char *name = NULL;
444  char *contents = NULL;
445  char *contp;
446  char *data;
447  char *type = NULL;
448  char *filename = NULL;
449  char *encoder = NULL;
450  struct curl_slist *headers = NULL;
451  curl_mimepart *part = NULL;
452  CURLcode res;
453  int sep = '\0';
454 
455  /* Allocate the main mime structure if needed. */
456  if(!*mimepost) {
457  *mimepost = curl_mime_init(config->easy);
458  if(!*mimepost) {
459  warnf(config->global, "curl_mime_init failed!\n");
460  return 1;
461  }
462  *mimecurrent = *mimepost;
463  }
464 
465  /* Make a copy we can overwrite. */
466  contents = strdup(input);
467  if(!contents) {
468  fprintf(config->global->errors, "out of memory\n");
469  return 2;
470  }
471 
472  /* Scan for the end of the name. */
473  contp = strchr(contents, '=');
474  if(contp) {
475  if(contp > contents)
476  name = contents;
477  *contp++ = '\0';
478 
479  if(*contp == '(' && !literal_value) {
480  curl_mime *subparts;
481 
482  /* Starting a multipart. */
483  sep = get_param_part(config, &contp, &data, &type, NULL, NULL, &headers);
484  if(sep < 0) {
485  Curl_safefree(contents);
486  return 3;
487  }
488  subparts = curl_mime_init(config->easy);
489  if(!subparts) {
490  warnf(config->global, "curl_mime_init failed!\n");
491  curl_slist_free_all(headers);
492  Curl_safefree(contents);
493  return 4;
494  }
495  part = curl_mime_addpart(*mimecurrent);
496  if(!part) {
497  warnf(config->global, "curl_mime_addpart failed!\n");
498  curl_mime_free(subparts);
499  curl_slist_free_all(headers);
500  Curl_safefree(contents);
501  return 5;
502  }
503  if(curl_mime_subparts(part, subparts)) {
504  warnf(config->global, "curl_mime_subparts failed!\n");
505  curl_mime_free(subparts);
506  curl_slist_free_all(headers);
507  Curl_safefree(contents);
508  return 6;
509  }
510  *mimecurrent = subparts;
511  if(curl_mime_headers(part, headers, 1)) {
512  warnf(config->global, "curl_mime_headers failed!\n");
513  curl_slist_free_all(headers);
514  Curl_safefree(contents);
515  return 7;
516  }
517  if(curl_mime_type(part, type)) {
518  warnf(config->global, "curl_mime_type failed!\n");
519  Curl_safefree(contents);
520  return 8;
521  }
522  }
523  else if(!name && !strcmp(contp, ")") && !literal_value) {
524  /* Ending a mutipart. */
525  if(*mimecurrent == *mimepost) {
526  warnf(config->global, "no multipart to terminate!\n");
527  Curl_safefree(contents);
528  return 9;
529  }
530  *mimecurrent = (*mimecurrent)->parent->parent;
531  }
532  else if('@' == contp[0] && !literal_value) {
533 
534  /* we use the @-letter to indicate file name(s) */
535 
536  curl_mime *subparts = NULL;
537 
538  do {
539  /* since this was a file, it may have a content-type specifier
540  at the end too, or a filename. Or both. */
541  ++contp;
542  sep = get_param_part(config, &contp,
543  &data, &type, &filename, &encoder, &headers);
544  if(sep < 0) {
545  if(subparts != *mimecurrent)
546  curl_mime_free(subparts);
547  Curl_safefree(contents);
548  return 10;
549  }
550 
551  /* now contp point to comma or string end.
552  If more files to come, make sure we have multiparts. */
553  if(!subparts) {
554  if(sep != ',') /* If there is a single file. */
555  subparts = *mimecurrent;
556  else {
557  subparts = curl_mime_init(config->easy);
558  if(!subparts) {
559  warnf(config->global, "curl_mime_init failed!\n");
560  curl_slist_free_all(headers);
561  Curl_safefree(contents);
562  return 11;
563  }
564  }
565  }
566 
567  /* Allocate a part for that file. */
568  part = curl_mime_addpart(subparts);
569  if(!part) {
570  warnf(config->global, "curl_mime_addpart failed!\n");
571  if(subparts != *mimecurrent)
572  curl_mime_free(subparts);
573  curl_slist_free_all(headers);
574  Curl_safefree(contents);
575  return 12;
576  }
577 
578  /* Set part headers. */
579  if(curl_mime_headers(part, headers, 1)) {
580  warnf(config->global, "curl_mime_headers failed!\n");
581  if(subparts != *mimecurrent)
582  curl_mime_free(subparts);
583  curl_slist_free_all(headers);
584  Curl_safefree(contents);
585  return 13;
586  }
587 
588  /* Setup file in part. */
589  res = file_or_stdin(part, data);
590  if(res) {
591  warnf(config->global, "setting file %s failed!\n", data);
592  if(res != CURLE_READ_ERROR) {
593  if(subparts != *mimecurrent)
594  curl_mime_free(subparts);
595  Curl_safefree(contents);
596  return 14;
597  }
598  }
599  if(filename && curl_mime_filename(part, filename)) {
600  warnf(config->global, "curl_mime_filename failed!\n");
601  if(subparts != *mimecurrent)
602  curl_mime_free(subparts);
603  Curl_safefree(contents);
604  return 15;
605  }
606  if(curl_mime_type(part, type)) {
607  warnf(config->global, "curl_mime_type failed!\n");
608  if(subparts != *mimecurrent)
609  curl_mime_free(subparts);
610  Curl_safefree(contents);
611  return 16;
612  }
613  if(curl_mime_encoder(part, encoder)) {
614  warnf(config->global, "curl_mime_encoder failed!\n");
615  if(subparts != *mimecurrent)
616  curl_mime_free(subparts);
617  Curl_safefree(contents);
618  return 17;
619  }
620 
621  /* *contp could be '\0', so we just check with the delimiter */
622  } while(sep); /* loop if there's another file name */
623 
624  /* now we add the multiple files section */
625  if(subparts != *mimecurrent) {
626  part = curl_mime_addpart(*mimecurrent);
627  if(!part) {
628  warnf(config->global, "curl_mime_addpart failed!\n");
629  curl_mime_free(subparts);
630  Curl_safefree(contents);
631  return 18;
632  }
633  if(curl_mime_subparts(part, subparts)) {
634  warnf(config->global, "curl_mime_subparts failed!\n");
635  curl_mime_free(subparts);
636  Curl_safefree(contents);
637  return 19;
638  }
639  }
640  }
641  else {
642  /* Allocate a mime part. */
643  part = curl_mime_addpart(*mimecurrent);
644  if(!part) {
645  warnf(config->global, "curl_mime_addpart failed!\n");
646  Curl_safefree(contents);
647  return 20;
648  }
649 
650  if(*contp == '<' && !literal_value) {
651  ++contp;
652  sep = get_param_part(config, &contp,
653  &data, &type, &filename, &encoder, &headers);
654  if(sep < 0) {
655  Curl_safefree(contents);
656  return 21;
657  }
658 
659  /* Set part headers. */
660  if(curl_mime_headers(part, headers, 1)) {
661  warnf(config->global, "curl_mime_headers failed!\n");
662  curl_slist_free_all(headers);
663  Curl_safefree(contents);
664  return 22;
665  }
666 
667  /* Setup file in part. */
668  res = file_or_stdin(part, data);
669  if(res) {
670  warnf(config->global, "setting file %s failed!\n", data);
671  if(res != CURLE_READ_ERROR) {
672  Curl_safefree(contents);
673  return 23;
674  }
675  }
676  }
677  else {
678  if(literal_value)
679  data = contp;
680  else {
681  sep = get_param_part(config, &contp,
682  &data, &type, &filename, &encoder, &headers);
683  if(sep < 0) {
684  Curl_safefree(contents);
685  return 24;
686  }
687  }
688 
689  /* Set part headers. */
690  if(curl_mime_headers(part, headers, 1)) {
691  warnf(config->global, "curl_mime_headers failed!\n");
692  curl_slist_free_all(headers);
693  Curl_safefree(contents);
694  return 25;
695  }
696 
697 #ifdef CURL_DOES_CONVERSIONS
698  if(convert_to_network(data, strlen(data))) {
699  warnf(config->global, "curl_formadd failed!\n");
700  Curl_safefree(contents);
701  return 26;
702  }
703 #endif
704 
705  if(curl_mime_data(part, data, CURL_ZERO_TERMINATED)) {
706  warnf(config->global, "curl_mime_data failed!\n");
707  Curl_safefree(contents);
708  return 27;
709  }
710  }
711 
712  if(curl_mime_filename(part, filename)) {
713  warnf(config->global, "curl_mime_filename failed!\n");
714  Curl_safefree(contents);
715  return 28;
716  }
717  if(curl_mime_type(part, type)) {
718  warnf(config->global, "curl_mime_type failed!\n");
719  Curl_safefree(contents);
720  return 29;
721  }
722  if(curl_mime_encoder(part, encoder)) {
723  warnf(config->global, "curl_mime_encoder failed!\n");
724  Curl_safefree(contents);
725  return 30;
726  }
727 
728  if(sep) {
729  *contp = (char) sep;
730  warnf(config->global,
731  "garbage at end of field specification: %s\n", contp);
732  }
733  }
734 
735  /* Set part name. */
736  if(name && curl_mime_name(part, name)) {
737  warnf(config->global, "curl_mime_name failed!\n");
738  Curl_safefree(contents);
739  return 31;
740  }
741  }
742  else {
743  warnf(config->global, "Illegally formatted input field!\n");
744  Curl_safefree(contents);
745  return 32;
746  }
747  Curl_safefree(contents);
748  return 0;
749 }
CURL_EXTERN CURLcode curl_mime_filedata(curl_mimepart *part, const char *filename)
Definition: mime.c:1262
CURL_EXTERN CURLcode curl_mime_headers(curl_mimepart *part, struct curl_slist *headers, int take_ownership)
Definition: mime.c:1352
filename
Definition: ws_ssl.c:25
CURL_EXTERN void curl_mime_free(curl_mime *mime)
Definition: mime.c:1110
CURL_EXTERN CURLcode curl_mime_data(curl_mimepart *part, const char *data, size_t datasize)
Definition: mime.c:1230
char * data
Definition: curl.h:2336
curl_mime * parent
Definition: mime.h:100
#define strdup(ptr)
Definition: curl_memory.h:122
XmlRpcServer s
UNITTEST_START char * ptr
Definition: unit1330.c:38
CURLcode
Definition: curl.h:454
CURL_EXTERN curl_mime * curl_mime_init(CURL *easy)
static int res
struct GlobalConfig * global
Definition: tool_cfgable.h:251
const char ** p
Definition: unit1394.c:76
int(* curl_seek_callback)(void *instream, curl_off_t offset, int origin)
Definition: curl.h:344
unsigned int i
Definition: unit1303.c:79
#define FOPEN_READTEXT
Definition: curl_setup.h:732
CURL_EXTERN CURLcode curl_mime_encoder(curl_mimepart *part, const char *encoding)
Definition: mime.c:1329
const char * str
Definition: unit1398.c:33
#define FALSE
CURL_EXTERN CURLcode curl_mime_name(curl_mimepart *part, const char *name)
Definition: mime.c:1194
CURL_EXTERN struct curl_slist * curl_slist_append(struct curl_slist *, const char *)
Definition: slist.c:89
UNITTEST_START struct Curl_easy data
Definition: unit1399.c:82
static int get_param_part(struct OperationConfig *config, char **str, char **pdata, char **ptype, char **pfilename, char **pencoder, struct curl_slist **pheaders)
static CURLcode file_or_stdin(curl_mimepart *part, const char *file)
size_t(* curl_read_callback)(char *buffer, size_t size, size_t nitems, void *instream)
Definition: curl.h:355
#define Curl_safefree(ptr)
Definition: memdebug.h:170
#define ISSPACE(x)
size_t fread(void *, size_t, size_t, FILE *)
curl_mimepart * parent
Definition: mime.h:90
static char * get_param_word(char **str, char **end_pos)
CURL_EXTERN curl_mimepart * curl_mime_addpart(curl_mime *mime)
Definition: mime.c:1169
CURL_EXTERN CURLcode curl_mime_filename(curl_mimepart *part, const char *filename)
Definition: mime.c:1212
CURL_EXTERN CURLcode curl_mime_type(curl_mimepart *part, const char *mimetype)
Definition: mime.c:1311
#define checkprefix(a, b)
Definition: strcase.h:46
#define CURL_ZERO_TERMINATED
Definition: curl.h:1966
CURL_EXTERN CURLcode curl_mime_data_cb(curl_mimepart *part, curl_off_t datasize, curl_read_callback readfunc, curl_seek_callback seekfunc, curl_free_callback freefunc, void *arg)
Definition: mime.c:1369
int formparse(struct OperationConfig *config, const char *input, curl_mime **mimepost, curl_mime **mimecurrent, bool literal_value)
#define fprintf
Definition: curl_printf.h:41
static int slist_append(struct curl_slist **plist, const char *data)
#define TRUE
void warnf(struct GlobalConfig *config, const char *fmt,...)
Definition: tool_msgs.c:95
const char * name
Definition: curl_sasl.c:54
CURL_EXTERN void curl_slist_free_all(struct curl_slist *)
Definition: slist.c:129
static int read_field_headers(struct OperationConfig *config, const char *filename, FILE *fp, struct curl_slist **pheaders)
Definition: debug.c:29
CURL_EXTERN CURLcode curl_mime_subparts(curl_mimepart *part, curl_mime *subparts)
Definition: mime.c:1392


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