CURLOPT_STREAM_WEIGHT.3 3.1 KB

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