diff options
-rw-r--r-- | docs/libcurl/curl_multi_setopt.3 | 4 | ||||
-rw-r--r-- | docs/libcurl/opts/CURLMOPT_MAX_CONCURRENT_STREAMS.3 | 56 | ||||
-rw-r--r-- | docs/libcurl/opts/Makefile.inc | 9 | ||||
-rw-r--r-- | docs/libcurl/symbols-in-versions | 1 | ||||
-rw-r--r-- | include/curl/multi.h | 6 | ||||
-rw-r--r-- | lib/http2.c | 2 | ||||
-rwxr-xr-x | lib/multi.c | 16 | ||||
-rw-r--r-- | lib/multihandle.h | 1 | ||||
-rw-r--r-- | lib/multiif.h | 6 | ||||
-rw-r--r-- | packages/OS400/curl.inc.in | 2 |
10 files changed, 97 insertions, 6 deletions
diff --git a/docs/libcurl/curl_multi_setopt.3 b/docs/libcurl/curl_multi_setopt.3 index d27c52441..88809d62b 100644 --- a/docs/libcurl/curl_multi_setopt.3 +++ b/docs/libcurl/curl_multi_setopt.3 @@ -5,7 +5,7 @@ .\" * | (__| |_| | _ <| |___ .\" * \___|\___/|_| \_\_____| .\" * -.\" * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al. +.\" * Copyright (C) 1998 - 2019, Daniel Stenberg, <daniel@haxx.se>, et al. .\" * .\" * This software is licensed as described in the file COPYING, which .\" * you should have received as part of this distribution. The terms @@ -67,6 +67,8 @@ See \fICURLMOPT_SOCKETDATA(3)\fP See \fICURLMOPT_TIMERFUNCTION(3)\fP .IP CURLMOPT_TIMERDATA See \fICURLMOPT_TIMERDATA(3)\fP +.IP CURLMOPT_MAX_CONCURRENT_STREAMS +See \fICURLMOPT_MAX_CONCURRENT_STREAMS(3)\fP .SH RETURNS The standard CURLMcode for multi interface error codes. Note that it returns a CURLM_UNKNOWN_OPTION if you try setting an option that this version of libcurl diff --git a/docs/libcurl/opts/CURLMOPT_MAX_CONCURRENT_STREAMS.3 b/docs/libcurl/opts/CURLMOPT_MAX_CONCURRENT_STREAMS.3 new file mode 100644 index 000000000..ab044f754 --- /dev/null +++ b/docs/libcurl/opts/CURLMOPT_MAX_CONCURRENT_STREAMS.3 @@ -0,0 +1,56 @@ +.\" ************************************************************************** +.\" * _ _ ____ _ +.\" * Project ___| | | | _ \| | +.\" * / __| | | | |_) | | +.\" * | (__| |_| | _ <| |___ +.\" * \___|\___/|_| \_\_____| +.\" * +.\" * Copyright (C) 1998 - 2019, Daniel Stenberg, <daniel@haxx.se>, et al. +.\" * +.\" * This software is licensed as described in the file COPYING, which +.\" * you should have received as part of this distribution. The terms +.\" * are also available at https://curl.haxx.se/docs/copyright.html. +.\" * +.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell +.\" * copies of the Software, and permit persons to whom the Software is +.\" * furnished to do so, under the terms of the COPYING file. +.\" * +.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY +.\" * KIND, either express or implied. +.\" * +.\" ************************************************************************** +.\" +.TH CURLMOPT_MAX_CONCURRENT_STREAMS 3 "06 Nov 2019" "libcurl 7.67.0" "curl_multi_setopt options" +.SH NAME +CURLMOPT_MAX_CONCURRENT_STREAMS \- set max concurrent streams for http2 +.SH SYNOPSIS +.nf +#include <curl/curl.h> + +CURLMcode curl_multi_setopt(CURLM *handle, CURLMOPT_MAX_CONCURRENT_STREAMS, + long max); +.fi +.SH DESCRIPTION +Pass a long indicating the \fBmax\fP. The set number will be used as the +maximum number of concurrent streams for a connections that libcurl should +support on connections done using HTTP/2. + +Valid values range from 1 to 2147483647 (2^31 - 1) and defaults to 100. The +value passed here would be honoured based on other system resources +properties. +.SH DEFAULT +100 +.SH PROTOCOLS +All +.SH EXAMPLE +.nf + CURLM *m = curl_multi_init(); + /* max concurrent streams 200 */ + curl_multi_setopt(m, CURLMOPT_MAX_CONCURRENT_STREAMS, 200L); +.fi +.SH AVAILABILITY +Added in 7.67.0 +.SH RETURN VALUE +Returns CURLM_OK if the option is supported, and CURLM_UNKNOWN_OPTION if not. +.SH "SEE ALSO" +.BR CURLOPT_MAXCONNECTS "(3), " CURLMOPT_MAXCONNECTS.3 "(3), " diff --git a/docs/libcurl/opts/Makefile.inc b/docs/libcurl/opts/Makefile.inc index b5f62a159..93c4357d2 100644 --- a/docs/libcurl/opts/Makefile.inc +++ b/docs/libcurl/opts/Makefile.inc @@ -68,6 +68,7 @@ man_MANS = \ CURLMOPT_CHUNK_LENGTH_PENALTY_SIZE.3 \ CURLMOPT_CONTENT_LENGTH_PENALTY_SIZE.3 \ CURLMOPT_MAXCONNECTS.3 \ + CURLMOPT_MAX_CONCURRENT_STREAMS.3 \ CURLMOPT_MAX_HOST_CONNECTIONS.3 \ CURLMOPT_MAX_PIPELINE_LENGTH.3 \ CURLMOPT_MAX_TOTAL_CONNECTIONS.3 \ @@ -97,7 +98,6 @@ man_MANS = \ CURLOPT_CHUNK_END_FUNCTION.3 \ CURLOPT_CLOSESOCKETDATA.3 \ CURLOPT_CLOSESOCKETFUNCTION.3 \ - CURLOPT_UPKEEP_INTERVAL_MS.3 \ CURLOPT_CONNECTTIMEOUT.3 \ CURLOPT_CONNECTTIMEOUT_MS.3 \ CURLOPT_CONNECT_ONLY.3 \ @@ -113,8 +113,8 @@ man_MANS = \ CURLOPT_COPYPOSTFIELDS.3 \ CURLOPT_CRLF.3 \ CURLOPT_CRLFILE.3 \ - CURLOPT_CUSTOMREQUEST.3 \ CURLOPT_CURLU.3 \ + CURLOPT_CUSTOMREQUEST.3 \ CURLOPT_DEBUGDATA.3 \ CURLOPT_DEBUGFUNCTION.3 \ CURLOPT_DEFAULT_PROTOCOL.3 \ @@ -168,8 +168,6 @@ man_MANS = \ CURLOPT_HTTP_TRANSFER_DECODING.3 \ CURLOPT_HTTP_VERSION.3 \ CURLOPT_IGNORE_CONTENT_LENGTH.3 \ - CURLOPT_TRAILERDATA.3 \ - CURLOPT_TRAILERFUNCTION.3 \ CURLOPT_INFILESIZE.3 \ CURLOPT_INFILESIZE_LARGE.3 \ CURLOPT_INTERFACE.3 \ @@ -332,10 +330,13 @@ man_MANS = \ CURLOPT_TLSAUTH_PASSWORD.3 \ CURLOPT_TLSAUTH_TYPE.3 \ CURLOPT_TLSAUTH_USERNAME.3 \ + CURLOPT_TRAILERDATA.3 \ + CURLOPT_TRAILERFUNCTION.3 \ CURLOPT_TRANSFERTEXT.3 \ CURLOPT_TRANSFER_ENCODING.3 \ CURLOPT_UNIX_SOCKET_PATH.3 \ CURLOPT_UNRESTRICTED_AUTH.3 \ + CURLOPT_UPKEEP_INTERVAL_MS.3 \ CURLOPT_UPLOAD.3 \ CURLOPT_UPLOAD_BUFFERSIZE.3 \ CURLOPT_URL.3 \ diff --git a/docs/libcurl/symbols-in-versions b/docs/libcurl/symbols-in-versions index ff0dfb238..3e144a719 100644 --- a/docs/libcurl/symbols-in-versions +++ b/docs/libcurl/symbols-in-versions @@ -319,6 +319,7 @@ CURLMOPT_MAXCONNECTS 7.16.3 CURLMOPT_MAX_HOST_CONNECTIONS 7.30.0 CURLMOPT_MAX_PIPELINE_LENGTH 7.30.0 CURLMOPT_MAX_TOTAL_CONNECTIONS 7.30.0 +CURLMOPT_MAX_CONCURRENT_STREAMS 7.67.0 CURLMOPT_PIPELINING 7.16.0 CURLMOPT_PIPELINING_SERVER_BL 7.30.0 CURLMOPT_PIPELINING_SITE_BL 7.30.0 diff --git a/include/curl/multi.h b/include/curl/multi.h index 02df0f389..b39218395 100644 --- a/include/curl/multi.h +++ b/include/curl/multi.h @@ -396,6 +396,9 @@ typedef enum { /* This is the argument passed to the server push callback */ CINIT(PUSHDATA, OBJECTPOINT, 15), + /* maximum number of concurrent streams to support on a connection */ + CINIT(MAX_CONCURRENT_STREAMS, LONG, 16), + CURLMOPT_LASTENTRY /* the last unused */ } CURLMoption; @@ -448,6 +451,9 @@ typedef int (*curl_push_callback)(CURL *parent, struct curl_pushheaders *headers, void *userp); +/* value for MAXIMUM CONCURRENT STREAMS upper limit */ +#define INITIAL_MAX_CONCURRENT_STREAMS ((1U << 31) - 1) + #ifdef __cplusplus } /* end of extern "C" */ #endif diff --git a/lib/http2.c b/lib/http2.c index 98ea90358..d2f5da17a 100644 --- a/lib/http2.c +++ b/lib/http2.c @@ -1159,7 +1159,7 @@ static void populate_settings(struct connectdata *conn, nghttp2_settings_entry *iv = httpc->local_settings; iv[0].settings_id = NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS; - iv[0].value = 100; + iv[0].value = (uint32_t)Curl_multi_max_concurrent_streams(conn->data->multi); iv[1].settings_id = NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE; iv[1].value = HTTP2_HUGE_WINDOW_SIZE; diff --git a/lib/multi.c b/lib/multi.c index 22e0dcfd1..6dfe8842e 100755 --- a/lib/multi.c +++ b/lib/multi.c @@ -2772,6 +2772,16 @@ CURLMcode curl_multi_setopt(struct Curl_multi *multi, break; case CURLMOPT_PIPELINING_SERVER_BL: break; + case CURLMOPT_MAX_CONCURRENT_STREAMS: + { + long streams = va_arg(param, long); + if(streams < 1) + streams = 100; + multi->max_concurrent_streams = + (streams > (long)INITIAL_MAX_CONCURRENT_STREAMS)? + (long)INITIAL_MAX_CONCURRENT_STREAMS : streams; + } + break; default: res = CURLM_UNKNOWN_OPTION; break; @@ -3210,3 +3220,9 @@ void Curl_multi_dump(struct Curl_multi *multi) } } #endif + +size_t Curl_multi_max_concurrent_streams(struct Curl_multi *multi) +{ + return multi ? ((size_t)multi->max_concurrent_streams ? + (size_t)multi->max_concurrent_streams : 100) : 0; +} diff --git a/lib/multihandle.h b/lib/multihandle.h index 279379ae0..b65bd9638 100644 --- a/lib/multihandle.h +++ b/lib/multihandle.h @@ -133,6 +133,7 @@ struct Curl_multi { struct curltime timer_lastcall; /* the fixed time for the timeout for the previous callback */ bool in_callback; /* true while executing a callback */ + long max_concurrent_streams; /* max concurrent streams client to support */ }; #endif /* HEADER_CURL_MULTIHANDLE_H */ diff --git a/lib/multiif.h b/lib/multiif.h index 0755a7cd2..75025232c 100644 --- a/lib/multiif.h +++ b/lib/multiif.h @@ -89,4 +89,10 @@ CURLMcode Curl_multi_add_perform(struct Curl_multi *multi, struct Curl_easy *data, struct connectdata *conn); + +/* Return the value of the CURLMOPT_MAX_CONCURRENT_STREAMS option + * If not specified or 0, default would be 100 + */ +size_t Curl_multi_max_concurrent_streams(struct Curl_multi *multi); + #endif /* HEADER_CURL_MULTIIF_H */ diff --git a/packages/OS400/curl.inc.in b/packages/OS400/curl.inc.in index 5a53b1b21..8be6c8986 100644 --- a/packages/OS400/curl.inc.in +++ b/packages/OS400/curl.inc.in @@ -1841,6 +1841,8 @@ d c 20014 d CURLMOPT_PUSHDATA... d c 10015 + d CURLMOPT_MAX_CONCURRENT_STREAMS... + d c 10016 * * Bitmask bits for CURLMOPT_PIPELING. * |