1 #ifndef HEADER_CURL_FORMDATA_H
2 #define HEADER_CURL_FORMDATA_H
3 /***************************************************************************
5 * Project ___| | | | _ \| |
7 * | (__| |_| | _ <| |___
8 * \___|\___/|_| \_\_____|
10 * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
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.
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.
20 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
21 * KIND, either express or implied.
23 ***************************************************************************/
26 FORM_DATAMEM, /* already allocated FORM_DATA memory */
27 FORM_DATA, /* form metadata (convert to network encoding if necessary) */
28 FORM_CONTENT, /* form content (never convert) */
29 FORM_CALLBACK, /* 'line' points to the custom pointer we pass to the callback
31 FORM_FILE /* 'line' points to a file name we should read from
32 to create the form data (never convert) */
35 /* plain and simple linked list with lines to send */
37 struct FormData *next;
44 struct FormData *data; /* current form line to send */
45 size_t sent; /* number of bytes of the current line that has
46 already been sent in a previous invoke */
47 FILE *fp; /* file to read from */
48 curl_read_callback fread_func; /* fread callback pointer */
51 /* used by FormAdd for temporary storage */
52 typedef struct FormInfo {
58 curl_off_t contentslength;
60 bool contenttype_alloc;
62 char *buffer; /* pointer to existing buffer used for file upload */
64 char *showfilename; /* The file name to show. If not set, the actual
65 file name will be used */
66 bool showfilename_alloc;
67 char *userp; /* pointer for the read callback */
68 struct curl_slist *contentheader;
69 struct FormInfo *more;
72 int Curl_FormInit(struct Form *form, struct FormData *formdata);
74 CURLcode Curl_getformdata(struct Curl_easy *data,
76 struct curl_httppost *post,
77 const char *custom_contenttype,
80 /* fread() emulation */
81 size_t Curl_FormReader(char *buffer,
87 * Curl_formpostheader() returns the first line of the formpost, the
88 * request-header part (which is not part of the request-body like the rest of
91 char *Curl_formpostheader(void *formp, size_t *len);
93 char *Curl_FormBoundary(void);
95 void Curl_formclean(struct FormData **);
97 CURLcode Curl_formconvert(struct Curl_easy *, struct FormData *);
99 #endif /* HEADER_CURL_FORMDATA_H */