OpenSRF.git
4 years agoLP#1436047: make srfsh --safe act as if "! command" doesn't exist
Galen Charlton [Tue, 24 Mar 2015 21:00:57 +0000 (21:00 +0000)]
LP#1436047: make srfsh --safe act as if "! command" doesn't exist

This patch make srfsh treat attempting to run an external
command via "! command" as a parsing error if --safe is
supplied.  It also suppress mention of "! commands" from
the internal help.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Mike Rylander <mrylander@gmail.com>
4 years agoLP#1436047: Allow disabling of "bang commands" in srfsh
Mike Rylander [Tue, 24 Mar 2015 20:22:16 +0000 (16:22 -0400)]
LP#1436047: Allow disabling of "bang commands" in srfsh

srfsh has the ability to execute commands via system() calls using
the common "!command" syntax.  This is very useful, but it would
be nice to be able to turn that functionality off in some cases.

This branch adds argument parsing to detect a new '--safe' command
line parameter, which disables the "!command" syntax.

Signed-off-by: Mike Rylander <mrylander@gmail.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
4 years agoDocs: Fix mailing list link for help in README
Ben Shum [Mon, 4 May 2015 21:16:29 +0000 (17:16 -0400)]
Docs: Fix mailing list link for help in README

Signed-off-by: Ben Shum <bshum@biblio.org>
4 years agoLP#1445503 - Updated Ejabberd setup steps for Ejabberd 14.x for Debian Jessie
Josh Stompro [Tue, 21 Apr 2015 14:50:49 +0000 (09:50 -0500)]
LP#1445503 - Updated Ejabberd setup steps for Ejabberd 14.x for Debian Jessie

Signed-off-by: Josh Stompro <github@stompro.org>
Signed-off-by: Ben Shum <bshum@biblio.org>
4 years agoDocs: Emphasize variables and paths consistently in README
Ben Shum [Mon, 4 May 2015 21:01:23 +0000 (17:01 -0400)]
Docs: Emphasize variables and paths consistently in README

Some variables and paths were not emphasized when the instructions for
websockets was added. Maintain consistency in the document and emphasize
them.

Signed-off-by: Ben Shum <bshum@biblio.org>
4 years agoDocs: Add [source, bash] to code blocks that were not defined in README
Ben Shum [Mon, 4 May 2015 20:57:38 +0000 (16:57 -0400)]
Docs: Add [source, bash] to code blocks that were not defined in README

For consistency, add [source, bash] to all the blocks of code or script
commands in the README

Signed-off-by: Ben Shum <bshum@biblio.org>
4 years agoDocs: Keep all source syntax consistent in README
Ben Shum [Mon, 4 May 2015 20:49:08 +0000 (16:49 -0400)]
Docs: Keep all source syntax consistent in README

Change occurrences of [source,bash] to [source, bash] for consistency
throughout README.

Signed-off-by: Ben Shum <bshum@biblio.org>
4 years agoLP#1418613 per-tab websocket send() JS thinko repair
Bill Erickson [Thu, 5 Feb 2015 15:34:40 +0000 (10:34 -0500)]
LP#1418613 per-tab websocket send() JS thinko repair

Avoid referencing variable defined somewhere outside the send_ws()
function.  Doing so happened to result in re-sending the same message
twice in some cases.

Signed-off-by: Bill Erickson <berickxx@gmail.com>
Signed-off-by: Mike Rylander <mrylander@gmail.com>
4 years agoLP#1383828 Jessie/Trusty installer Apache "mpm" repairs
Bill Erickson [Fri, 17 Oct 2014 21:07:53 +0000 (17:07 -0400)]
LP#1383828 Jessie/Trusty installer Apache "mpm" repairs

Disable the default Apache mpm_event module and enable mpm_prefork for
Debian Jessie and Ubuntu Trusty.

Signed-off-by: Bill Erickson <berickxx@gmail.com>
Signed-off-by: Ben Shum <bshum@biblio.org>
5 years agoLP#1391248: Fix NameVirtualHost warnings in websockets apache2.conf
Ben Shum [Mon, 10 Nov 2014 17:20:31 +0000 (12:20 -0500)]
LP#1391248: Fix NameVirtualHost warnings in websockets apache2.conf

For the websockets configuration, the sample apache2.conf for Apache 2.4 (i.e.
Ubuntu 14.04, etc.) contains NameVirtualHost entries that are no longer
needed.

When starting apache2-websockets, you may see warnings like:

AH00548: NameVirtualHost has no effect and will be removed in the next
release /etc/apache2-websockets/apache2.conf:53

Remove the NameVirtualHost entries and these warnings go away.

Signed-off-by: Ben Shum <bshum@biblio.org>
Signed-off-by: Bill Erickson <berickxx@gmail.com>
5 years agoLP#1369169: Remove hardcoded paths for OpenSRF directory
Ben Shum [Sat, 1 Nov 2014 03:53:58 +0000 (23:53 -0400)]
LP#1369169: Remove hardcoded paths for OpenSRF directory

Signed-off-by: Ben Shum <bshum@biblio.org>
Signed-off-by: Bill Erickson <berickxx@gmail.com>
5 years agoLP#1369169: Mention the requirement for valid SSL certificate
Ben Shum [Sat, 13 Sep 2014 22:23:46 +0000 (18:23 -0400)]
LP#1369169: Mention the requirement for valid SSL certificate

The apache2-websockets instance will not start without a valid SSL certificate
in /etc/apache2/ssl.  Include a mention of this in the README with the extra
stipulation that it is still possible to use a self-signed SSL certificate for
testing purposes, but this is not recommended for live installations.

Signed-off-by: Ben Shum <bshum@biblio.org>
Signed-off-by: Bill Erickson <berickxx@gmail.com>
5 years agoLP#1369169: Add websockets section to the OpenSRF README
Ben Shum [Fri, 12 Sep 2014 21:58:11 +0000 (17:58 -0400)]
LP#1369169: Add websockets section to the OpenSRF README

Remove the separate README.websockets and move the contents into the primary
OpenSRF README document so that all steps are in one place.

Additional edits to the websockets instructions to detail differences made
between Ubuntu 14.04 Trusty and Debian / Ubuntu 12.04 Precise. More edits
may be necessary for Debian Jessie later?

Also, create a separate config file for Apache 2.4 that is copied into place
for Ubuntu Trusty and potentially other systems that will need it.

Signed-off-by: Ben Shum <bshum@biblio.org>
Signed-off-by: Bill Erickson <berickxx@gmail.com>
5 years agoLP#1369169: Add Apache 2.4 specific configuration file for websockets
Ben Shum [Sat, 13 Sep 2014 22:04:54 +0000 (18:04 -0400)]
LP#1369169: Add Apache 2.4 specific configuration file for websockets

For Apache 2.4, there were some necessary modifications for running the
websockets code properly. Similar to how we do things in Evergreen, we
added a new directory for apache_24 which contains the modified apache2.conf
file.

Signed-off-by: Ben Shum <bshum@biblio.org>
Signed-off-by: Bill Erickson <berickxx@gmail.com>
5 years agoLP#1369169: Remove trailing whitespace from apache2.conf
Ben Shum [Sat, 13 Sep 2014 22:07:47 +0000 (18:07 -0400)]
LP#1369169: Remove trailing whitespace from apache2.conf

For some reason, there was a lot of trailing whitespace in this apache2.conf
file for websockets. Removing them.

Signed-off-by: Ben Shum <bshum@biblio.org>
Signed-off-by: Bill Erickson <berickxx@gmail.com>
5 years agoLP#1369169: Standardize styling of root linux account for README
Ben Shum [Sat, 13 Sep 2014 21:03:19 +0000 (17:03 -0400)]
LP#1369169: Standardize styling of root linux account for README

Signed-off-by: Ben Shum <bshum@biblio.org>
Signed-off-by: Bill Erickson <berickxx@gmail.com>
5 years agoLP#1369169: Add generated README.html to the .gitignore file for OpenSRF
Ben Shum [Sat, 13 Sep 2014 21:38:54 +0000 (17:38 -0400)]
LP#1369169: Add generated README.html to the .gitignore file for OpenSRF

Signed-off-by: Ben Shum <bshum@biblio.org>
Signed-off-by: Bill Erickson <berickxx@gmail.com>
5 years agoLP#1002028: set Access-Control-Expose-Headers
Galen Charlton [Thu, 21 Aug 2014 17:02:14 +0000 (10:02 -0700)]
LP#1002028: set Access-Control-Expose-Headers

This allows the OpenSRF JavaScript client library (or
to be precise, one that has been modified to direct
requests at a different domain) to take advantage of CORS
support.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
5 years agoLP#1002028: support CORS for HTTPS
Galen Charlton [Thu, 21 Aug 2014 16:13:23 +0000 (09:13 -0700)]
LP#1002028: support CORS for HTTPS

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
5 years agoLP#1002028: Cross Origin Resource Sharing for OpenSRF
Bennett Goble [Tue, 22 May 2012 15:57:56 +0000 (11:57 -0400)]
LP#1002028: Cross Origin Resource Sharing for OpenSRF

Background
----------
Browsers' same-origin policy currently restricts requests to the current
website's domain to prevent various nefarious scenarios. However,
because APIs and other web resources need to remain open to cross-site
use Cross Origin Resource Sharing (CORS) was created to allow services
to formally authorize cross-origin requests. CORS makes it simple to use
OpenSRF's HTTP translator and gateway APIs on websites using separate
domains.

Example Scenarios
-----------------
1) A library would like an AJAX-driven "quicksearch" box on their main
site, which is hosted on a different domain than their catalog.
2) A developer wants to create new web applications and services that
tie into Evergreen, but does not wish to install EG locally or
configure a proxy.

Implementation
--------------
The function crossOriginHeaders() has been added to apachetools.c.
Incoming requests are checked to see if they have an Origin header. The
value of the Origin header is checked against a whitelist defined in
opensrf_core.xml config (XPath: /config/gateway/cross_origin/origin).
The function returns 1 if CORS headers have been added to the response.

Notes
-----
* The OpenSRF Javascript client library (opensrf.js) defaults to the root
of the current web host "/osrf-http-translator." In addition, synchronous
requests are presumed in some situations: resulting in the oncomplete
method never returning (Blocking requests are not possible with cross-
domain XHR.)
* It is also possible to enable CORS with the Apache "set header"
configuration directive. However, this means that the necessary headers
would be appended to every response.

Links
-----
Specification - http://www.w3.org/TR/cors/
Wikipedia Article - http://en.wikipedia.org/wiki/Cross-origin_resource_sharing

Signed-off-by: Bennett Goble <nivardus@gmail.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
5 years agoRevert "LP#1350457: Pass caller's session to subrequests called via method_lookup"
Galen Charlton [Thu, 21 Aug 2014 15:58:18 +0000 (08:58 -0700)]
Revert "LP#1350457: Pass caller's session to subrequests called via method_lookup"

This reverts commit 96917538c6b6fad688dd40c2a8f0cc9127053b24.

5 years ago(doc) Reorder changes to ejabberd.cfg in install instructions
Josh Stompro [Wed, 21 May 2014 13:26:53 +0000 (08:26 -0500)]
(doc) Reorder changes to ejabberd.cfg in install instructions

I found it annoying that the list of changes to make to ejabberd.cfg
didn't follow the order that the options showed up in the default
Debian ejabberd.cfg.  I reordered them so after you finish changing one
option, you can search forward in the document for the next term.

(From Github pull request #3.)

Signed-off-by: Josh Stompro <Stomproj@larl.org>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
5 years agoLP#1350457: Pass caller's session to subrequests called via method_lookup
Mike Rylander [Wed, 30 Jul 2014 17:29:46 +0000 (13:29 -0400)]
LP#1350457: Pass caller's session to subrequests called via method_lookup

In the process of looking up a method for an internal subrequest, we lose
session info. This is a problem when the subrequest makes a remote request,
because then the subrequest can't look up the proper locale, among other
things. The forthcoming branch passes the caller's session to the subrequest.

Signed-off-by: Mike Rylander <mrylander@gmail.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
5 years agoLP#1341687 listeners log/drop XMPP error msgs
Bill Erickson [Thu, 17 Jul 2014 15:37:53 +0000 (11:37 -0400)]
LP#1341687 listeners log/drop XMPP error msgs

The most common form of XMPP error messages are "bounced" messages, i.e.
those where the recipient is not available.  Instead of passing these
useless and confusing messages down to a drone for processing, log the
error in the listener and drop the message.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
5 years agoLP#1343578: document <logtag> in the example opensrf_core.xml
Galen Charlton [Wed, 20 Aug 2014 21:00:17 +0000 (14:00 -0700)]
LP#1343578: document <logtag> in the example opensrf_core.xml

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
5 years agoLP#1343578: Perl/C syslog "logtag" additions.
Bill Erickson [Thu, 17 Jul 2014 19:10:35 +0000 (15:10 -0400)]
LP#1343578: Perl/C syslog "logtag" additions.

 * Honor logtag value when applying a default appname for Perl and C
 * Extract / apply logtag in the router
 * Minor repair: avoid redundant strdup

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Mike Rylander <mrylander@gmail.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
5 years agoLP#1343578: Add support for log tagging
Mike Rylander [Fri, 20 Jun 2014 19:52:47 +0000 (15:52 -0400)]
LP#1343578: Add support for log tagging

The ability to provide instance-specific log tagging via syslog
would make running multiple instances much easier to manage.  So
this branch does that.

Signed-off-by: Mike Rylander <mrylander@gmail.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
5 years agoLP#1316245: JS now uses browser-native JSON routines
Bill Erickson [Mon, 5 May 2014 17:40:46 +0000 (13:40 -0400)]
LP#1316245: JS now uses browser-native JSON routines

* Replace JSON2jsRaw() with JSON.parse()

* Replace js2JSONRaw() with JSON.stringify()

* Removed unit tests for JSON2jsRaw() and js2JSONRaw()

* Removed jsonPretty() pretty-printing routine.  Use
  JSON.stringify(json, null, <spaces>) instead.

See also:

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Using_native_JSON

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
5 years agoLP#1268619: disable shared workers pending browser issues
Bill Erickson [Mon, 4 Aug 2014 18:26:36 +0000 (14:26 -0400)]
LP#1268619: disable shared workers pending browser issues

There appears to be a bug in Chromium where loading the same page
multiple times (without a refresh or cache clear) causes the
SharedWorker to fail to instantiate on every other page load.
Further research pending.  Disabling SharedWorker's entirely for
now.

Note, to replicate, load a page using shared workers, focus the
browser address bar, hit Enter to load the page again.  The shared
worker will fail to load on every other page load, though it will
appear to the SharedWorker caller (opensrf.js) that the port is open.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
5 years agoLP#1268619: update JS/WS/SSL code comment
Bill Erickson [Wed, 30 Jul 2014 16:05:36 +0000 (12:05 -0400)]
LP#1268619: update JS/WS/SSL code comment

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
5 years agoLP#1268619: JS status codes can come across as numbers; stringify for match
Bill Erickson [Thu, 10 Jul 2014 15:29:49 +0000 (11:29 -0400)]
LP#1268619: JS status codes can come across as numbers; stringify for match

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
5 years agoLP#1268619: JS libs capture all method errors
Bill Erickson [Tue, 8 Jul 2014 13:41:12 +0000 (09:41 -0400)]
LP#1268619: JS libs capture all method errors

Instead of selecting specific errors to report as method errors, report
all API calls which return 400 or 500-series errors as method errors.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
5 years agoLP#1268619: websocket: avoid sharedworker for firefox 29
Bill Erickson [Sun, 4 May 2014 19:58:17 +0000 (15:58 -0400)]
LP#1268619: websocket: avoid sharedworker for firefox 29

https://bugzilla.mozilla.org/show_bug.cgi?id=504553#c73

Avoid using SharedWorkers when useragent match "Firefox".  FF supports
shared workers, but it does not yet support WebSockets within shared
workers.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
5 years agoLP#1268619: websockets: detect connectedness of JS default sockets
Bill Erickson [Thu, 10 Apr 2014 12:50:13 +0000 (08:50 -0400)]
LP#1268619: websockets: detect connectedness of JS default sockets

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
5 years agoLP#1268619: websockets: auto-upgrade to shared workers; SSL-always
Bill Erickson [Mon, 7 Apr 2014 16:04:33 +0000 (12:04 -0400)]
LP#1268619: websockets: auto-upgrade to shared workers; SSL-always

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
5 years agoLP#1268619: websockets: gateway code repairs & confing options
Bill Erickson [Tue, 11 Mar 2014 21:25:19 +0000 (17:25 -0400)]
LP#1268619: websockets: gateway code repairs & confing options

* avoid unneccessary and wrong incantation of apr_thread_exit.  The two
  sub-threads now both live for the duration of the process.
* to be safe, create thread mutex before threads

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
5 years agoLP#1268619: websockets: apply syslog name in gateway
Bill Erickson [Mon, 10 Mar 2014 19:55:24 +0000 (15:55 -0400)]
LP#1268619: websockets: apply syslog name in gateway

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
5 years agoLP#1268619: websockets: README typo repairs
Bill Erickson [Mon, 10 Mar 2014 12:41:45 +0000 (08:41 -0400)]
LP#1268619: websockets: README typo repairs

Patch from Warren Layton to repair path to 'envvars' and clarify some
text.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
5 years agoLP#1268619: websockets : additional apache config docs
Bill Erickson [Thu, 6 Mar 2014 20:47:36 +0000 (15:47 -0500)]
LP#1268619: websockets : additional apache config docs

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
5 years agoLP#1268619: websockets: apache conf -> info logging
Bill Erickson [Thu, 6 Mar 2014 20:05:12 +0000 (15:05 -0500)]
LP#1268619: websockets: apache conf -> info logging

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
5 years agoLP#1268619: websockets: remove single-tab JS WS implementation
Bill Erickson [Wed, 5 Mar 2014 13:40:05 +0000 (08:40 -0500)]
LP#1268619: websockets: remove single-tab JS WS implementation

It was falling behind the shared lib in bug fixes and features.  A
per-tab WS implementation is (maybe) a dangerous thing to have around,
as well, since it encourages /many/ connections.  Can resurrect later if
needed.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
5 years agoLP#1268619: websockets: shared worker path; JS api_level
Bill Erickson [Tue, 4 Mar 2014 19:10:59 +0000 (14:10 -0500)]
LP#1268619: websockets: shared worker path; JS api_level

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
5 years agoLP#1268619: websockets: initial C libs api_level support
Bill Erickson [Mon, 3 Mar 2014 21:23:44 +0000 (16:23 -0500)]
LP#1268619: websockets: initial C libs api_level support

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
5 years agoLP#1268619: websockets : gateway log inbound messages at internal
Bill Erickson [Mon, 3 Mar 2014 21:01:58 +0000 (16:01 -0500)]
LP#1268619: websockets : gateway log inbound messages at internal

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
5 years agoLP#1268619: websocket : add JS lib to makefile
Bill Erickson [Mon, 3 Mar 2014 17:06:12 +0000 (12:06 -0500)]
LP#1268619: websocket : add JS lib to makefile

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
5 years agoLP#1268619: websocket: avoid module auto configuration
Bill Erickson [Mon, 3 Mar 2014 15:29:23 +0000 (10:29 -0500)]
LP#1268619: websocket: avoid module auto configuration

We don't want osrf_websocket_translator to be directly loaded as a
module, since it is not an apache module, but a shared library loaded by
an apache module (mod_websockets).  This is especially true of the default
apache instance.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
5 years agoLP#1268619: websocket : apache gateway minor fixes
Bill Erickson [Mon, 3 Mar 2014 15:05:26 +0000 (10:05 -0500)]
LP#1268619: websocket : apache gateway minor fixes

Replace remaining remote_ip calls with a get_client_ip() function which
operates for apache2 and apache4.

Make log functions for applying a log trace value accept const char*'s

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
5 years agoLP#1268619: websocket : more JS api docs
Bill Erickson [Mon, 3 Mar 2014 14:42:03 +0000 (09:42 -0500)]
LP#1268619: websocket : more JS api docs

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
5 years agoLP#1268619: websockets : added config docs to install readme
Bill Erickson [Thu, 16 Jan 2014 16:41:01 +0000 (11:41 -0500)]
LP#1268619: websockets : added config docs to install readme

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
5 years agoLP#1268619: websocket JS libs: reconnect and auto-connect
Bill Erickson [Tue, 14 Jan 2014 21:25:20 +0000 (16:25 -0500)]
LP#1268619: websocket JS libs: reconnect and auto-connect

JS clients no longer need to explicitly call the shared WS setup
routine.  It happens under the covers now.

JS client detects disconnects and reconnects when the next message send
attempt occurs.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
5 years agoLP#1268619: websocket translator idle timeout / graceful shutdown
Bill Erickson [Tue, 14 Jan 2014 21:22:23 +0000 (16:22 -0500)]
LP#1268619: websocket translator idle timeout / graceful shutdown

Added support for an idle timeout and idle check interval configuration
variables.  These allow each websocket apache process to kick off
clients that have been connected and are idle for too long, thus hogging
a process unnecessarily.

Added a SIGUSR1 signal handler which forces the idle timeout to be very
low and a short re-check period so that the client can be kicked as soon
as there are no open conversations.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
5 years agoLP#1268619: websockets: support WS via shared web workers
Bill Erickson [Fri, 10 Jan 2014 16:57:29 +0000 (11:57 -0500)]
LP#1268619: websockets: support WS via shared web workers

This allows mutiple browser tabs to share the same websocket connection.

TODO: add tab (port) disconnect handler
TODO: more docs / examples

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
5 years agoLP#1268619: websocket: do not disconnect ws() on osrf disconnect message
Bill Erickson [Thu, 9 Jan 2014 20:00:03 +0000 (15:00 -0500)]
LP#1268619: websocket: do not disconnect ws() on osrf disconnect message

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
5 years agoLP#1268619: temporary websocket installer README
Bill Erickson [Tue, 5 Feb 2013 15:22:34 +0000 (10:22 -0500)]
LP#1268619: temporary websocket installer README

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
5 years agoLP#1268619: Sample Websocket translator Apache 2.2 configuration
Bill Erickson [Tue, 5 Feb 2013 14:52:57 +0000 (09:52 -0500)]
LP#1268619: Sample Websocket translator Apache 2.2 configuration

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
5 years agoLP#1268619: websocket gateway: improved memory mgt; logging
Bill Erickson [Fri, 25 Jan 2013 17:38:13 +0000 (12:38 -0500)]
LP#1268619: websocket gateway: improved memory mgt; logging

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
5 years agoLP#1268619: websockets; free temporary osrf msgs; minor comment change
Bill Erickson [Mon, 21 Jan 2013 16:34:57 +0000 (11:34 -0500)]
LP#1268619: websockets; free temporary osrf msgs; minor comment change

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
5 years agoLP#1268619: websocket; docs, more memory mgmt
Bill Erickson [Mon, 10 Dec 2012 19:33:14 +0000 (14:33 -0500)]
LP#1268619: websocket; docs, more memory mgmt

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
5 years agoLP#1268619: websocket translator
Bill Erickson [Mon, 12 Nov 2012 21:46:19 +0000 (16:46 -0500)]
LP#1268619: websocket translator

* starting packet inspection
* activity log; recipient removal
* only cache connected recipients; use request_rec pool for session_pool parent
* wrap all thread work in mutex
* session memory goodness

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
5 years agoLP#1268619: websocket JS additions
Bill Erickson [Thu, 8 Nov 2012 17:36:16 +0000 (12:36 -0500)]
LP#1268619: websocket JS additions

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
5 years agoLP#1268619: track websocket_plugin.h locally until replaced by makefile.install process
Bill Erickson [Tue, 30 Oct 2012 19:51:18 +0000 (15:51 -0400)]
LP#1268619: track websocket_plugin.h locally until replaced by makefile.install process

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
5 years agoLP#1268619: websocket gateway repairs and cleanup
Bill Erickson [Mon, 29 Oct 2012 21:27:44 +0000 (17:27 -0400)]
LP#1268619: websocket gateway repairs and cleanup

* use jsonObjectFree() on jsonObjets, not free();
* removed some debugging logs
* accommodate API changes for Apache 2.4
* safer logging:

  Avoid using ap_log_rerror, in particular referencing server->request
  from the responder thread, since the request_rec will be invalid after
  on_disconnect is called.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
5 years agoLP#1268619: Apache websocket translator module
Bill Erickson [Fri, 26 Oct 2012 19:06:13 +0000 (15:06 -0400)]
LP#1268619: Apache websocket translator module

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
5 years agoLP#1268619: OpenSRF JS websockets plugin
Bill Erickson [Thu, 20 Sep 2012 19:55:04 +0000 (15:55 -0400)]
LP#1268619: OpenSRF JS websockets plugin

Adds an opensrf_ws.js handler.  Requries some small modifications to
opensrf.js.  Load opensrf_ws.js in DojoSRF.

For now, to use, add to script:

OpenSRF.Session.transport = OSRF_TRANSPORT_TYPE_WS;

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
5 years agoLP#1337401: Only care about our own processes
Mike Rylander [Fri, 20 Jun 2014 20:48:51 +0000 (16:48 -0400)]
LP#1337401: Only care about our own processes

OpenSRF can run mutiple times, as different users, on one host.
Right now we look for all service processes, but we should only
look for our own. This patch does that.

Signed-off-by: Mike Rylander <mrylander@gmail.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
5 years agoLP#1315525: Add trusty target and remove lucid from README
Ben Shum [Fri, 18 Apr 2014 20:36:38 +0000 (16:36 -0400)]
LP#1315525: Add trusty target and remove lucid from README

Signed-off-by: Ben Shum <bshum@biblio.org>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
5 years agoLP#1315525: Updating Makefile.install for Ubuntu 14.04. Removing lucid support.
Chris Sharp [Sun, 26 Jan 2014 15:41:31 +0000 (10:41 -0500)]
LP#1315525: Updating Makefile.install for Ubuntu 14.04. Removing lucid support.

Signed-off-by: Chris Sharp <csharp@georgialibraries.org>
Signed-off-by: Ben Shum <bshum@biblio.org>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
5 years agoLP#1286248: remove osrf_ctl.sh
Galen Charlton [Fri, 28 Feb 2014 17:33:19 +0000 (09:33 -0800)]
LP#1286248: remove osrf_ctl.sh

As osrf_ctl.sh was deprecated in favor of osrf_control, this patch
removes the deprecated script entirely.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Bill Erickson <berick@esilibrary.com>
5 years agoLP#1285915: document that perl2JSON doesn't order hash keys
Galen Charlton [Wed, 2 Apr 2014 22:24:06 +0000 (15:24 -0700)]
LP#1285915: document that perl2JSON doesn't order hash keys

This patch documents that JSON strings returned by
OpenSRF::Utils::JSON->perl2JSON() should not be expected to have
hash keys sorted in any particular order.  It also adjusts a
corresponding test case to consistently pass under Perl 5.18, which
introduces hash order randomization.

Forcing JSON output to be in canonical form is another option, and
easily done by JSON::XS, but would add overhead.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Bill Erickson <berick@esilibrary.com>
5 years agoLP#1234816: improve const-correctness of osrfCachePutString and osrfCachePutObject
Galen Charlton [Wed, 2 Apr 2014 23:05:33 +0000 (16:05 -0700)]
LP#1234816: improve const-correctness of osrfCachePutString and osrfCachePutObject

Since the cache key is not modified by osrfCachePutString and
osrfCachePutObject, this patch changes the key parameter of those
two functions from char* to const char*.  It also updates one
caller osrfCachePutObject to not cast away const-ness.

This patch has no functional impact, but enables future callers
of osrfCachePut* to pass constant strings without having to
cast away the const-ness.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Bill Erickson <berick@esilibrary.com>
5 years agoLP#1306044 Removing deprecated jabber register script
Bill Erickson [Thu, 10 Apr 2014 17:27:34 +0000 (13:27 -0400)]
LP#1306044 Removing deprecated jabber register script

This script is no longer user, since ejabberdctrl is used instead.
What's more, this script uses a Perl package (libnet-jabber-perl) which
is no longer available in Debian (Jessie).

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
5 years agoLP#1306044 Debian Jessie Makefile.install target
Bill Erickson [Thu, 10 Apr 2014 16:05:08 +0000 (12:05 -0400)]
LP#1306044 Debian Jessie Makefile.install target

* Removes Perl Net::Jabber as a dependency.  There is no Jessie package
  for this and OpenSRF hasn't used it in a long time.

* Leaving Debian Squeeze in place for now

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
5 years agoLP#1292214: Improve docgen output
Mike Rylander [Thu, 13 Mar 2014 20:55:19 +0000 (16:55 -0400)]
LP#1292214: Improve docgen output

Docgen output would be a bit more useful if it respected the formatting
(such as it is) of the signature content provided by the developer. So,
let's make that happen.

Signed-off-by: Mike Rylander <mrylander@gmail.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
5 years agoLP#1179660: remove OpenSRF.pm AUTOLOAD
Bill Erickson [Mon, 13 May 2013 20:19:51 +0000 (16:19 -0400)]
LP#1179660: remove OpenSRF.pm AUTOLOAD

Instead of simply producing an error message in the OpenSRF logs, calls
to nonexistent subroutines are now fatal errors which will stop code
execution.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
5 years agoLP#1286198: use --ignore-orphans rather than --are-there-no-prisons
Galen Charlton [Fri, 7 Mar 2014 16:22:38 +0000 (08:22 -0800)]
LP#1286198: use --ignore-orphans rather than --are-there-no-prisons

The joke was fine while it lasted, but might be confusing to somebody
who doesn't catch the literary reference.  This patch also fixes
a minor typo.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
5 years agoLP#1286198: Teach osrf_router to (optionally) write its own PID files
Lebbeous Fogle-Weekley [Tue, 4 Feb 2014 22:56:07 +0000 (17:56 -0500)]
LP#1286198: Teach osrf_router to (optionally) write its own PID files

Also, tiny bit of noise squelching on osrf_control/opensrf-perl.pl

Signed-off-by: Lebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Signed-off-by: Mike Rylander <mrylander@gmail.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
5 years agoLP#1286198: Offer ability to ignore what seem like orphan processes when starting...
Lebbeous Fogle-Weekley [Fri, 31 Jan 2014 20:50:01 +0000 (15:50 -0500)]
LP#1286198: Offer ability to ignore what seem like orphan processes when starting things

Signed-off-by: Lebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Signed-off-by: Mike Rylander <mrylander@gmail.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
5 years agoLP#1286198: When doing router-specific things, we don't need as much configuration...
Lebbeous Fogle-Weekley [Thu, 30 Jan 2014 23:32:24 +0000 (18:32 -0500)]
LP#1286198: When doing router-specific things, we don't need as much configuration loaded

Signed-off-by: Lebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Signed-off-by: Mike Rylander <mrylander@gmail.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
5 years agoLP#1284137: Avoid WARN logging on router shutdown
Bill Erickson [Mon, 24 Feb 2014 14:09:46 +0000 (09:09 -0500)]
LP#1284137: Avoid WARN logging on router shutdown

Log received signals as DEBUG (misc signal) or INFO (during shutdown)
in the router, since these are not error conditions, but normal
operations.

A warning may ultimately be logged at a higher level when the signal is
unexpected.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
5 years agoLP#1155446: add Debian/Ubuntu deps required for Python tests to pass
Galen Charlton [Fri, 15 Mar 2013 14:22:17 +0000 (10:22 -0400)]
LP#1155446: add Debian/Ubuntu deps required for Python tests to pass

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Ben Shum <bshum@biblio.org>
5 years agoLP#1066131: srfsh.py should not require opensrf.settings
Bill Erickson [Fri, 12 Oct 2012 20:57:15 +0000 (16:57 -0400)]
LP#1066131: srfsh.py should not require opensrf.settings

Update srfsh.py to connect to the opensrf network without automatically
reading the opensrf.setting server data.  This allows srfsh.py to run a
non-private network.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
5 years agoLP#1170484: log failure to load library for C app as an error
Galen Charlton [Thu, 18 Apr 2013 20:14:00 +0000 (16:14 -0400)]
LP#1170484: log failure to load library for C app as an error

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Ben Shum <bshum@biblio.org>
5 years agoMerge branch 'rel_2_3'
Galen Charlton [Fri, 31 Jan 2014 21:40:58 +0000 (16:40 -0500)]
Merge branch 'rel_2_3'

5 years agofix typo and remove repeated word
Galen Charlton [Fri, 31 Jan 2014 21:20:26 +0000 (16:20 -0500)]
fix typo and remove repeated word

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
5 years agoosrf_control router-de/re-register and reload commands
Bill Erickson [Tue, 7 Jan 2014 19:06:06 +0000 (14:06 -0500)]
osrf_control router-de/re-register and reload commands

Added support for the following new command line options:

--router-de-register
--router-de-register-all
    Sends a SIGUSR1 signal to the selected service(s), which causes each
    service's listener process to send an "unregister" command to all
    registered routers.  The --all variant sends the signal to all
    running listeners.  The non-(--all) variant requires a --service.

--router-re-register
--router-re-register-all
    Sends a SIGUSR2 signal to the selected service(s), which causes each
    service's listener process to send a "register" command to all
    configured routers routers.  The --all variant sends the signal to
    all running listeners.  The non-(--all) variant requires a --service.

--reload
--reload-all
    Sends a SIGHUP signal to the selected service(s).  SIGHUP causes
    each Listener process to reload its opensrf_core.xml config file
    and gracefully re-launch drone processes.  The -all variant sends
    the signal to all services.  The non-(-all) variant requires a
    --service.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
5 years agox
Galen Charlton [Fri, 31 Jan 2014 21:25:16 +0000 (16:25 -0500)]
x

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
5 years agotypo fix
Galen Charlton [Fri, 31 Jan 2014 21:20:26 +0000 (16:20 -0500)]
typo fix

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
5 years agoosrf_control router-de/re-register and reload commands
Bill Erickson [Tue, 7 Jan 2014 19:06:06 +0000 (14:06 -0500)]
osrf_control router-de/re-register and reload commands

Added support for the following new command line options:

--router-de-register
--router-de-register-all
    Sends a SIGUSR1 signal to the selected service(s), which causes each
    service's listener process to send an "unregister" command to all
    registered routers.  The --all variant sends the signal to all
    running listeners.  The non-(--all) variant requires a --service.

--router-re-register
--router-re-register-all
    Sends a SIGUSR2 signal to the selected service(s), which causes each
    service's listener process to send a "register" command to all
    configured routers routers.  The --all variant sends the signal to
    all running listeners.  The non-(--all) variant requires a --service.

--reload
--reload-all
    Sends a SIGHUP signal to the selected service(s).  SIGHUP causes
    each Listener process to reload its opensrf_core.xml config file
    and gracefully re-launch drone processes.  The -all variant sends
    the signal to all services.  The non-(-all) variant requires a
    --service.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
5 years agorecover osrf_control router start
Bill Erickson [Thu, 21 Nov 2013 21:37:38 +0000 (16:37 -0500)]
recover osrf_control router start

With the addition of service verification, which ensures that a service
is meant to run on the requested host, we lost the ability to start the
router by itself, since the router is never explicitly configured to run
anywhere.  This patch assumes the router is always a valid service.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Dan Wells <dbw2@calvin.edu>
5 years agorecover osrf_control router start
Bill Erickson [Thu, 21 Nov 2013 21:37:38 +0000 (16:37 -0500)]
recover osrf_control router start

With the addition of service verification, which ensures that a service
is meant to run on the requested host, we lost the ability to start the
router by itself, since the router is never explicitly configured to run
anywhere.  This patch assumes the router is always a valid service.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Dan Wells <dbw2@calvin.edu>
5 years agoOpenSRF client disconnect robustification (Perl)
Bill Erickson [Thu, 5 Dec 2013 17:27:44 +0000 (12:27 -0500)]
OpenSRF client disconnect robustification (Perl)

* Improve detection of client connection state with jabber server

  Be more aggressive in testing and responding to failed connectivity.
  It can happen in various ways, depending on what's happening to the
  jabber server (death, delay, graceful shutdown).  With these changes
  we attempt to cover all the bases and detect as early as possible that
  a connection has died, specifically when trying to create a new
  connection after one has failed.

* Do a better job of cleaning up dead connections

  Transport::PeerHandle now has a reset() action which disconnects (when
  possible) and clears the global connection reference.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
5 years agoOpenSRF client disconnect robustification (Perl)
Bill Erickson [Thu, 5 Dec 2013 17:27:44 +0000 (12:27 -0500)]
OpenSRF client disconnect robustification (Perl)

* Improve detection of client connection state with jabber server

  Be more aggressive in testing and responding to failed connectivity.
  It can happen in various ways, depending on what's happening to the
  jabber server (death, delay, graceful shutdown).  With these changes
  we attempt to cover all the bases and detect as early as possible that
  a connection has died, specifically when trying to create a new
  connection after one has failed.

* Do a better job of cleaning up dead connections

  Transport::PeerHandle now has a reset() action which disconnects (when
  possible) and clears the global connection reference.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
5 years agoProtect subrequests from post-complete messages
Mike Rylander [Thu, 16 May 2013 14:17:15 +0000 (10:17 -0400)]
Protect subrequests from post-complete messages

Subrequests (AKA method_lookup()-based API calls) sometimes append
final-lvalue responses to the response list even after respond_complete()
has been called from within the implementation method.  This commit
discards all post-respond_complete values, protecting against extra,
spurious values being returned to the ultimate client.

Signed-off-by: Mike Rylander <mrylander@gmail.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
5 years agoLP#1180849: test case - ignoring subrequest responses after respond_complete()
Galen Charlton [Mon, 16 Dec 2013 16:08:51 +0000 (08:08 -0800)]
LP#1180849: test case - ignoring subrequest responses after respond_complete()

This patch adds a regression test for verifying that subrequests
ignore additional responses after respond_complete() is called.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
5 years agoProtect subrequests from post-complete messages
Mike Rylander [Thu, 16 May 2013 14:17:15 +0000 (10:17 -0400)]
Protect subrequests from post-complete messages

Subrequests (AKA method_lookup()-based API calls) sometimes append
final-lvalue responses to the response list even after respond_complete()
has been called from within the implementation method.  This commit
discards all post-respond_complete values, protecting against extra,
spurious values being returned to the ultimate client.

Signed-off-by: Mike Rylander <mrylander@gmail.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
5 years agoLP#1180849: test case - ignoring subrequest responses after respond_complete()
Galen Charlton [Mon, 16 Dec 2013 16:08:51 +0000 (08:08 -0800)]
LP#1180849: test case - ignoring subrequest responses after respond_complete()

This patch adds a regression test for verifying that subrequests
ignore additional responses after respond_complete() is called.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
5 years agoAdd some additional boolean-related JSON tests
Jeff Godin [Tue, 3 Dec 2013 18:52:39 +0000 (13:52 -0500)]
Add some additional boolean-related JSON tests

Add some additional boolean-related JSON tests, enable use strict /
use warnings for JSON tests.

Signed-off-by: Jeff Godin <jgodin@tadl.org>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
5 years agoLP#1257264: Use the built-in JSON-y test for bools
Mike Rylander [Tue, 3 Dec 2013 14:57:39 +0000 (09:57 -0500)]
LP#1257264: Use the built-in JSON-y test for bools

This removes a dependency on internal details of JSON::XS's
implementation of Boolean types which changed with the release
of JSON::XS 3.0.

Signed-off-by: Mike Rylander <mrylander@gmail.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Jeff Godin <jgodin@tadl.org>
5 years agoLP#1257264: make test cases for JSON::XS Boolean-ness more generic
Galen Charlton [Tue, 3 Dec 2013 17:43:54 +0000 (09:43 -0800)]
LP#1257264: make test cases for JSON::XS Boolean-ness more generic

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Jeff Godin <jgodin@tadl.org>
5 years agoAdd some additional boolean-related JSON tests
Jeff Godin [Tue, 3 Dec 2013 18:52:39 +0000 (13:52 -0500)]
Add some additional boolean-related JSON tests

Add some additional boolean-related JSON tests, enable use strict /
use warnings for JSON tests.

Signed-off-by: Jeff Godin <jgodin@tadl.org>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>