Annotation of embedaddon/curl/docs/libcurl/opts/CURLOPT_CUSTOMREQUEST.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_CUSTOMREQUEST 3 "March 23, 2020" "libcurl 7.70.0" "curl_easy_setopt options"
24:
25: .SH NAME
26: CURLOPT_CUSTOMREQUEST \- custom string for request
27: .SH SYNOPSIS
28: #include <curl/curl.h>
29:
30: CURLcode curl_easy_setopt(CURL *handle, CURLOPT_CUSTOMREQUEST, char *request);
31: .SH DESCRIPTION
32: Pass a pointer to a zero terminated string as parameter.
33:
34: When you change the request method by setting \fICURLOPT_CUSTOMREQUEST(3)\fP
35: to something, you don't actually change how libcurl behaves or acts in regards
36: to the particular request method, it will only change the actual string sent
37: in the request.
38:
39: Restore to the internal default by setting this to NULL.
40:
41: This option can be used to specify the request:
42: .IP HTTP
43: Instead of GET or HEAD when performing HTTP based requests. This is
44: particularly useful, for example, for performing an HTTP DELETE request.
45:
46: For example:
47:
48: When you tell libcurl to do a HEAD request, but then specify a GET though a
49: custom request libcurl will still act as if it sent a HEAD. To switch to a
50: proper HEAD use \fICURLOPT_NOBODY(3)\fP, to switch to a proper POST use
51: \fICURLOPT_POST(3)\fP or \fICURLOPT_POSTFIELDS(3)\fP and to switch to a proper
52: GET use \fICURLOPT_HTTPGET(3)\fP.
53:
54: Many people have wrongly used this option to replace the entire request with
55: their own, including multiple headers and POST contents. While that might work
56: in many cases, it will cause libcurl to send invalid requests and it could
57: possibly confuse the remote server badly. Use \fICURLOPT_POST(3)\fP and
58: \fICURLOPT_POSTFIELDS(3)\fP to set POST data. Use \fICURLOPT_HTTPHEADER(3)\fP
59: to replace or extend the set of headers sent by libcurl. Use
60: \fICURLOPT_HTTP_VERSION(3)\fP to change HTTP version.
61:
62: .IP FTP
63: Instead of LIST and NLST when performing FTP directory listings.
64: .IP IMAP
65: Instead of LIST when issuing IMAP based requests.
66: .IP POP3
67: Instead of LIST and RETR when issuing POP3 based requests.
68:
69: For example:
70:
71: When you tell libcurl to use a custom request it will behave like a LIST or
72: RETR command was sent where it expects data to be returned by the server. As
73: such \fICURLOPT_NOBODY(3)\fP should be used when specifying commands such as
74: DELE and NOOP for example.
75: .IP SMTP
76: Instead of a HELP or VRFY when issuing SMTP based requests.
77:
78: For example:
79:
80: Normally a multiline response is returned which can be used, in conjunction
81: with \fICURLOPT_MAIL_RCPT(3)\fP, to specify an EXPN request. If the
82: \fICURLOPT_NOBODY(3)\fP option is specified then the request can be used to
83: issue NOOP and RSET commands.
84:
85: The application does not have to keep the string around after setting this
86: option.
87: .SH DEFAULT
88: NULL
89: .SH PROTOCOLS
90: HTTP, FTP, IMAP, POP3 and SMTP
91: .SH EXAMPLE
92: .nf
93: CURL *curl = curl_easy_init();
94: if(curl) {
95: curl_easy_setopt(curl, CURLOPT_URL, "http://example.com/foo.bin");
96:
97: /* DELETE the given path */
98: curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "DELETE");
99:
100: ret = curl_easy_perform(curl);
101:
102: curl_easy_cleanup(curl);
103: }
104: .fi
105: .SH AVAILABILITY
106: IMAP is supported since 7.30.0, POP3 since 7.26.0 and SMTP since 7.34.0.
107: .SH RETURN VALUE
108: Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or
109: CURLE_OUT_OF_MEMORY if there was insufficient heap space.
110: .SH "SEE ALSO"
111: .BR CURLOPT_HTTPHEADER "(3), " CURLOPT_NOBODY "(3), "
112: .BR CURLOPT_REQUEST_TARGET "(3), "
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>