CURLOPT_DEFAULT_PROTOCOL.3 3.0 KB

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