mirror of
https://github.com/warmcat/libwebsockets.git
synced 2025-03-30 00:00:16 +01:00
client: connect: prefer default vh if none given
Giving NULL vh for the client connection is basically "don't care".... prefer the "default" vh in that case
This commit is contained in:
parent
6cdaf85b89
commit
d447f8f1db
1 changed files with 12 additions and 8 deletions
|
@ -169,14 +169,18 @@ lws_client_connect_via_info(const struct lws_client_connect_info *i)
|
||||||
if (lws_tls_jit_trust_vhost_bind(i->context, i->address, &vh))
|
if (lws_tls_jit_trust_vhost_bind(i->context, i->address, &vh))
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
vh = i->context->vhost_list;
|
vh = lws_get_vhost_by_name(i->context, "default");
|
||||||
|
if (!vh) {
|
||||||
|
|
||||||
if (!vh) { /* coverity */
|
vh = i->context->vhost_list;
|
||||||
lwsl_cx_err(i->context, "no vhost");
|
|
||||||
goto bail;
|
if (!vh) { /* coverity */
|
||||||
|
lwsl_cx_err(i->context, "no vhost");
|
||||||
|
goto bail;
|
||||||
|
}
|
||||||
|
if (!strcmp(vh->name, "system"))
|
||||||
|
vh = vh->vhost_next;
|
||||||
}
|
}
|
||||||
if (!strcmp(vh->name, "system"))
|
|
||||||
vh = vh->vhost_next;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -399,8 +403,8 @@ lws_client_connect_via_info(const struct lws_client_connect_info *i)
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
__lws_lc_tag(i->context, &i->context->lcg[LWSLCG_WSI_CLIENT], &wsi->lc,
|
__lws_lc_tag(i->context, &i->context->lcg[LWSLCG_WSI_CLIENT], &wsi->lc,
|
||||||
"%s/%s/%s", i->method ? i->method : "WS",
|
"%s/%s/%s/%s", i->method ? i->method : "WS",
|
||||||
wsi->role_ops->name, i->address);
|
wsi->role_ops->name ? wsi->role_ops->name : "novh", vh->name, i->address);
|
||||||
|
|
||||||
lws_metrics_tag_wsi_add(wsi, "vh", wsi->a.vhost->name);
|
lws_metrics_tag_wsi_add(wsi, "vh", wsi->a.vhost->name);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue