CURLOPT_ALTSVC_CTRL.3 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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_ALTSVC_CTRL 3 "5 Feb 2019" "libcurl 7.64.1" "curl_easy_setopt options"
  24. .SH NAME
  25. CURLOPT_ALTSVC_CTRL \- control alt-svc behavior
  26. .SH SYNOPSIS
  27. .nf
  28. #include <curl/curl.h>
  29. #define CURLALTSVC_READONLYFILE (1<<2)
  30. #define CURLALTSVC_H1 (1<<3)
  31. #define CURLALTSVC_H2 (1<<4)
  32. #define CURLALTSVC_H3 (1<<5)
  33. CURLcode curl_easy_setopt(CURL *handle, CURLOPT_ALTSVC_CTRL, long bitmask);
  34. .fi
  35. .SH DESCRIPTION
  36. Populate the long \fIbitmask\fP with the correct set of features to instruct
  37. libcurl how to handle Alt-Svc for the transfers using this handle.
  38. libcurl only accepts Alt-Svc headers over a secure transport, meaning
  39. HTTPS. It will also only complete a request to an alternative origin if that
  40. origin is properly hosted over HTTPS. These requirements are there to make
  41. sure both the source and the destination are legitimate.
  42. Alternative services are only used when setting up new connections. If there
  43. exists an existing connection to the host in the connection pool, then that
  44. will be preferred.
  45. Setting any bit will enable the alt-svc engine.
  46. .IP "CURLALTSVC_READONLYFILE"
  47. Do not write the alt-svc cache back to the file specified with
  48. \fICURLOPT_ALTSVC(3)\fP even if it gets updated. By default a file specified
  49. with that option will be read and written to as deemed necessary.
  50. .IP "CURLALTSVC_H1"
  51. Accept alternative services offered over HTTP/1.1.
  52. .IP "CURLALTSVC_H2"
  53. Accept alternative services offered over HTTP/2. This will only be used if
  54. libcurl was also built to actually support HTTP/2, otherwise this bit will be
  55. ignored.
  56. .IP "CURLALTSVC_H3"
  57. Accept alternative services offered over HTTP/3. This will only be used if
  58. libcurl was also built to actually support HTTP/3, otherwise this bit will be
  59. ignored.
  60. .SH DEFAULT
  61. Alt-Svc handling is disabled by default. If \fICURLOPT_ALTSVC(3)\fP is set,
  62. \fICURLOPT_ALTSVC_CTRL(3)\fP has a default value corresponding to
  63. CURLALTSVC_H1 | CURLALTSVC_H2 | CURLALTSVC_H3 - the HTTP/2 and HTTP/3 bits are
  64. only set if libcurl was built with support for those versions.
  65. .SH PROTOCOLS
  66. HTTPS
  67. .SH EXAMPLE
  68. .nf
  69. CURL *curl = curl_easy_init();
  70. if(curl) {
  71. curl_easy_setopt(curl, CURLOPT_ALTSVC_CTRL, CURLALTSVC_H1);
  72. curl_easy_setopt(curl, CURLOPT_ALTSVC, "altsvc-cache.txt");
  73. curl_easy_perform(curl);
  74. }
  75. .fi
  76. .SH AVAILABILITY
  77. Added in 7.64.1
  78. .SH RETURN VALUE
  79. Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
  80. .SH "SEE ALSO"
  81. .BR CURLOPT_ALTSVC "(3), " CURLOPT_CONNECT_TO "(3), " CURLOPT_RESOLVE "(3), "