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