1CURLOPT_STREAM_WEIGHT(3)            libcurl           CURLOPT_STREAM_WEIGHT(3)
2
3
4

NAME

6       CURLOPT_STREAM_WEIGHT - numerical stream weight
7

SYNOPSIS

9       #include <curl/curl.h>
10
11       CURLcode curl_easy_setopt(CURL *handle, CURLOPT_STREAM_WEIGHT, long weight);
12

DESCRIPTION

14       Set the long weight to a number between 1 and 256.
15
16       When using HTTP/2, this option sets the individual weight for this par‐
17       ticular stream used by the easy handle. Setting and using weights  only
18       makes  sense  and  is  only usable when doing multiple streams over the
19       same connections, which thus implies  that  you  use  CURLMOPT_PIPELIN‐
20       ING(3).
21
22       This  option can be set during transfer and will then cause the updated
23       weight info get sent to the server the next time  an  HTTP/2  frame  is
24       sent to the server.
25
26       See section 5.3 of RFC 7540 for protocol details.
27
28       Streams  with the same parent should be allocated resources proportion‐
29       ally based on their weight. So if you have two streams going, stream  A
30       with  weight  16  and  stream  B  with weight 32, stream B will get two
31       thirds (32/48) of the available bandwidth (assuming the server can send
32       off the data equally for both streams).
33

DEFAULT

35       If  nothing is set, the HTTP/2 protocol itself will use its own default
36       which is 16.
37

PROTOCOLS

39       HTTP/2
40

EXAMPLE

42       CURL *curl = curl_easy_init();
43       CURL *curl2 = curl_easy_init(); /* a second handle */
44       if(curl) {
45         curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/one");
46         curl_easy_setopt(curl, CURLOPT_STREAM_WEIGHT, 10L);
47
48         /* the second has twice the weight */
49         curl_easy_setopt(curl2, CURLOPT_URL, "https://example.com/two");
50         curl_easy_setopt(curl2, CURLOPT_STREAM_WEIGHT, 20L);
51
52         /* then add both to a multi handle and transfer them! */
53       }
54

AVAILABILITY

56       Added in 7.46.0
57

RETURN VALUE

59       Returns CURLE_OK if the option is supported,  and  CURLE_UNKNOWN_OPTION
60       if not.
61

SEE ALSO

63       CURLOPT_STREAM_DEPENDS(3),       CURLOPT_STREAM_DEPENDS_E(3),      CUR‐
64       LOPT_PIPEWAIT(3), CURLMOPT_PIPELINING(3),
65
66
67
68ibcurl 8.2.1                    April 26, 2023        CURLOPT_STREAM_WEIGHT(3)
Impressum