1 #ifndef HEADER_CURL_FORMDATA_H
2 #define HEADER_CURL_FORMDATA_H
3 /***************************************************************************
5 * Project ___| | | | _ \| |
7 * | (__| |_| | _ <| |___
8 * \___|\___/|_| \_\_____|
10 * Copyright (C) 1998 - 2015, 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_DATA, /* form metadata (convert to network encoding if necessary) */
27 FORM_CONTENT, /* form content (never convert) */
28 FORM_CALLBACK, /* 'line' points to the custom pointer we pass to the callback
30 FORM_FILE /* 'line' points to a file name we should read from
31 to create the form data (never convert) */
34 /* plain and simple linked list with lines to send */
36 struct FormData *next;
43 struct FormData *data; /* current form line to send */
44 size_t sent; /* number of bytes of the current line that has
45 already been sent in a previous invoke */
46 FILE *fp; /* file to read from */
47 curl_read_callback fread_func; /* fread callback pointer */
50 /* used by FormAdd for temporary storage */
51 typedef struct FormInfo {
57 curl_off_t contentslength;
59 bool contenttype_alloc;
61 char *buffer; /* pointer to existing buffer used for file upload */
63 char *showfilename; /* The file name to show. If not set, the actual
64 file name will be used */
65 bool showfilename_alloc;
66 char *userp; /* pointer for the read callback */
67 struct curl_slist* contentheader;
68 struct FormInfo *more;
71 int Curl_FormInit(struct Form *form, struct FormData *formdata );
73 CURLcode Curl_getformdata(struct SessionHandle *data,
75 struct curl_httppost *post,
76 const char *custom_contenttype,
79 /* fread() emulation */
80 size_t Curl_FormReader(char *buffer,
86 * Curl_formpostheader() returns the first line of the formpost, the
87 * request-header part (which is not part of the request-body like the rest of
90 char *Curl_formpostheader(void *formp, size_t *len);
92 char *Curl_FormBoundary(void);
94 void Curl_formclean(struct FormData **);
96 CURLcode Curl_formconvert(struct SessionHandle *, struct FormData *);
98 #endif /* HEADER_CURL_FORMDATA_H */