CURLOPT_DEFAULT_PROTOCOL.3 2.9 KB

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