CURLOPT_STREAM_WEIGHT.3 3.1 KB

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