Imported Upstream version 7.59.0
[platform/upstream/curl.git] / docs / libcurl / opts / CURLOPT_DEFAULT_PROTOCOL.3
1 .\" **************************************************************************
2 .\" *                                  _   _ ____  _
3 .\" *  Project                     ___| | | |  _ \| |
4 .\" *                             / __| | | | |_) | |
5 .\" *                            | (__| |_| |  _ <| |___
6 .\" *                             \___|\___/|_| \_\_____|
7 .\" *
8 .\" * Copyright (C) 1998 - 2015, 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_DEFAULT_PROTOCOL 3 "December 21, 2016" "libcurl 7.59.0" "curl_easy_setopt options"
24
25 .SH NAME
26 CURLOPT_DEFAULT_PROTOCOL \- default protocol to use if the URL is missing a
27 scheme name
28 .SH SYNOPSIS
29 #include <curl/curl.h>
30
31 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_DEFAULT_PROTOCOL, char
32 *protocol);
33 .SH DESCRIPTION
34 This option tells libcurl to use \fIprotocol\fP if the URL is missing a scheme
35 name.
36
37 Use one of these protocol (scheme) names:
38
39 dict, file, ftp, ftps, gopher, http, https, imap, imaps, ldap, ldaps, pop3,
40 pop3s, rtsp, scp, sftp, smb, smbs, smtp, smtps, telnet, tftp
41
42 An unknown or unsupported protocol causes error
43 \fICURLE_UNSUPPORTED_PROTOCOL\fP when libcurl parses a schemeless URL. Parsing
44 happens when \fIcurl_easy_perform(3)\fP or \fIcurl_multi_perform(3)\fP is
45 called. The protocols supported by libcurl will vary depending on how it was
46 built. Use \fIcurl_version_info(3)\fP if you need a list of protocol names
47 supported by the build of libcurl that you are using.
48
49 This option does not change the default proxy protocol (http).
50
51 Without this option libcurl would make a guess based on the host, see
52 \fICURLOPT_URL(3)\fP for details.
53
54 The application does not have to keep the string around after setting this
55 option.
56 .SH DEFAULT
57 NULL (make a guess based on the host)
58 .SH PROTOCOLS
59 All
60 .SH EXAMPLE
61 .nf
62 curl = curl_easy_init();
63 if(curl) {
64   /* set a URL without a scheme */
65   curl_easy_setopt(curl, CURLOPT_URL, "example.com");
66
67   /* set the default protocol (scheme) for schemeless URLs */
68   curl_easy_setopt(curl, CURLOPT_DEFAULT_PROTOCOL, "https");
69
70   /* Perform the request */
71   curl_easy_perform(curl);
72 }
73 .fi
74 .SH AVAILABILITY
75 Added in 7.45.0
76 .SH RETURN VALUE
77 CURLE_OK if the option is supported.
78
79 CURLE_OUT_OF_MEMORY if there was insufficient heap space.
80
81 CURLE_UNKNOWN_OPTION if the option is not supported.
82 .SH "SEE ALSO"
83 .BR CURLOPT_URL "(3), "