/third_party/libwebsockets/lib/tls/openssl/ |
D | openssl-server.c | 62 n = wsi->a.vhost->protocols[0].callback(wsi, in OpenSSL_verify_callback() 100 struct lws_vhost *vhost, *vh; in lws_ssl_server_name_cb() local 132 vhost = lws_select_vhost(context, vh->listen_port, servername); in lws_ssl_server_name_cb() 133 if (!vhost) { in lws_ssl_server_name_cb() 142 SSL_set_SSL_CTX(ssl, vhost->tls.ssl_ctx); in lws_ssl_server_name_cb() 153 lws_tls_server_certs_load(struct lws_vhost *vhost, struct lws *wsi, argument 177 int n = (int)lws_tls_generic_cert_checks(vhost, cert, private_key), m; 213 m = SSL_CTX_use_certificate_chain_file(vhost->tls.ssl_ctx, cert); 223 (char *)vhost->context->pt[0].serv_buf); 233 if (SSL_CTX_use_PrivateKey_file(vhost->tls.ssl_ctx, private_key, [all …]
|
D | openssl-ssl.c | 140 lws_ssl_destroy_client_ctx(struct lws_vhost *vhost) in lws_ssl_destroy_client_ctx() argument 142 if (vhost->tls.user_supplied_ssl_ctx || !vhost->tls.ssl_client_ctx) in lws_ssl_destroy_client_ctx() 145 if (vhost->tls.tcr && --vhost->tls.tcr->refcount) in lws_ssl_destroy_client_ctx() 148 SSL_CTX_free(vhost->tls.ssl_client_ctx); in lws_ssl_destroy_client_ctx() 149 vhost->tls.ssl_client_ctx = NULL; in lws_ssl_destroy_client_ctx() 151 vhost->context->tls.count_client_contexts--; in lws_ssl_destroy_client_ctx() 153 if (vhost->tls.tcr) { in lws_ssl_destroy_client_ctx() 154 lws_dll2_remove(&vhost->tls.tcr->cc_list); in lws_ssl_destroy_client_ctx() 155 lws_free(vhost->tls.tcr); in lws_ssl_destroy_client_ctx() 156 vhost->tls.tcr = NULL; in lws_ssl_destroy_client_ctx() [all …]
|
/third_party/libwebsockets/lib/core-net/client/ |
D | client.c | 30 lws_set_proxy(struct lws_vhost *vhost, const char *proxy) in lws_set_proxy() argument 52 vhost->proxy_basic_auth_token, in lws_set_proxy() 53 sizeof vhost->proxy_basic_auth_token) < 0) in lws_set_proxy() 56 lwsl_vhost_info(vhost, " Proxy auth in use"); in lws_set_proxy() 62 vhost->proxy_basic_auth_token[0] = '\0'; in lws_set_proxy() 80 lws_strncpy(vhost->http.http_proxy_address, proxy + brackets, in lws_set_proxy() 81 sizeof(vhost->http.http_proxy_address)); in lws_set_proxy() 83 p = vhost->http.http_proxy_address; in lws_set_proxy() 89 p = strchr(vhost->http.http_proxy_address, ']'); in lws_set_proxy() 91 lwsl_vhost_err(vhost, "malformed proxy '%s'", proxy); in lws_set_proxy() [all …]
|
D | connect2.c | 253 lws_vhost_lock(wsi->a.vhost); 257 &wsi->a.vhost->dll_cli_active_conns_owner); 258 lws_vhost_unlock(wsi->a.vhost); 284 wsi->ipv6 = LWS_IPV6_ENABLED(wsi->a.vhost); 305 if (wsi->a.vhost->http.http_proxy_port) { 306 adsin = wsi->a.vhost->http.http_proxy_address; 307 port = (int)wsi->a.vhost->http.http_proxy_port; 316 } else if (wsi->a.vhost->socks_proxy_port) { 318 adsin = wsi->a.vhost->socks_proxy_address; 319 port = (int)wsi->a.vhost->socks_proxy_port;
|
/third_party/libwebsockets/lib/tls/ |
D | tls-server.c | 44 struct lws_vhost *vhost) in lws_context_init_server_ssl() argument 46 struct lws_context *context = vhost->context; in lws_context_init_server_ssl() 47 lws_fakewsi_def_plwsa(&vhost->context->pt[0]); in lws_context_init_server_ssl() 49 lws_fakewsi_prep_plwsa_ctx(vhost->context); in lws_context_init_server_ssl() 53 vhost->tls.use_ssl = 0; in lws_context_init_server_ssl() 67 vhost->options |= LWS_SERVER_OPTION_CREATE_VHOST_SSL_CTX; in lws_context_init_server_ssl() 71 vhost->tls.use_ssl = lws_check_opt(vhost->options, in lws_context_init_server_ssl() 74 if (vhost->tls.use_ssl && info->ssl_cipher_list) in lws_context_init_server_ssl() 79 vhost->name, vhost->tls.use_ssl ? "" : "non-"); in lws_context_init_server_ssl() 86 plwsa->vhost = vhost; /* not a real bound wsi */ in lws_context_init_server_ssl() [all …]
|
D | tls-client.c | 102 struct lws_vhost *vhost) in lws_context_init_client_ssl() argument 108 lws_fakewsi_def_plwsa(&vhost->context->pt[0]); in lws_context_init_client_ssl() 110 lws_fakewsi_prep_plwsa_ctx(vhost->context); in lws_context_init_client_ssl() 112 if (vhost->options & LWS_SERVER_OPTION_ADOPT_APPLY_LISTEN_ACCEPT_CONFIG) in lws_context_init_client_ssl() 115 if (vhost->tls.ssl_ctx) { in lws_context_init_client_ssl() 138 if (vhost->tls.ssl_client_ctx) in lws_context_init_client_ssl() 144 vhost->tls.ssl_client_ctx = info->provided_client_ssl_ctx; in lws_context_init_client_ssl() 146 vhost->tls.user_supplied_ssl_ctx = 1; in lws_context_init_client_ssl() 152 if (lws_tls_client_create_vhost_context(vhost, info, cipher_list, in lws_context_init_client_ssl() 165 lwsl_info("created client ssl context for %s\n", vhost->name); in lws_context_init_client_ssl() [all …]
|
D | private-network.h | 95 lws_context_init_alpn(struct lws_vhost *vhost); 112 lws_ssl_SSL_CTX_destroy(struct lws_vhost *vhost); 134 lws_tls_server_certs_load(struct lws_vhost *vhost, struct lws *wsi, 139 lws_tls_generic_cert_checks(struct lws_vhost *vhost, const char *cert, 144 struct lws_vhost *vhost); 146 lws_tls_acme_sni_cert_destroy(struct lws_vhost *vhost); 153 lws_ssl_destroy(struct lws_vhost *vhost); 163 struct lws_vhost *vhost, struct lws *wsi); 202 struct lws_vhost *vhost);
|
D | tls.c | 156 lws_context_init_alpn(struct lws_vhost *vhost) in lws_context_init_alpn() argument 160 const char *alpn_comma = vhost->context->tls.alpn_default; in lws_context_init_alpn() 162 if (vhost->tls.alpn) in lws_context_init_alpn() 163 alpn_comma = vhost->tls.alpn; in lws_context_init_alpn() 166 vhost->name, alpn_comma); in lws_context_init_alpn() 168 vhost->tls.alpn_ctx.len = (uint8_t)lws_alpn_comma_to_openssl(alpn_comma, in lws_context_init_alpn() 169 vhost->tls.alpn_ctx.data, in lws_context_init_alpn() 170 sizeof(vhost->tls.alpn_ctx.data) - 1); in lws_context_init_alpn() 172 SSL_CTX_set_alpn_select_cb(vhost->tls.ssl_ctx, alpn_cb, in lws_context_init_alpn() 173 &vhost->tls.alpn_ctx); in lws_context_init_alpn()
|
/third_party/libwebsockets/lib/core-net/ |
D | pollfd.c | 160 if (wsi->a.vhost && in _lws_change_pollfd() 161 wsi->a.vhost->protocols[0].callback(wsi, in _lws_change_pollfd() 204 if (sampled_tid && wsi->a.vhost) { in _lws_change_pollfd() 205 tid = wsi->a.vhost->protocols[0].callback(wsi, in _lws_change_pollfd() 302 assert(wsi->event_pipe || wsi->a.vhost || wsi == pt->context->netlink); in __insert_wsi_socket_into_fds() 304 assert(wsi->event_pipe || wsi->a.vhost); in __insert_wsi_socket_into_fds() 310 if (wsi->a.vhost && in __insert_wsi_socket_into_fds() 311 wsi->a.vhost->protocols[0].callback(wsi, LWS_CALLBACK_LOCK_POLL, in __insert_wsi_socket_into_fds() 332 if (wsi->a.vhost && in __insert_wsi_socket_into_fds() 333 wsi->a.vhost->protocols[0].callback(wsi, LWS_CALLBACK_ADD_POLL_FD, in __insert_wsi_socket_into_fds() [all …]
|
D | socks5-client.c | 30 lws_set_socks(struct lws_vhost *vhost, const char *socks) in lws_set_socks() argument 39 vhost->socks_user[0] = '\0'; in lws_set_socks() 40 vhost->socks_password[0] = '\0'; in lws_set_socks() 46 lwsl_vhost_err(vhost, "auth too long"); in lws_set_socks() 54 lwsl_vhost_err(vhost, "user too long"); in lws_set_socks() 59 lwsl_vhost_err(vhost, "pw too long"); in lws_set_socks() 63 lws_strncpy(vhost->socks_user, socks, in lws_set_socks() 65 lws_strncpy(vhost->socks_password, p_colon + 1, in lws_set_socks() 69 lwsl_vhost_info(vhost, " Socks auth, user: %s, password: %s", in lws_set_socks() 70 vhost->socks_user, in lws_set_socks() [all …]
|
D | adopt.c | 48 lws_create_new_server_wsi(struct lws_vhost *vhost, int fixed_tsi, const char *desc) in lws_create_new_server_wsi() argument 54 n = lws_get_idlest_tsi(vhost->context); in lws_create_new_server_wsi() 57 lwsl_vhost_err(vhost, "no space for new conn"); in lws_create_new_server_wsi() 61 lws_context_lock(vhost->context, __func__); in lws_create_new_server_wsi() 62 new_wsi = __lws_wsi_create_with_role(vhost->context, n, NULL, in lws_create_new_server_wsi() 63 vhost->lc.log_cx); in lws_create_new_server_wsi() 64 lws_context_unlock(vhost->context); in lws_create_new_server_wsi() 66 lwsl_vhost_err(vhost, "OOM"); in lws_create_new_server_wsi() 72 __lws_lc_tag(vhost->context, &vhost->context->lcg[ in lws_create_new_server_wsi() 81 vhost->name, new_wsi->tsi); in lws_create_new_server_wsi() [all …]
|
D | vhost.c | 146 if (lws_check_opt(wsi->a.vhost->options, in lws_role_call_adoption_bind() 148 wsi->a.vhost->listen_accept_role) { in lws_role_call_adoption_bind() 150 lws_role_by_name(wsi->a.vhost->listen_accept_role); in lws_role_call_adoption_bind() 153 prot = wsi->a.vhost->listen_accept_protocol; in lws_role_call_adoption_bind() 157 wsi->a.vhost->listen_accept_role); in lws_role_call_adoption_bind() 159 if (!strcmp(wsi->a.vhost->listen_accept_role, "raw-proxy")) in lws_role_call_adoption_bind() 179 wsi->a.vhost->listen_accept_role, prot, type); in lws_role_call_adoption_bind() 245 lws_protocol_vh_priv_zalloc(struct lws_vhost *vhost, in lws_protocol_vh_priv_zalloc() argument 250 if (!vhost || !prot || !vhost->protocols || !prot->name) in lws_protocol_vh_priv_zalloc() 254 if (!vhost->protocol_vh_privs) { in lws_protocol_vh_priv_zalloc() [all …]
|
D | wsi.c | 67 if (wsi->a.vhost == vh) in lws_vhost_bind_wsi() 71 wsi->a.vhost = vh; in lws_vhost_bind_wsi() 87 assert(wsi->a.vhost->count_bound_wsi > 0); in lws_vhost_bind_wsi() 95 struct lws_vhost *vh = wsi->a.vhost; in __lws_vhost_unbind_wsi() 127 wsi->a.vhost = NULL; in __lws_vhost_unbind_wsi() 219 if (wsi->a.vhost == vh && (wsi->a.protocol == protocol || in lws_callback_all_protocol_vhost_args() 242 for (n = 0; n < wsi->a.vhost->count_protocols; n++) in lws_callback_vhost_protocols() 243 if (wsi->a.vhost->protocols[n].callback(wsi, (enum lws_callback_reasons)reason, NULL, in, len)) in lws_callback_vhost_protocols() 324 wsi->a.vhost = NULL; in __lws_wsi_create_with_role() 401 for (n = 0; n < wsi->a.vhost->count_protocols; n++) { in lws_callback_vhost_protocols_vhost() [all …]
|
/third_party/libwebsockets/lib/tls/mbedtls/ |
D | mbedtls-ssl.c | 29 lws_ssl_destroy(struct lws_vhost *vhost) in lws_ssl_destroy() argument 31 if (!lws_check_opt(vhost->context->options, in lws_ssl_destroy() 35 if (vhost->tls.ssl_ctx) in lws_ssl_destroy() 36 SSL_CTX_free(vhost->tls.ssl_ctx); in lws_ssl_destroy() 37 if (!vhost->tls.user_supplied_ssl_ctx && vhost->tls.ssl_client_ctx) in lws_ssl_destroy() 38 SSL_CTX_free(vhost->tls.ssl_client_ctx); in lws_ssl_destroy() 40 if (vhost->tls.x509_client_CA) in lws_ssl_destroy() 41 X509_free(vhost->tls.x509_client_CA); in lws_ssl_destroy() 105 if (wsi->a.vhost) in lws_ssl_capable_read() 106 lws_metric_event(wsi->a.vhost->mt_traffic_rx, METRES_NOGO, 0); in lws_ssl_capable_read() [all …]
|
D | mbedtls-server.c | 58 struct lws_vhost *vhost, *vh; in lws_mbedtls_sni_cb() local 80 vhost = lws_select_vhost(context, vh->listen_port, in lws_mbedtls_sni_cb() 82 if (!vhost) { in lws_mbedtls_sni_cb() 89 vh->listen_port, vhost->name); in lws_mbedtls_sni_cb() 91 if (!vhost->tls.ssl_ctx) { in lws_mbedtls_sni_cb() 99 SSL_set_SSL_CTX(ssl, vhost->tls.ssl_ctx); in lws_mbedtls_sni_cb() 105 lws_tls_server_certs_load(struct lws_vhost *vhost, struct lws *wsi, in lws_tls_server_certs_load() argument 120 n = (int)lws_tls_generic_cert_checks(vhost, cert, private_key); in lws_tls_server_certs_load() 149 if (lws_tls_alloc_pem_to_der_file(vhost->context, cert, mem_cert, in lws_tls_server_certs_load() 156 err = SSL_CTX_use_certificate_ASN1(vhost->tls.ssl_ctx, (int)flen, p); in lws_tls_server_certs_load() [all …]
|
/third_party/libwebsockets/lib/roles/http/server/ |
D | server.c | 58 struct lws_vhost *vhost; member 69 if (!lws_vhost_compare_listen(wsi->a.vhost, a->vhost)) in check_extant() 75 lwsl_notice(" using listen skt from vhost %s\n", wsi->a.vhost->name); in check_extant() 87 struct lws_context *cx = a->vhost->context; in _lws_vhost_init_server_af() 102 if (lws_vhost_foreach_listen_wsi(a->vhost->context, a, check_extant)) in _lws_vhost_init_server_af() 107 if (a->vhost->iface) { in _lws_vhost_init_server_af() 113 is = lws_socket_bind(a->vhost, NULL, LWS_SOCK_INVALID, in _lws_vhost_init_server_af() 114 a->vhost->listen_port, a->vhost->iface, in _lws_vhost_init_server_af() 124 if (is >= LWS_ITOSA_USABLE && *pv == a->vhost) { in _lws_vhost_init_server_af() 128 *pv = a->vhost->no_listener_vhost_list; in _lws_vhost_init_server_af() [all …]
|
/third_party/libwebsockets/lib/roles/listen/ |
D | ops-listen.c | 39 if (wsi->a.vhost->being_destroyed) in rops_handle_POLLIN_listen() 62 if (wsi->a.vhost->tls.use_ssl && in rops_handle_POLLIN_listen() 103 lws_plat_set_socket_options(wsi->a.vhost, filt.accept_fd, 0); in rops_handle_POLLIN_listen() 128 if ((wsi->a.vhost->protocols[0].callback)(wsi, in rops_handle_POLLIN_listen() 137 if (!(wsi->a.vhost->options & in rops_handle_POLLIN_listen() 142 if (!wsi->a.vhost->tls.use_ssl) in rops_handle_POLLIN_listen() 147 cwsi = lws_adopt_descriptor_vhost(wsi->a.vhost, (lws_adoption_type)opts, fd, in rops_handle_POLLIN_listen() 148 wsi->a.vhost->listen_accept_protocol, NULL); in rops_handle_POLLIN_listen() 151 wsi->a.vhost->name); in rops_handle_POLLIN_listen()
|
/third_party/libwebsockets/plugins/acme-client/ |
D | protocol_lws_acme_client.c | 88 struct lws_vhost *vhost; member 115 struct lws_vhost *vhost; member 143 struct lws_vhost *vhost = lws_get_vhost(wsi); in callback_chall_http01() local 144 struct acme_connection *ac = lws_vhost_user(vhost); in callback_chall_http01() 611 i->vhost = vh; in lws_acme_client_connect() 636 if (vhd->ac->vhost) in lws_acme_finished() 637 lws_vhost_destroy(vhd->ac->vhost); in lws_acme_finished() 713 "vhost %s\n", __func__, lws_get_vhost_name(vhd->vhost)); in lws_acme_start_acquisition() 744 vhd->ac->real_vh_port = lws_get_vhost_port(vhd->vhost); in lws_acme_start_acquisition() 745 vhd->ac->real_vh_name = lws_get_vhost_name(vhd->vhost); in lws_acme_start_acquisition() [all …]
|
/third_party/libwebsockets/READMEs/ |
D | README.http-fallback.md | 6 ## Overview of normal vhost selection 11 For unencrypted http, the Host: header is used to select which vhost the 14 selects the first configured vhost. 18 That allows lws to select the vhost early, and use vhost-specific TLS certs 20 using the first configured vhost and its certs. 29 However if the first configured vhost for the port was created with the 30 vhost creation info struct `.options` flag `LWS_SERVER_OPTION_FALLBACK_TO_APPLY_LISTEN_ACCEPT_CONFI… 32 given in the vhost creation info struct `.listen_accept_role` and `.listen_accept_protocol`. 34 With lejp-conf / lwsws, the options can be applied to the first vhost using: 46 a valid tls packet if connection to an https vhost, this allows the one listen [all …]
|
D | README.lwsws.md | 40 # file per vhost in ../conf.d/ 53 and a config directory intended to take one file per vhost 86 See ./READMEs/README.plugin-acme.md for examples of how to set it up on an lwsws vhost. 105 the connection to a vhost and its vhost-specific SSL keys during SSL 126 # which protocols are enabled for this vhost, and optional 127 # vhost-specific config options for the protocol 164 The vhost name field is used to match on incoming SNI or Host: header, so it 165 must always be the host name used to reach the vhost externally. 171 true vhosts on one listening socket and the active vhost decided at SSL 181 Vhosts can select which plugins they want to offer and give them per-vhost settings using this synt… [all …]
|
/third_party/libwebsockets/lib/plat/unix/ |
D | unix-sockets.c | 102 lws_plat_set_socket_options(struct lws_vhost *vhost, int fd, int unix_skt) in lws_plat_set_socket_options() argument 117 if (!unix_skt && vhost->ka_time) { in lws_plat_set_socket_options() 138 optval = 1000 * (vhost->ka_time + in lws_plat_set_socket_options() 139 (vhost->ka_interval * vhost->ka_probes)); in lws_plat_set_socket_options() 144 optval = vhost->ka_time; in lws_plat_set_socket_options() 149 optval = vhost->ka_interval; in lws_plat_set_socket_options() 154 optval = vhost->ka_probes; in lws_plat_set_socket_options() 162 if (!unix_skt && vhost->bind_iface && vhost->iface) { in lws_plat_set_socket_options() 163 lwsl_info("binding listen skt to %s using SO_BINDTODEVICE\n", vhost->iface); in lws_plat_set_socket_options() 164 if (setsockopt(fd, SOL_SOCKET, SO_BINDTODEVICE, vhost->iface, in lws_plat_set_socket_options() [all …]
|
/third_party/libwebsockets/plugins/raw-proxy/ |
D | README.md | 15 ## Note for vhost selection 19 vhost you associate with this protocol must be alone on its own port. 39 a working example of a vhost that accepts connections and then 45 For a usage where the plugin "owns" the whole vhost, you should enable the 46 plugin protocol on the vhost as usual, and specify the "onward" pvo with: 57 and then define the vhost with: 66 accepted on the vhost.
|
/third_party/libwebsockets/minimal-examples/raw/minimal-raw-vhost/ |
D | README.md | 1 # lws minimal ws server raw vhost 3 This demonstrates setting up a vhost to listen and accept raw sockets. 9 freely combine a raw socket vhost with other lws server 27 $ ./lws-minimal-raw-vhost 28 [2018/03/22 14:49:47:9516] USER: LWS minimal raw vhost
|
/third_party/libwebsockets/lib/roles/ws/ |
D | client-ws.c | 181 ext = wsi->a.vhost->ws.extensions; in lws_generate_client_ws_handshake() 184 n = wsi->a.vhost->protocols[0].callback(wsi, in lws_generate_client_ws_handshake() 349 wsi->a.protocol = &wsi->a.vhost->protocols[0]; in lws_client_ws_upgrade() 389 while (n < wsi->a.vhost->count_protocols) { in lws_client_ws_upgrade() 391 strcmp(p, wsi->a.vhost->protocols[n].name) == 0) { in lws_client_ws_upgrade() 392 wsi->a.protocol = &wsi->a.vhost->protocols[n]; in lws_client_ws_upgrade() 398 if (n == wsi->a.vhost->count_protocols) { /* no match */ in lws_client_ws_upgrade() 409 while (wsi->a.vhost->protocols[n].callback) { in lws_client_ws_upgrade() 411 wsi->a.vhost->protocols[n].name) == 0) { in lws_client_ws_upgrade() 412 wsi->a.protocol = &wsi->a.vhost->protocols[n]; in lws_client_ws_upgrade() [all …]
|
/third_party/libwebsockets/lib/roles/raw-file/ |
D | ops-raw-file.c | 70 if (wsi->a.vhost->default_protocol_index >= in rops_adoption_bind_raw_file() 71 wsi->a.vhost->count_protocols) in rops_adoption_bind_raw_file() 74 wsi->a.protocol = &wsi->a.vhost->protocols[ in rops_adoption_bind_raw_file() 75 wsi->a.vhost->default_protocol_index]; in rops_adoption_bind_raw_file()
|