diff --git a/CMakeLists-implied-options.txt b/CMakeLists-implied-options.txt index 258073e86..94fe59911 100644 --- a/CMakeLists-implied-options.txt +++ b/CMakeLists-implied-options.txt @@ -164,9 +164,7 @@ if(NOT DEFINED CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type") endif() -# microsoft... that's why you can't have nice things - -if (WIN32 OR LWS_PLAT_FREERTOS) +if (LWS_PLAT_FREERTOS) set(LWS_UNIX_SOCK 0) endif() diff --git a/CMakeLists.txt b/CMakeLists.txt index f95243186..814760798 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -85,7 +85,7 @@ option(LWS_WITH_HTTP2 "Compile with server support for HTTP/2" ON) option(LWS_WITH_LWSWS "Libwebsockets Webserver" OFF) option(LWS_WITH_CGI "Include CGI (spawn process with network-connected stdin/out/err) APIs" OFF) option(LWS_IPV6 "Compile with support for ipv6" OFF) -option(LWS_UNIX_SOCK "Compile with support for UNIX domain socket" OFF) +option(LWS_UNIX_SOCK "Compile with support for UNIX domain socket if OS supports it" ON) option(LWS_WITH_PLUGINS "Support plugins for protocols and extensions" OFF) option(LWS_WITH_HTTP_PROXY "Support for active HTTP proxying" OFF) option(LWS_WITH_ZIP_FOPS "Support serving pre-zipped files" OFF) diff --git a/lib/core-net/network.c b/lib/core-net/network.c index 40c5fff24..61518acb0 100644 --- a/lib/core-net/network.c +++ b/lib/core-net/network.c @@ -225,7 +225,7 @@ lws_socket_bind(struct lws_vhost *vhost, lws_sockfd_type sockfd, int port, iface); return LWS_ITOSA_NOT_EXIST; } - n = sizeof(uint16_t) + strlen(iface); + n = (int)(sizeof(uint16_t) + strlen(iface)); strcpy(serv_unix.sun_path, iface); if (serv_unix.sun_path[0] == '@') serv_unix.sun_path[0] = '\0'; @@ -315,7 +315,7 @@ lws_socket_bind(struct lws_vhost *vhost, lws_sockfd_type sockfd, int port, return LWS_ITOSA_NOT_EXIST; } -#if defined(LWS_WITH_UNIX_SOCK) +#if defined(LWS_WITH_UNIX_SOCK) && !defined(WIN32) if (!port && LWS_UNIX_SOCK_ENABLED(vhost)) { uid_t uid = vhost->context->uid; gid_t gid = vhost->context->gid; diff --git a/lib/core/private-lib-core.h b/lib/core/private-lib-core.h index feb54351d..85e4ac39c 100644 --- a/lib/core/private-lib-core.h +++ b/lib/core/private-lib-core.h @@ -706,7 +706,7 @@ lws_plat_init(struct lws_context *context, LWS_EXTERN int lws_plat_drop_app_privileges(struct lws_context *context, int actually_drop); -#if defined(LWS_WITH_UNIX_SOCK) +#if defined(LWS_WITH_UNIX_SOCK) && !defined(WIN32) int lws_plat_user_colon_group_to_ids(const char *u_colon_g, uid_t *puid, gid_t *pgid); #endif diff --git a/lib/plat/windows/private-lib-plat-windows.h b/lib/plat/windows/private-lib-plat-windows.h index 558aedf57..03cffd175 100644 --- a/lib/plat/windows/private-lib-plat-windows.h +++ b/lib/plat/windows/private-lib-plat-windows.h @@ -64,6 +64,10 @@ #include #include +#if defined(LWS_WITH_UNIX_SOCK) +#include +#endif + #if !defined(LWS_HAVE_ATOLL) #if defined(LWS_HAVE__ATOI64) #define atoll _atoi64 diff --git a/lib/roles/http/client/client-handshake.c b/lib/roles/http/client/client-handshake.c index 27408c34b..be5a761c0 100644 --- a/lib/roles/http/client/client-handshake.c +++ b/lib/roles/http/client/client-handshake.c @@ -681,9 +681,9 @@ ads_known: if (wsi->unix_skt) { psa = (const struct sockaddr *)&sau; if (sau.sun_path[0]) - n = sizeof(uint16_t) + strlen(sau.sun_path); + n = (int)(sizeof(uint16_t) + strlen(sau.sun_path)); else - n = sizeof(uint16_t) + strlen(&sau.sun_path[1]) + 1; + n = (int)(sizeof(uint16_t) + strlen(&sau.sun_path[1]) + 1); } else #endif diff --git a/lib/tls/CMakeLists.txt b/lib/tls/CMakeLists.txt index a1a534c2c..310389e8c 100644 --- a/lib/tls/CMakeLists.txt +++ b/lib/tls/CMakeLists.txt @@ -101,11 +101,6 @@ endif() set(LWS_OPENSSL_CLIENT_CERTS ../share CACHE PATH "Server SSL certificate directory") if (WIN32) set(LWS_OPENSSL_CLIENT_CERTS . CACHE PATH "Client SSL certificate directory" PARENT_SCOPE) - - if (LWS_UNIX_SOCK) - set(LWS_UNIX_SOCK OFF PARENT_SCOPE) - message(WARNING "Windows does not support UNIX domain sockets") - endif() else() set(LWS_OPENSSL_CLIENT_CERTS /etc/pki/tls/certs/ CACHE PATH "Client SSL certificate directory") endif()