You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
CURLPIPE_MULTIPLEX tries pipelining even if "Upgrade: h2c" did not succeed [PATCH] #584
changed the title [-]CURLPIPE_MULTIPLEX tries pipelining even if "Upgrade: h2c" did not succeed[/-][+]CURLPIPE_MULTIPLEX tries pipelining even if "Upgrade: h2c" did not succeed [PATCH][/+]on Dec 30, 2015
The problem was not that it tried to multiplex, the problem is that it enables pipelining - although not asked to. I suggest this patch that seems to do the trick for me:
From 788e6a7018abc17bbfb49dac3a523f0f9f4818a4 Mon Sep 17 00:00:00 2001
From: Daniel Stenberg <daniel@haxx.se>
Date: Sun, 10 Jan 2016 01:00:06 +0100
Subject: [PATCH] ConnectionExists: only do pipelining/multiplexing when asked
When an HTTP/2 upgrade request fails (no protocol switch), it would
previously detect that as still possible to pipeline on (which is
acorrect) and do that when PIPEWAIT was enabled even if pipelining was
not explictily enabled.
It should only pipelined if explicitly asked to.
Closes #584
---
lib/url.c | 21 ++++++++++++++++++---
1 file changed, 18 insertions(+), 3 deletions(-)
diff --git a/lib/url.c b/lib/url.c
index 75a1c44..3c91abb 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -3,11 +3,11 @@
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2016, 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 http://curl.haxx.se/docs/copyright.html.
*
@@ -3151,12 +3151,16 @@ ConnectionExists(struct SessionHandle *data,
size_t max_pipe_len = (bundle->multiuse != BUNDLE_MULTIPLEX)?
max_pipeline_length(data->multi):0;
size_t best_pipe_len = max_pipe_len;
struct curl_llist_element *curr;
- infof(data, "Found bundle for host %s: %p\n",
- needle->host.name, (void *)bundle);
+ infof(data, "Found bundle for host %s: %p [%s]\n",
+ needle->host.name, (void *)bundle,
+ (bundle->multiuse== BUNDLE_PIPELINING?
+ "can pipeline":
+ (bundle->multiuse== BUNDLE_MULTIPLEX?
+ "can multiplex":"serially")));
/* We can't pipe if we don't know anything about the server */
if(canPipeline) {
if(bundle->multiuse <= BUNDLE_UNKNOWN) {
if((bundle->multiuse == BUNDLE_UNKNOWN) && data->set.pipewait) {
@@ -3166,10 +3170,21 @@ ConnectionExists(struct SessionHandle *data,
}
infof(data, "Server doesn't support multi-use (yet)\n");
canPipeline = FALSE;
}
+ if((bundle->multiuse == BUNDLE_PIPELINING) &&
+ !Curl_pipeline_wanted(data->multi, CURLPIPE_HTTP1)) {
+ /* not asked for, switch off */
+ infof(data, "Could pipeline, but not asked to!\n");
+ canPipeline = FALSE;
+ }
+ else if((bundle->multiuse == BUNDLE_MULTIPLEX) &&
+ !Curl_pipeline_wanted(data->multi, CURLPIPE_MULTIPLEX)) {
+ infof(data, "Could multiplex, but not asked to!\n");
+ canPipeline = FALSE;
+ }
}
curr = bundle->conn_list->head;
while(curr) {
bool match = FALSE;
--
2.7.0.rc3
Oh, this one looks much better, although it goes beyond my current understanding of Curl internals.
Will try this patch for my situation in a couple of days.
The problem was not that it tried to multiplex, the problem is that it enables pipelining - although not asked to. I suggest this patch that seems to do the trick for me:
From 788e6a7018abc17bbfb49dac3a523f0f9f4818a4 Mon Sep 17 00:00:00 2001
From: Daniel Stenberg daniel@haxx.se
Date: Sun, 10 Jan 2016 01:00:06 +0100
Subject: [PATCH] ConnectionExists: only do pipelining/multiplexing when asked
When an HTTP/2 upgrade request fails (no protocol switch), it would
previously detect that as still possible to pipeline on (which is
acorrect) and do that when PIPEWAIT was enabled even if pipelining was
not explictily enabled.
Activity
c0ff commentedon Dec 28, 2015
this seems to fix it:
[-]CURLPIPE_MULTIPLEX tries pipelining even if "Upgrade: h2c" did not succeed[/-][+]CURLPIPE_MULTIPLEX tries pipelining even if "Upgrade: h2c" did not succeed [PATCH][/+]bagder commentedon Jan 5, 2016
Thanks!
bagder commentedon Jan 8, 2016
This caused a regression (http://curl.haxx.se/mail/lib-2016-01/0031.html) so re-opened and we need to fix it differently.
bagder commentedon Jan 10, 2016
The problem was not that it tried to multiplex, the problem is that it enables pipelining - although not asked to. I suggest this patch that seems to do the trick for me:
c0ff commentedon Jan 10, 2016
Oh, this one looks much better, although it goes beyond my current understanding of Curl internals.
Will try this patch for my situation in a couple of days.
Regards,
Dmitry.
bagder commentedon Jan 11, 2016
I believe my fix is correct so I just merged that. Feel free to open a new bug or re-open this if you find it inadequate. Thanks!
c0ff commentedon Jan 12, 2016
I confirm, your fix works perfectly.