CURLOPT_ALTSVC_CTRL.3 3.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. .\" **************************************************************************
  2. .\" * _ _ ____ _
  3. .\" * Project ___| | | | _ \| |
  4. .\" * / __| | | | |_) | |
  5. .\" * | (__| |_| | _ <| |___
  6. .\" * \___|\___/|_| \_\_____|
  7. .\" *
  8. .\" * Copyright (C) 1998 - 2019, 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_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_IMMEDIATELY (1<<0)
  30. #define CURLALTSVC_READONLYFILE (1<<2)
  31. #define CURLALTSVC_H1 (1<<3)
  32. #define CURLALTSVC_H2 (1<<4)
  33. #define CURLALTSVC_H3 (1<<5)
  34. CURLcode curl_easy_setopt(CURL *handle, CURLOPT_ALTSVC_CTRL, long bitmask);
  35. .fi
  36. .SH EXPERIMENTAL
  37. Warning: this feature is early code and is marked as experimental. It can only
  38. be enabled by explicitly telling configure with \fB--enable-alt-svc\fP. You are
  39. advised to not ship this in production before the experimental label is
  40. removed.
  41. .SH DESCRIPTION
  42. Populate the long \fIbitmask\fP with the correct set of features to instruct
  43. libcurl how to handle Alt-Svc for the transfers using this handle.
  44. libcurl will only accept Alt-Svc headers over a secure transport, meaning
  45. HTTPS. It will also only complete a request to an alternative origin if that
  46. origin is properly hosted over HTTPS. These requirements are there to make
  47. sure both the source and the destination are legitimate.
  48. Setting any bit will enable the alt-svc engine.
  49. .IP "CURLALTSVC_IMMEDIATELY"
  50. If an Alt-Svc: header is received, this instructs libcurl to switch to one of
  51. those alternatives asap rather than to save it and use for the next
  52. request. (Not currently supported).
  53. .IP "CURLALTSVC_READONLYFILE"
  54. Do not write the alt-svc cache back to the file specified with
  55. \fICURLOPT_ALTSVC(3)\fP even if it gets updated. By default a file specified
  56. with that option will be read and written to as deemed necessary.
  57. .IP "CURLALTSVC_H1"
  58. Accept alternative services offered over HTTP/1.1.
  59. .IP "CURLALTSVC_H2"
  60. Accept alternative services offered over HTTP/2. This will only be used if
  61. libcurl was also built to actually support HTTP/2, otherwise this bit will be
  62. ignored.
  63. .IP "CURLALTSVC_H3"
  64. Accept alternative services offered over HTTP/3. This will only be used if
  65. libcurl was also built to actually support HTTP/3, otherwise this bit will be
  66. ignored.
  67. .SH DEFAULT
  68. 0. No Alt-Svc treatment.
  69. .SH PROTOCOLS
  70. HTTPS
  71. .SH EXAMPLE
  72. .nf
  73. CURL *curl = curl_easy_init();
  74. if(curl) {
  75. curl_easy_setopt(curl, CURLOPT_ALTSVC_CTRL, CURLALTSVC_H1);
  76. curl_easy_setopt(curl, CURLOPT_ALTSVC, "altsvc-cache.txt");
  77. curl_easy_perform(curl);
  78. }
  79. .fi
  80. .SH AVAILABILITY
  81. Added in 7.64.1
  82. .SH RETURN VALUE
  83. Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
  84. .SH "SEE ALSO"
  85. .BR CURLOPT_ALTSVC "(3), " CURLOPT_CONNECT_TO "(3), " CURLOPT_RESOLVE "(3), "