2bd3517997252f2f8d5afde36a95dbfb01cdf64f
[platform/upstream/curl.git] / docs / libcurl / opts / CURLOPT_CUSTOMREQUEST.3
1 .\" **************************************************************************
2 .\" *                                  _   _ ____  _
3 .\" *  Project                     ___| | | |  _ \| |
4 .\" *                             / __| | | | |_) | |
5 .\" *                            | (__| |_| |  _ <| |___
6 .\" *                             \___|\___/|_| \_\_____|
7 .\" *
8 .\" * Copyright (C) 1998 - 2016, 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 "17 Jun 2014" "libcurl 7.37.0" "curl_easy_setopt options"
24 .SH NAME
25 CURLOPT_CUSTOMREQUEST \- custom string for request
26 .SH SYNOPSIS
27 #include <curl/curl.h>
28
29 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_CUSTOMREQUEST, char *request);
30 .SH DESCRIPTION
31 Pass a pointer to a zero terminated string as parameter.
32
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
36 in the request.
37
38 Restore to the internal default by setting this to NULL.
39
40 This option can be used to specify the request:
41 .IP HTTP
42 Instead of GET or HEAD when performing HTTP based requests. This is
43 particularly useful, for example, for performing a HTTP DELETE request.
44
45 For example:
46
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.
52
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.
60
61 .IP FTP
62 Instead of LIST and NLST when performing FTP directory listings.
63 .IP IMAP
64 Instead of LIST when issuing IMAP based requests.
65 .IP POP3
66 Instead of LIST and RETR when issuing POP3 based requests.
67
68 For example:
69
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.
74 .IP SMTP
75 Instead of a HELP or VRFY when issuing SMTP based requests.
76
77 For example:
78
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.
83
84 The application does not have to keep the string around after setting this
85 option.
86 .SH DEFAULT
87 NULL
88 .SH PROTOCOLS
89 HTTP, FTP, IMAP, POP3 and SMTP
90 .SH EXAMPLE
91 TODO
92 .SH AVAILABILITY
93 IMAP is supported since 7.30.0, POP3 since 7.26.0 and SMTP since 7.34.0.
94 .SH RETURN VALUE
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.
97 .SH "SEE ALSO"
98 .BR CURLOPT_HTTPHEADER "(3), " CURLOPT_NOBODY "(3), "