Loading docs/libcurl/opts/CURLMOPT_PIPELINING.3 +19 −8 Original line number Diff line number Diff line Loading @@ -5,7 +5,7 @@ .\" * | (__| |_| | _ <| |___ .\" * \___|\___/|_| \_\_____| .\" * .\" * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al. .\" * Copyright (C) 1998 - 2015, 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 Loading @@ -26,17 +26,28 @@ CURLMOPT_PIPELINING \- enable/disable HTTP pipelining .SH SYNOPSIS #include <curl/curl.h> CURLMcode curl_multi_setopt(CURLM *handle, CURLMOPT_PIPELINING, bool onoff); CURLMcode curl_multi_setopt(CURLM *handle, CURLMOPT_PIPELINING, long bits); .SH DESCRIPTION Set the \fBonoff\fP parameter to 1 to make libcurl use HTTP pipelining for HTTP transfers done using this multi handle, as far as possible. This means that if you add a second request that can use an already existing connection, the second request will be \&"piped" on the same connection rather than being executed in parallel. Set the \fBbits\fP parameter to 1 to make libcurl use HTTP pipelining for HTTP/1.1 transfers done using this multi handle, as far as possible. This means that if you add a second request that can use an already existing connection, the second request will be \&"piped" on the same connection rather than being executed in parallel. When using pipelining, there are also several other related options that are interesting to tweak and adjust to alter how libcurl spreads out requests on different connections or not etc. Starting in 7.43.0, the \fBbits\fP parameter's bit 1 also has a meaning and libcurl is now offering symbol names for the bits: .IP CURLPIPE_NOTHING (0) Default, which means doing no attempts at pipelining or multiplexing. .IP CURLPIPE_HTTP1 (1) If this bit is set, libcurl will try to pipeline HTTP/1.1 requests on connections that are already established and in use to hosts. .IP CURLPIPE_MULTIPLEX (2) If this bit is set, libcurl will try to multiplex the new transfer over an existing connection if possible. This requires HTTP/2. .SH DEFAULT 0 (off) .SH PROTOCOLS Loading @@ -44,7 +55,7 @@ HTTP(S) .SH EXAMPLE TODO .SH AVAILABILITY Added in 7.16.0 Added in 7.16.0. Multiplex support bit added in 7.43.0. .SH RETURN VALUE Returns CURLM_OK if the option is supported, and CURLM_UNKNOWN_OPTION if not. .SH "SEE ALSO" Loading include/curl/multi.h +6 −1 Original line number Diff line number Diff line Loading @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2015, 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 Loading Loading @@ -74,6 +74,11 @@ typedef enum { curl_multi_perform() and CURLM_CALL_MULTI_PERFORM */ #define CURLM_CALL_MULTI_SOCKET CURLM_CALL_MULTI_PERFORM /* bitmask bits for CURLMOPT_PIPELINING */ #define CURLPIPE_NOTHING 0L #define CURLPIPE_HTTP1 1L #define CURLPIPE_MULTIPLEX 2L typedef enum { CURLMSG_NONE, /* first, not used */ CURLMSG_DONE, /* This easy handle has completed. 'result' contains Loading lib/multi.c +8 −7 Original line number Diff line number Diff line Loading @@ -613,9 +613,10 @@ CURLMcode curl_multi_remove_handle(CURLM *multi_handle, return CURLM_OK; } bool Curl_multi_pipeline_enabled(const struct Curl_multi *multi) /* Return TRUE if the application asked for a certain set of pipelining */ bool Curl_pipeline_wanted(const struct Curl_multi *multi, int bits) { return (multi && multi->pipelining_enabled) ? TRUE : FALSE; return (multi && (multi->pipelining & bits)) ? TRUE : FALSE; } void Curl_multi_handlePipeBreak(struct SessionHandle *data) Loading Loading @@ -1082,7 +1083,7 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi, rc = CURLM_CALL_MULTI_PERFORM; if(protocol_connect) multistate(data, multi->pipelining_enabled? multistate(data, Curl_pipeline_wanted(multi, CURLPIPE_HTTP1)? CURLM_STATE_WAITDO:CURLM_STATE_DO); else { #ifndef CURL_DISABLE_HTTP Loading Loading @@ -1139,7 +1140,7 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi, /* call again please so that we get the next socket setup */ rc = CURLM_CALL_MULTI_PERFORM; if(protocol_connect) multistate(data, multi->pipelining_enabled? multistate(data, Curl_pipeline_wanted(multi, CURLPIPE_HTTP1)? CURLM_STATE_WAITDO:CURLM_STATE_DO); else { #ifndef CURL_DISABLE_HTTP Loading Loading @@ -1203,7 +1204,7 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi, multistate(data, CURLM_STATE_PROTOCONNECT); else if(!result) { /* protocol connect has completed, go WAITDO or DO */ multistate(data, multi->pipelining_enabled? multistate(data, Curl_pipeline_wanted(multi, CURLPIPE_HTTP1)? CURLM_STATE_WAITDO:CURLM_STATE_DO); rc = CURLM_CALL_MULTI_PERFORM; } Loading @@ -1220,7 +1221,7 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi, result = Curl_protocol_connecting(data->easy_conn, &protocol_connect); if(!result && protocol_connect) { /* after the connect has completed, go WAITDO or DO */ multistate(data, multi->pipelining_enabled? multistate(data, Curl_pipeline_wanted(multi, CURLPIPE_HTTP1)? CURLM_STATE_WAITDO:CURLM_STATE_DO); rc = CURLM_CALL_MULTI_PERFORM; } Loading Loading @@ -2340,7 +2341,7 @@ CURLMcode curl_multi_setopt(CURLM *multi_handle, multi->socket_userp = va_arg(param, void *); break; case CURLMOPT_PIPELINING: multi->pipelining_enabled = (0 != va_arg(param, long)) ? TRUE : FALSE; multi->pipelining = va_arg(param, long); break; case CURLMOPT_TIMERFUNCTION: multi->timer_cb = va_arg(param, curl_multi_timer_callback); Loading lib/multihandle.h +4 −2 Original line number Diff line number Diff line Loading @@ -62,6 +62,8 @@ typedef enum { #define GETSOCK_READABLE (0x00ff) #define GETSOCK_WRITABLE (0xff00) #define CURLPIPE_ANY (CURLPIPE_HTTP1 | CURLPIPE_MULTIPLEX) /* This is the struct known as CURLM on the outside */ struct Curl_multi { /* First a simple identifier to easier detect if a user mix up Loading Loading @@ -97,8 +99,8 @@ struct Curl_multi { same actual socket) */ struct curl_hash sockhash; /* Whether pipelining is enabled for this multi handle */ bool pipelining_enabled; /* pipelining wanted bits (CURLPIPE*) */ long pipelining; /* Shared connection cache (bundles)*/ struct conncache conn_cache; Loading lib/multiif.h +2 −3 Original line number Diff line number Diff line Loading @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2015, 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 Loading @@ -27,8 +27,7 @@ */ void Curl_expire(struct SessionHandle *data, long milli); void Curl_expire_latest(struct SessionHandle *data, long milli); bool Curl_multi_pipeline_enabled(const struct Curl_multi* multi); bool Curl_pipeline_wanted(const struct Curl_multi* multi, int bits); void Curl_multi_handlePipeBreak(struct SessionHandle *data); /* Internal version of curl_multi_init() accepts size parameters for the Loading Loading
docs/libcurl/opts/CURLMOPT_PIPELINING.3 +19 −8 Original line number Diff line number Diff line Loading @@ -5,7 +5,7 @@ .\" * | (__| |_| | _ <| |___ .\" * \___|\___/|_| \_\_____| .\" * .\" * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al. .\" * Copyright (C) 1998 - 2015, 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 Loading @@ -26,17 +26,28 @@ CURLMOPT_PIPELINING \- enable/disable HTTP pipelining .SH SYNOPSIS #include <curl/curl.h> CURLMcode curl_multi_setopt(CURLM *handle, CURLMOPT_PIPELINING, bool onoff); CURLMcode curl_multi_setopt(CURLM *handle, CURLMOPT_PIPELINING, long bits); .SH DESCRIPTION Set the \fBonoff\fP parameter to 1 to make libcurl use HTTP pipelining for HTTP transfers done using this multi handle, as far as possible. This means that if you add a second request that can use an already existing connection, the second request will be \&"piped" on the same connection rather than being executed in parallel. Set the \fBbits\fP parameter to 1 to make libcurl use HTTP pipelining for HTTP/1.1 transfers done using this multi handle, as far as possible. This means that if you add a second request that can use an already existing connection, the second request will be \&"piped" on the same connection rather than being executed in parallel. When using pipelining, there are also several other related options that are interesting to tweak and adjust to alter how libcurl spreads out requests on different connections or not etc. Starting in 7.43.0, the \fBbits\fP parameter's bit 1 also has a meaning and libcurl is now offering symbol names for the bits: .IP CURLPIPE_NOTHING (0) Default, which means doing no attempts at pipelining or multiplexing. .IP CURLPIPE_HTTP1 (1) If this bit is set, libcurl will try to pipeline HTTP/1.1 requests on connections that are already established and in use to hosts. .IP CURLPIPE_MULTIPLEX (2) If this bit is set, libcurl will try to multiplex the new transfer over an existing connection if possible. This requires HTTP/2. .SH DEFAULT 0 (off) .SH PROTOCOLS Loading @@ -44,7 +55,7 @@ HTTP(S) .SH EXAMPLE TODO .SH AVAILABILITY Added in 7.16.0 Added in 7.16.0. Multiplex support bit added in 7.43.0. .SH RETURN VALUE Returns CURLM_OK if the option is supported, and CURLM_UNKNOWN_OPTION if not. .SH "SEE ALSO" Loading
include/curl/multi.h +6 −1 Original line number Diff line number Diff line Loading @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2015, 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 Loading Loading @@ -74,6 +74,11 @@ typedef enum { curl_multi_perform() and CURLM_CALL_MULTI_PERFORM */ #define CURLM_CALL_MULTI_SOCKET CURLM_CALL_MULTI_PERFORM /* bitmask bits for CURLMOPT_PIPELINING */ #define CURLPIPE_NOTHING 0L #define CURLPIPE_HTTP1 1L #define CURLPIPE_MULTIPLEX 2L typedef enum { CURLMSG_NONE, /* first, not used */ CURLMSG_DONE, /* This easy handle has completed. 'result' contains Loading
lib/multi.c +8 −7 Original line number Diff line number Diff line Loading @@ -613,9 +613,10 @@ CURLMcode curl_multi_remove_handle(CURLM *multi_handle, return CURLM_OK; } bool Curl_multi_pipeline_enabled(const struct Curl_multi *multi) /* Return TRUE if the application asked for a certain set of pipelining */ bool Curl_pipeline_wanted(const struct Curl_multi *multi, int bits) { return (multi && multi->pipelining_enabled) ? TRUE : FALSE; return (multi && (multi->pipelining & bits)) ? TRUE : FALSE; } void Curl_multi_handlePipeBreak(struct SessionHandle *data) Loading Loading @@ -1082,7 +1083,7 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi, rc = CURLM_CALL_MULTI_PERFORM; if(protocol_connect) multistate(data, multi->pipelining_enabled? multistate(data, Curl_pipeline_wanted(multi, CURLPIPE_HTTP1)? CURLM_STATE_WAITDO:CURLM_STATE_DO); else { #ifndef CURL_DISABLE_HTTP Loading Loading @@ -1139,7 +1140,7 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi, /* call again please so that we get the next socket setup */ rc = CURLM_CALL_MULTI_PERFORM; if(protocol_connect) multistate(data, multi->pipelining_enabled? multistate(data, Curl_pipeline_wanted(multi, CURLPIPE_HTTP1)? CURLM_STATE_WAITDO:CURLM_STATE_DO); else { #ifndef CURL_DISABLE_HTTP Loading Loading @@ -1203,7 +1204,7 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi, multistate(data, CURLM_STATE_PROTOCONNECT); else if(!result) { /* protocol connect has completed, go WAITDO or DO */ multistate(data, multi->pipelining_enabled? multistate(data, Curl_pipeline_wanted(multi, CURLPIPE_HTTP1)? CURLM_STATE_WAITDO:CURLM_STATE_DO); rc = CURLM_CALL_MULTI_PERFORM; } Loading @@ -1220,7 +1221,7 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi, result = Curl_protocol_connecting(data->easy_conn, &protocol_connect); if(!result && protocol_connect) { /* after the connect has completed, go WAITDO or DO */ multistate(data, multi->pipelining_enabled? multistate(data, Curl_pipeline_wanted(multi, CURLPIPE_HTTP1)? CURLM_STATE_WAITDO:CURLM_STATE_DO); rc = CURLM_CALL_MULTI_PERFORM; } Loading Loading @@ -2340,7 +2341,7 @@ CURLMcode curl_multi_setopt(CURLM *multi_handle, multi->socket_userp = va_arg(param, void *); break; case CURLMOPT_PIPELINING: multi->pipelining_enabled = (0 != va_arg(param, long)) ? TRUE : FALSE; multi->pipelining = va_arg(param, long); break; case CURLMOPT_TIMERFUNCTION: multi->timer_cb = va_arg(param, curl_multi_timer_callback); Loading
lib/multihandle.h +4 −2 Original line number Diff line number Diff line Loading @@ -62,6 +62,8 @@ typedef enum { #define GETSOCK_READABLE (0x00ff) #define GETSOCK_WRITABLE (0xff00) #define CURLPIPE_ANY (CURLPIPE_HTTP1 | CURLPIPE_MULTIPLEX) /* This is the struct known as CURLM on the outside */ struct Curl_multi { /* First a simple identifier to easier detect if a user mix up Loading Loading @@ -97,8 +99,8 @@ struct Curl_multi { same actual socket) */ struct curl_hash sockhash; /* Whether pipelining is enabled for this multi handle */ bool pipelining_enabled; /* pipelining wanted bits (CURLPIPE*) */ long pipelining; /* Shared connection cache (bundles)*/ struct conncache conn_cache; Loading
lib/multiif.h +2 −3 Original line number Diff line number Diff line Loading @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2015, 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 Loading @@ -27,8 +27,7 @@ */ void Curl_expire(struct SessionHandle *data, long milli); void Curl_expire_latest(struct SessionHandle *data, long milli); bool Curl_multi_pipeline_enabled(const struct Curl_multi* multi); bool Curl_pipeline_wanted(const struct Curl_multi* multi, int bits); void Curl_multi_handlePipeBreak(struct SessionHandle *data); /* Internal version of curl_multi_init() accepts size parameters for the Loading