From fca2dcfd867f1a7ba859e3a9acb4fe244a68054c Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Tue, 21 Feb 2017 16:21:23 -0500 Subject: [PATCH] LP#1666706: add --with-websockets-port configure option This patch adds the ability to specify the WebSockets port as a configure option, avoiding the need to manually edit a couple JavaScript files if one chooses to proxy WS traffic. This patch also cleans up the set of JavaScript files that are installed so that some test case files are not installed by default. Signed-off-by: Galen Charlton --- .gitignore | 2 ++ README | 8 +++++++- configure.ac | 8 ++++++++ src/Makefile.am | 3 +-- src/javascript/{opensrf_ws.js => opensrf_ws.js.in} | 2 +- src/javascript/{opensrf_ws_shared.js => opensrf_ws_shared.js.in} | 2 +- 6 files changed, 20 insertions(+), 5 deletions(-) rename src/javascript/{opensrf_ws.js => opensrf_ws.js.in} (98%) rename src/javascript/{opensrf_ws_shared.js => opensrf_ws_shared.js.in} (99%) diff --git a/.gitignore b/.gitignore index d614afe..0170ebe 100644 --- a/.gitignore +++ b/.gitignore @@ -42,6 +42,8 @@ src/java/.lib/ src/java/Makefile src/java/Makefile.in src/java/opensrf.jar +src/javascript/opensrf_ws.js +src/javascript/opensrf_ws_shared.js src/jserver/.deps/ src/jserver/Makefile src/jserver/Makefile.in diff --git a/README b/README index 995ad48..3abac84 100644 --- a/README +++ b/README @@ -123,6 +123,11 @@ By default, OpenSRF includes C, Perl, and JavaScript support. You can add the `--enable-python` option to the configure command to build Python support and `--enable-java` for Java support. +If you are planning on proxying WebSockets traffic (see below), you +can add `--with-websockets-port=443` to specify that WebSockets traffic +will be going through port 443. Without that option, the default port +is 7682. + Installation instructions ------------------------- @@ -557,7 +562,8 @@ ln -s /etc/nginx/sites-available/osrf-ws-http-proxy /etc/nginx/sites-enabled/osr /etc/init.d/nginx start --------------------------------------------------------------------------- + -6. Edit `/javascript/opensrf_ws.js` and `/javascript/opensrf_ws_shared.js` +6. If you didn't run `configure` with the `--with-websockets-port=443` option, +edit `/javascript/opensrf_ws.js` and `/javascript/opensrf_ws_shared.js` and change + [source, javascript] diff --git a/configure.ac b/configure.ac index 76bc293..073d6f8 100644 --- a/configure.ac +++ b/configure.ac @@ -208,6 +208,12 @@ AC_ARG_WITH([perlbase], [PERL_BASE=x]) AC_SUBST([PERL_BASE]) +AC_ARG_WITH([websockets-port], +[ --with-websockets-port=path WebSockets port to use (default is 7682)], +[WS_PORT=${withval}], +[WS_PORT=7682]) +AC_SUBST([WS_PORT]) + # The following Apache version detection code is adapted from # http://www.gnu.org/software/autoconf-archive/ax_prog_apache.html # licensed under version 2 of the GNU General Public License, or @@ -373,6 +379,8 @@ if test "x$OSRF_INSTALL_CORE" = "xtrue"; then examples/multisession-test.pl src/c-apps/Makefile src/gateway/Makefile + src/javascript/opensrf_ws.js + src/javascript/opensrf_ws_shared.js src/libopensrf/Makefile src/perl/Makefile src/ports/strn_compat/Makefile diff --git a/src/Makefile.am b/src/Makefile.am index 7def8b1..9f75238 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -36,7 +36,7 @@ endif if INSTALLJAVASCRIPT MAYBE_JAVASCRIPT = javascript jsdir = $(prefix)/lib/javascript -js_SCRIPTS = javascript/DojoSRF.js javascript/JSON_v1.js javascript/md5.js javascript/opensrf.js javascript/opensrf_xhr.js javascript/opensrf_xmpp.js javascript/opensrf_ws_shared.js +js_SCRIPTS = javascript/DojoSRF.js javascript/JSON_v1.js javascript/md5.js javascript/opensrf.js javascript/opensrf_xhr.js javascript/opensrf_xmpp.js javascript/opensrf_ws.js javascript/opensrf_ws_shared.js endif if BUILDCORE @@ -68,7 +68,6 @@ install-exec-hook: rm "$(DESTDIR)@sysconfdir@/$${f}.bak" ; \ done; \ fi - cp -r @srcdir@/javascript/* $(DESTDIR)$(jsdir)/ if [ ! -e @bindir@/osrf_control ]; then \ ln -s @bindir@/opensrf-perl.pl @bindir@/osrf_control; \ fi diff --git a/src/javascript/opensrf_ws.js b/src/javascript/opensrf_ws.js.in similarity index 98% rename from src/javascript/opensrf_ws.js rename to src/javascript/opensrf_ws.js.in index 74fc40e..dca3cd3 100644 --- a/src/javascript/opensrf_ws.js +++ b/src/javascript/opensrf_ws.js.in @@ -15,7 +15,7 @@ var WEBSOCKET_URL_PATH = '/osrf-websocket-translator'; -var WEBSOCKET_PORT_SSL = 7682; +var WEBSOCKET_PORT_SSL = @WS_PORT@; OpenSRF.WebSocket = function() { this.pending_messages = []; diff --git a/src/javascript/opensrf_ws_shared.js b/src/javascript/opensrf_ws_shared.js.in similarity index 99% rename from src/javascript/opensrf_ws_shared.js rename to src/javascript/opensrf_ws_shared.js.in index ad30dda..06c8513 100644 --- a/src/javascript/opensrf_ws_shared.js +++ b/src/javascript/opensrf_ws_shared.js.in @@ -25,7 +25,7 @@ */ var WEBSOCKET_URL_PATH = '/osrf-websocket-translator'; -var WEBSOCKET_PORT_SSL = 7682; +var WEBSOCKET_PORT_SSL = @WS_PORT@; var WEBSOCKET_MAX_THREAD_PORT_CACHE_SIZE = 1000; /** -- 2.11.0