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