Annotation of embedaddon/curl/docs/libcurl/opts/CURLOPT_COPYPOSTFIELDS.3, revision 1.1.1.1

1.1       misho       1: .\" **************************************************************************
                      2: .\" *                                  _   _ ____  _
                      3: .\" *  Project                     ___| | | |  _ \| |
                      4: .\" *                             / __| | | | |_) | |
                      5: .\" *                            | (__| |_| |  _ <| |___
                      6: .\" *                             \___|\___/|_| \_\_____|
                      7: .\" *
                      8: .\" * Copyright (C) 1998 - 2020, 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: .\"
                     23: .TH CURLOPT_COPYPOSTFIELDS 3 "March 23, 2020" "libcurl 7.70.0" "curl_easy_setopt options"
                     24: 
                     25: .SH NAME
                     26: CURLOPT_COPYPOSTFIELDS \- have libcurl copy data to POST
                     27: .SH SYNOPSIS
                     28: #include <curl/curl.h>
                     29: 
                     30: CURLcode curl_easy_setopt(CURL *handle, CURLOPT_COPYPOSTFIELDS, char *data);
                     31: .SH DESCRIPTION
                     32: Pass a char * as parameter, which should be the full \fIdata\fP to post in a
                     33: HTTP POST operation. It behaves as the \fICURLOPT_POSTFIELDS(3)\fP option, but
                     34: the original data is instead copied by the library, allowing the application
                     35: to overwrite the original data after setting this option.
                     36: 
                     37: Because data are copied, care must be taken when using this option in
                     38: conjunction with \fICURLOPT_POSTFIELDSIZE(3)\fP or
                     39: \fICURLOPT_POSTFIELDSIZE_LARGE(3)\fP: If the size has not been set prior to
                     40: \fICURLOPT_COPYPOSTFIELDS(3)\fP, the data is assumed to be a zero terminated
                     41: string; else the stored size informs the library about the byte count to
                     42: copy. In any case, the size must not be changed after
                     43: \fICURLOPT_COPYPOSTFIELDS(3)\fP, unless another \fICURLOPT_POSTFIELDS(3)\fP or
                     44: \fICURLOPT_COPYPOSTFIELDS(3)\fP option is issued.
                     45: .SH DEFAULT
                     46: NULL
                     47: .SH PROTOCOLS
                     48: HTTP(S)
                     49: .SH EXAMPLE
                     50: .nf
                     51: CURL *curl = curl_easy_init();
                     52: if(curl) {
                     53:   char local_buffer[1024]="data to send";
                     54:   curl_easy_setopt(curl, CURLOPT_URL, "http://example.com");
                     55: 
                     56:   /* size of the data to copy from the buffer and send in the request */
                     57:   curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, 12L);
                     58: 
                     59:   /* send data from the local stack */
                     60:   curl_easy_setopt(curl, CURLOPT_COPYPOSTFIELDS, local_buffer);
                     61: 
                     62:   curl_easy_perform(curl);
                     63: }
                     64: .fi
                     65: .SH AVAILABILITY
                     66: Added in 7.17.1
                     67: .SH RETURN VALUE
                     68: Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or
                     69: CURLE_OUT_OF_MEMORY if there was insufficient heap space.
                     70: .SH "SEE ALSO"
                     71: .BR CURLOPT_POSTFIELDS "(3), " CURLOPT_POSTFIELDSIZE "(3), "

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>