quickjs-tart

quickjs-based runtime for wallet-core logic
Log | Files | Refs | README | LICENSE

curl_mime_name.md (1603B)


      1 ---
      2 c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
      3 SPDX-License-Identifier: curl
      4 Title: curl_mime_name
      5 Section: 3
      6 Source: libcurl
      7 See-also:
      8   - curl_mime_addpart (3)
      9   - curl_mime_data (3)
     10   - curl_mime_type (3)
     11 Protocol:
     12   - HTTP
     13   - IMAP
     14   - SMTP
     15 Added-in: 7.56.0
     16 ---
     17 
     18 # NAME
     19 
     20 curl_mime_name - set a mime part's name
     21 
     22 # SYNOPSIS
     23 
     24 ~~~c
     25 #include <curl/curl.h>
     26 
     27 CURLcode curl_mime_name(curl_mimepart *part, const char *name);
     28 ~~~
     29 
     30 # DESCRIPTION
     31 
     32 curl_mime_name(3) sets a mime part's name. This is the way HTTP form
     33 fields are named.
     34 
     35 *part* is the part's handle to assign a name to.
     36 
     37 *name* points to the null-terminated name string.
     38 
     39 The name string is copied into the part, thus the associated storage may
     40 safely be released or reused after call. Setting a part's name multiple times
     41 is valid: only the value set by the last call is retained. It is possible to
     42 reset the name of a part by setting *name* to NULL.
     43 
     44 # %PROTOCOLS%
     45 
     46 # EXAMPLE
     47 
     48 ~~~c
     49 int main(void)
     50 {
     51   curl_mime *mime;
     52   curl_mimepart *part;
     53 
     54   CURL *curl = curl_easy_init();
     55   if(curl) {
     56     /* create a mime handle */
     57     mime = curl_mime_init(curl);
     58 
     59     /* add a part */
     60     part = curl_mime_addpart(mime);
     61 
     62     /* give the part a name */
     63     curl_mime_name(part, "shoe_size");
     64   }
     65 }
     66 ~~~
     67 
     68 # %AVAILABILITY%
     69 
     70 # RETURN VALUE
     71 
     72 This function returns a CURLcode indicating success or error.
     73 
     74 CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
     75 libcurl-errors(3). If CURLOPT_ERRORBUFFER(3) was set with curl_easy_setopt(3)
     76 there can be an error message stored in the error buffer when non-zero is
     77 returned.