From 63bb37276e028ab1b1c156c9e7907bf22b6d5952 Mon Sep 17 00:00:00 2001 From: Alon Levy Date: Fri, 19 Oct 2012 11:27:57 +0200 Subject: server: add websockets support via libwebsockets New API: spice_server_set_ws_ports This adds an optional dependency on libwebsockets. You need to get my patched 0.0.3 version here: git://people.freedesktop.org/~alon/libwebsockets There is no qemu patches yet, to test change in reds.c the default value of spice_ws_port to 5959 (for the default of spice-html5). For testing there is an online client at http://spice-space.org/spice-html5/spice.html Known issues: 1. The tester (server/tests/test_display_no_ssl) gets into dropping all data after a few seconds, I think it's an issue with the implemented watches, but haven't figured it out. 2. libwebsocket's read interface is inverted to what our code expects, i.e. there is no libwebsocket_read, so there is an additional copy involved (see RedsWebSocket). This can be fixed. 3. Listening on a separate port. Since the headers are different, we could listen on the same port (first three bytes RED/GET). I don't know if we want to? Todos: 1. SSL not implemented yet. Needs some thought as to how. 2. Serve spice-html5 when accessed as a http server. Nice to have. --- configure.ac | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index 83d4c959..06c86781 100644 --- a/configure.ac +++ b/configure.ac @@ -160,6 +160,14 @@ AC_ARG_ENABLE(automated_tests, AS_IF([test x"$enable_automated_tests" != "xno"], [enable_automated_tests="yes"]) AM_CONDITIONAL(SUPPORT_AUTOMATED_TESTS, test "x$enable_automated_tests" != "xno") +AC_ARG_ENABLE(libwebsockets, +[ --enable-libwebsockets Enable websockets server support (no need for proxy)],, +[enable_libwebsockets="no"]) +AS_IF([test x"enable_libwebsockets" != "xyes"], [enable_websockets="no"]) +AM_CONDITIONAL(SUPPORT_LIBWEBSOCKETS, test "x$enable_websockets" = "xyes") +if test "x$enable_libwebsockets" = "xyes"; then + AC_DEFINE([USE_LIBWEBSOCKETS], [1], [Define if supporting websocket connections]) +fi dnl ========================================================================= dnl Check deps @@ -237,6 +245,12 @@ if test "x$enable_smartcard" = "xyes"; then SPICE_REQUIRES+=" libcacard >= 0.1.2" fi +if test "x$enable_libwebsockets" = "xyes"; then + PKG_CHECK_MODULES(LIBWEBSOCKETS, libwebsockets >= 0.0.3) + AC_SUBST(LIBWEBSOCKETS_LIBS) + AC_SUBST(LIBWEBSOCKETS_CFLAGS) + SPICE_REQUIRES+=" libwebsockets >= 0.0.3" +fi PKG_CHECK_MODULES(PIXMAN, pixman-1 >= 0.17.7) AC_SUBST(PIXMAN_CFLAGS) @@ -536,6 +550,8 @@ echo " SASL support: ${enable_sasl} Automated tests: ${enable_automated_tests} + + libwebsockets: ${enable_libwebsockets} " if test $os_win32 == "yes" ; then -- cgit