LP#1666706: add --with-websockets-port configure option
authorGalen Charlton <gmc@equinoxinitiative.org>
Tue, 21 Feb 2017 21:21:23 +0000 (16:21 -0500)
committerGalen Charlton <gmc@equinoxinitiative.org>
Tue, 21 Feb 2017 22:19:32 +0000 (17:19 -0500)
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 <gmc@equinoxinitiative.org>

.gitignore
README
configure.ac
src/Makefile.am
src/javascript/opensrf_ws.js.in [moved from src/javascript/opensrf_ws.js with 98% similarity]
src/javascript/opensrf_ws_shared.js.in [moved from src/javascript/opensrf_ws_shared.js with 99% similarity]

index d614afe..0170ebe 100644 (file)
@@ -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 (file)
--- 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 `<PREFIX>/javascript/opensrf_ws.js` and `<PREFIX>/javascript/opensrf_ws_shared.js`
+6. If you didn't run `configure` with the `--with-websockets-port=443` option,
+edit `<PREFIX>/javascript/opensrf_ws.js` and `<PREFIX>/javascript/opensrf_ws_shared.js`
    and change
 +
 [source, javascript]
index 76bc293..073d6f8 100644 (file)
@@ -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
index 7def8b1..9f75238 100644 (file)
@@ -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
similarity index 98%
rename from src/javascript/opensrf_ws.js
rename to src/javascript/opensrf_ws.js.in
index 74fc40e..dca3cd3 100644 (file)
@@ -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 = [];
similarity index 99%
rename from src/javascript/opensrf_ws_shared.js
rename to src/javascript/opensrf_ws_shared.js.in
index ad30dda..06c8513 100644 (file)
@@ -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;
 
 /**