[Libwebsockets] multiple clients with http body using http persistent connection (PIPELINE)
akira.pp.dev at gmail.com
Fri Jan 31 23:10:53 CET 2020
Thank you for the quick update!!
I confirmed it works as expected for both GET and POST (8 clients uses 1
As far as my application where I would like to make other methods (like
PUT) also use the same tunnel, I need to add them.
diff --git a/lib/roles/http/client/client-handshake.c
index 08f5c48d..3e763820 100644
@@ -749,7 +749,7 @@ lws_client_connect_2_dnsreq(struct lws *wsi)
/* only pipeline things we associate with being a stream */
if (meth && strcmp(meth, "RAW") && strcmp(meth, "GET") &&
- strcmp(meth, "POST"))
+ strcmp(meth, "POST") && strcmp(meth, "PUT"))
/* consult active connections to find out disposition */
@@ -811,7 +811,7 @@ solo:
if (meth && (!strcmp(meth, "RAW") || !strcmp(meth, "GET") ||
- !strcmp(meth, "POST")) &&
+ !strcmp(meth, "POST") || !strcmp(meth, "PUT")) &&
2020年1月31日(金) 16:45 Andy Green <andy at warmcat.com>:
> On 1/31/20 7:28 AM, dev akira wrote:
> > Hello Andy,
> > Thank you very much for updating sample code of
> > Using the latest code (70794eaf: minimal-http-client-multi: add POST), I
> > executed "./minimal-http-client-multi -l -p --h1 --post" and confirmed
> > the multiple clients connected to the server with a single tls tunnel.
> > On the other hand, when I executed "./minimal-http-client-multi -l -p -s
> > --h1 --post" (with staggered option), multiple clients use their own tls
> > tunnels.
> > Is there any way to share a single tls tunnel even for the above
> > I also confirmed the behavior of minimal-http-client-multi with staggerd
> > option using the latest code and the previous one.
> Thanks for the testing.
> > I executed "./minimal-http-client-multi -l -p -s --h1" using each code
> > and found below:
> > The latest code: 8 clients uses 8 tls tunnels.
> > The previous code: 8 clients uses 1 tls tunnel.
> > Is this behavior designed?
> No, I forgot to transfer an asset from the "active connection leader"...
> the "leader" the other guys can queue on keeps a copy of his original
> endpoint so it can be compared with what any new guys want... now the
> leader changes that's also part of what the new leader has to inherit so
> the new leader can be understood as viable.
> This should fix it:
> diff --git a/lib/core-net/wsi.c b/lib/core-net/wsi.c
> index 8535713df..ddf389609 100644
> --- a/lib/core-net/wsi.c
> +++ b/lib/core-net/wsi.c
> @@ -844,6 +844,12 @@
> _lws_generic_transaction_completed_active_conn(struct lws **_wsi)
> wsi->tls.use_ssl = 0;
> + /* take over his copy of his endpoint as an active connection */
> + wnew->cli_hostname_copy = wsi->cli_hostname_copy;
> + wsi->cli_hostname_copy = NULL;
> * selected queued guy now replaces the original leader on the
> * active client conn list
> I updated yesterday's patch in place on master as well.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Libwebsockets