1CURLOPT_STREAM_WEIGHT(3)   curl_easy_setopt options   CURLOPT_STREAM_WEIGHT(3)
2
3
4

NAME

6       CURLOPT_STREAM_WEIGHT - set numerical stream weight
7

SYNOPSIS

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

DESCRIPTION

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

DEFAULT

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

PROTOCOLS

41       HTTP/2
42

EXAMPLE

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

AVAILABILITY

58       Added in 7.46.0
59

RETURN VALUE

61       Returns CURLE_OK if the option is supported,  and  CURLE_UNKNOWN_OPTION
62       if not.
63

SEE ALSO

65       CURLOPT_STREAM_DEPENDS(3),       CURLOPT_STREAM_DEPENDS_E(3),      CUR‐
66       LOPT_PIPEWAIT(3), CURLMOPT_PIPELINING(3),
67
68
69
70libcurl 7.61.1                  April 17, 2018        CURLOPT_STREAM_WEIGHT(3)
Impressum