1 .\" **************************************************************************
3 .\" * Project ___| | | | _ \| |
4 .\" * / __| | | | |_) | |
5 .\" * | (__| |_| | _ <| |___
6 .\" * \___|\___/|_| \_\_____|
8 .\" * Copyright (C) 1998 - 2016, 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 .\" **************************************************************************
23 .TH CURLOPT_CUSTOMREQUEST 3 "17 Jun 2014" "libcurl 7.37.0" "curl_easy_setopt options"
25 CURLOPT_CUSTOMREQUEST \- custom string for request
27 #include <curl/curl.h>
29 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_CUSTOMREQUEST, char *request);
31 Pass a pointer to a zero terminated string as parameter.
33 When you change the request method by setting \fICURLOPT_CUSTOMREQUEST(3)\fP
34 to something, you don't actually change how libcurl behaves or acts in regards
35 to the particular request method, it will only change the actual string sent
38 Restore to the internal default by setting this to NULL.
40 This option can be used to specify the request:
42 Instead of GET or HEAD when performing HTTP based requests. This is
43 particularly useful, for example, for performing a HTTP DELETE request.
47 When you tell libcurl to do a HEAD request, but then specify a GET though a
48 custom request libcurl will still act as if it sent a HEAD. To switch to a
49 proper HEAD use \fICURLOPT_NOBODY(3)\fP, to switch to a proper POST use
50 \fICURLOPT_POST(3)\fP or \fICURLOPT_POSTFIELDS(3)\fP and to switch to a proper
51 GET use \fICURLOPT_HTTPGET(3)\fP.
53 Many people have wrongly used this option to replace the entire request with
54 their own, including multiple headers and POST contents. While that might work
55 in many cases, it will cause libcurl to send invalid requests and it could
56 possibly confuse the remote server badly. Use \fICURLOPT_POST(3)\fP and
57 \fICURLOPT_POSTFIELDS(3)\fP to set POST data. Use \fICURLOPT_HTTPHEADER(3)\fP
58 to replace or extend the set of headers sent by libcurl. Use
59 \fICURLOPT_HTTP_VERSION(3)\fP to change HTTP version.
62 Instead of LIST and NLST when performing FTP directory listings.
64 Instead of LIST when issuing IMAP based requests.
66 Instead of LIST and RETR when issuing POP3 based requests.
70 When you tell libcurl to use a custom request it will behave like a LIST or
71 RETR command was sent where it expects data to be returned by the server. As
72 such \fICURLOPT_NOBODY(3)\fP should be used when specifying commands such as
73 DELE and NOOP for example.
75 Instead of a HELP or VRFY when issuing SMTP based requests.
79 Normally a multiline response is returned which can be used, in conjunction
80 with \fICURLOPT_MAIL_RCPT(3)\fP, to specify an EXPN request. If the
81 \fICURLOPT_NOBODY(3)\fP option is specified then the request can be used to
82 issue NOOP and RSET commands.
84 The application does not have to keep the string around after setting this
89 HTTP, FTP, IMAP, POP3 and SMTP
93 IMAP is supported since 7.30.0, POP3 since 7.26.0 and SMTP since 7.34.0.
95 Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or
96 CURLE_OUT_OF_MEMORY if there was insufficient heap space.
98 .BR CURLOPT_HTTPHEADER "(3), " CURLOPT_NOBODY "(3), "