1 /***************************************************************************
3 * Project ___| | | | _ \| |
5 * | (__| |_| | _ <| |___
6 * \___|\___/|_| \_\_____|
8 * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
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.
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.
18 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19 * KIND, either express or implied.
21 ***************************************************************************/
33 curl_mimepart *field = NULL;
34 curl_mime *mime = NULL;
36 global_init(CURL_GLOBAL_ALL);
39 mime = curl_mime_init(curls);
40 field = curl_mime_addpart(mime);
41 curl_mime_name(field, "name");
42 curl_mime_data(field, "short value", CURL_ZERO_TERMINATED);
44 easy_setopt(curls, CURLOPT_URL, URL);
45 easy_setopt(curls, CURLOPT_HEADER, 1L);
46 easy_setopt(curls, CURLOPT_VERBOSE, 1L);
47 easy_setopt(curls, CURLOPT_MIMEPOST, mime);
48 easy_setopt(curls, CURLOPT_NOPROGRESS, 1L);
50 res = curl_easy_perform(curls);
54 /* Alter form and resubmit. */
55 curl_mime_data(field, "long value for length change", CURL_ZERO_TERMINATED);
56 res = curl_easy_perform(curls);
60 curl_easy_cleanup(curls);
61 curl_global_cleanup();
62 return (int) res; /* return the final return code */