CURLOPT_STREAM_WEIGHT.3 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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_STREAM_WEIGHT 3 "13 Sep 2015" libcurl libcurl
  26. .SH NAME
  27. CURLOPT_STREAM_WEIGHT \- numerical stream weight
  28. .SH SYNOPSIS
  29. .nf
  30. #include <curl/curl.h>
  31. CURLcode curl_easy_setopt(CURL *handle, CURLOPT_STREAM_WEIGHT, long weight);
  32. .fi
  33. .SH DESCRIPTION
  34. Set the long \fIweight\fP to a number between 1 and 256.
  35. When using HTTP/2, this option sets the individual weight for this particular
  36. stream used by the easy \fIhandle\fP. Setting and using weights only makes
  37. sense and is only usable when doing multiple streams over the same
  38. connections, which thus implies that you use \fICURLMOPT_PIPELINING(3)\fP.
  39. This option can be set during transfer and will then cause the updated weight
  40. info get sent to the server the next time an HTTP/2 frame is sent to the
  41. server.
  42. See section 5.3 of RFC 7540 for protocol details.
  43. Streams with the same parent should be allocated resources proportionally
  44. based on their weight. So if you have two streams going, stream A with weight
  45. 16 and stream B with weight 32, stream B will get two thirds (32/48) of the
  46. available bandwidth (assuming the server can send off the data equally for
  47. both streams).
  48. .SH DEFAULT
  49. If nothing is set, the HTTP/2 protocol itself will use its own default which
  50. is 16.
  51. .SH PROTOCOLS
  52. HTTP/2
  53. .SH EXAMPLE
  54. .nf
  55. CURL *curl = curl_easy_init();
  56. CURL *curl2 = curl_easy_init(); /* a second handle */
  57. if(curl) {
  58. curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/one");
  59. curl_easy_setopt(curl, CURLOPT_STREAM_WEIGHT, 10L);
  60. /* the second has twice the weight */
  61. curl_easy_setopt(curl2, CURLOPT_URL, "https://example.com/two");
  62. curl_easy_setopt(curl2, CURLOPT_STREAM_WEIGHT, 20L);
  63. /* then add both to a multi handle and transfer them! */
  64. }
  65. .fi
  66. .SH AVAILABILITY
  67. Added in 7.46.0
  68. .SH RETURN VALUE
  69. Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
  70. .SH "SEE ALSO"
  71. .BR CURLOPT_STREAM_DEPENDS "(3), " CURLOPT_STREAM_DEPENDS_E "(3), "
  72. .BR CURLOPT_PIPEWAIT "(3), " CURLMOPT_PIPELINING "(3), "