-
-
Notifications
You must be signed in to change notification settings - Fork 7k
Description
I have setup libcurl to enable HTTP2, and am configuring multi to enable pipelining and multiplexing as follows:-
curl_multi_setopt(_curlMultiHandle, CURLMOPT_PIPELINING, CURLPIPE_HTTP1 | CURLPIPE_MULTIPLEX);
On each request I am requesting HTTP2 as follows:-
curl_easy_setopt(_curlHandle, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_2_0);
When I run this in my app which is using a mixture of HTTP/1.1 and HTTP/2 endpoints, I see POST requests failing on calls to HTTP/1.1 endpoints. I've dug into the code and found that it seems that IsPipeliningPossible is ignoring the request method if the request asked for HTTP/2 upgrading and multiplexing is enabled. IsPipeliningPossible only checks the HTTP version that was asked for in the request, not the version that was negotiated in the connection when testing for multiplex support, so it seems that pipelining is wrongly being enabled for requests that do not have GET or HEAD methods on HTTP/1.1 channels.
I have fixed this locally by applying the following change:-
`
@@ -2902,7 +2902,8 @@ static bool IsPipeliningPossible(const struct Curl_easy *handle,
return TRUE;
if(Curl_pipeline_wanted(handle->multi, CURLPIPE_MULTIPLEX) &&
-
(handle->set.httpversion >= CURL_HTTP_VERSION_2))
-
(handle->set.httpversion >= CURL_HTTP_VERSION_2) && -
}
(conn->httpversion == 20)) /* allows HTTP/2 */ return TRUE;
`
but I've found other bug reports (#584) that suggest that this caused regressions elsewhere (https://curl.haxx.se/mail/lib-2016-01/0031.html) so am not sure how to proceed.
Thanks!