OpenSRF.git
12 years agoremoved unnecessary log line
erickson [Fri, 30 Nov 2007 16:28:39 +0000 (16:28 +0000)]
removed unnecessary log line

git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1154 9efc2488-bf62-4759-914b-345cdb29e865

12 years agoparsing requests so the translator can return OK and stop waiting on DISCONNECT messa...
erickson [Fri, 30 Nov 2007 16:27:28 +0000 (16:27 +0000)]
parsing requests so the translator can return OK and stop waiting on DISCONNECT messages.  added some debug logging.

git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1153 9efc2488-bf62-4759-914b-345cdb29e865

12 years agoremoving confusing dead code
miker [Fri, 30 Nov 2007 02:48:23 +0000 (02:48 +0000)]
removing confusing dead code

git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1152 9efc2488-bf62-4759-914b-345cdb29e865

12 years agoadded cache delete. updated some logging
erickson [Thu, 29 Nov 2007 16:43:02 +0000 (16:43 +0000)]
added cache delete.  updated some logging

git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1151 9efc2488-bf62-4759-914b-345cdb29e865

12 years agoadded the proof-of-concept http multipart translation code. still needs request...
erickson [Thu, 29 Nov 2007 16:42:04 +0000 (16:42 +0000)]
added the proof-of-concept http multipart translation code.  still needs request parsing to handle client disconnect messages and more testing with non-multipart

git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1150 9efc2488-bf62-4759-914b-345cdb29e865

12 years agoadded a default timeout cache setting
erickson [Tue, 27 Nov 2007 22:39:45 +0000 (22:39 +0000)]
added a default timeout cache setting

git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1149 9efc2488-bf62-4759-914b-345cdb29e865

12 years agoadding a caching api. requires memcache: ftp://ftp.tummy.com/pub/python-memcached/
erickson [Tue, 27 Nov 2007 20:07:36 +0000 (20:07 +0000)]
adding a caching api.  requires memcache: ftp://ftp.tummy.com/pub/python-memcached/

git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1148 9efc2488-bf62-4759-914b-345cdb29e865

12 years agoadded error message. re-tabbed to 4 spaces
erickson [Mon, 26 Nov 2007 22:35:42 +0000 (22:35 +0000)]
added error message. re-tabbed to 4 spaces

git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1147 9efc2488-bf62-4759-914b-345cdb29e865

12 years agoremoved debug statement
erickson [Mon, 26 Nov 2007 22:35:03 +0000 (22:35 +0000)]
removed debug statement

git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1146 9efc2488-bf62-4759-914b-345cdb29e865

12 years agoin addition to pushing the received message to the callback, we return the message...
erickson [Mon, 26 Nov 2007 22:27:50 +0000 (22:27 +0000)]
in addition to pushing the received message to the callback, we return the message from recv()

git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1145 9efc2488-bf62-4759-914b-345cdb29e865

12 years agoPatch from Scott McKellar:
miker [Mon, 26 Nov 2007 18:20:40 +0000 (18:20 +0000)]
Patch from Scott McKellar:

1. Shift toward a camel case style of identifiers.

2. Make functions static when they are not called from elsewhere.

3. Populate all members in newly-allocated structs.

4. Add a couple of consts.

Details:

1. We have two redundant typdefs. I replaced all references to the
lower_case_with_underscores version with references to the camelCase
versions (while keeping the obsolescent typedefs themselves):

   osrf_app_request ==> osrfAppRequest
   osrf_app_session ==> osrfAppSession

2. I deleted the prototypes of two functions that are nowhere
referenced or even defined:

   _osrf_app_session_get_request()
   _osrf_app_session_push_request()

3. I eliminated osrf_app_session_make_locale_req(), replacing it
with the equivalent osrfAppSessionMakeLocaleRequest function.  No
other file references the former.

4. I made the following functions static, and removed their
prototypes from the header, since none is referenced from any other
file:

   osrfAppSessionMakeLocaleRequest()
   osrfAppSessionSendBatch()
   all remaining functions with a leading underscore

5. I explicitly initialized the stateless and session_locale members
of osrfAppSession.

6. I added the const qualifier to a couple of parameters of
osrfAppSessionStatus().

git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1144 9efc2488-bf62-4759-914b-345cdb29e865

12 years agoremoving out-of-date jabber2d patches
erickson [Mon, 26 Nov 2007 15:13:01 +0000 (15:13 +0000)]
removing out-of-date jabber2d patches

git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1143 9efc2488-bf62-4759-914b-345cdb29e865

12 years agoadded ability to parse attributes and elements containing no children or data to...
erickson [Mon, 26 Nov 2007 13:33:10 +0000 (13:33 +0000)]
added ability to parse attributes and elements containing no children or data to the xml2object parser

git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1142 9efc2488-bf62-4759-914b-345cdb29e865

12 years agoreplaced str() calls with unicode()
erickson [Wed, 21 Nov 2007 22:01:42 +0000 (22:01 +0000)]
replaced str() calls with unicode()

git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1141 9efc2488-bf62-4759-914b-345cdb29e865

12 years agorepaired variable name
erickson [Wed, 21 Nov 2007 20:48:50 +0000 (20:48 +0000)]
repaired variable name

git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1140 9efc2488-bf62-4759-914b-345cdb29e865

12 years agoremoving some debug logging
miker [Tue, 20 Nov 2007 21:43:12 +0000 (21:43 +0000)]
removing some debug logging

git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1139 9efc2488-bf62-4759-914b-345cdb29e865

12 years agopropogate locale from server to client
miker [Tue, 20 Nov 2007 20:22:22 +0000 (20:22 +0000)]
propogate locale from server to client

git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1138 9efc2488-bf62-4759-914b-345cdb29e865

12 years agothinko, sorry
miker [Tue, 20 Nov 2007 20:04:28 +0000 (20:04 +0000)]
thinko, sorry

git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1137 9efc2488-bf62-4759-914b-345cdb29e865

12 years agoCleaned up exception messages so they will not be bloated with newlines
erickson [Tue, 20 Nov 2007 20:01:13 +0000 (20:01 +0000)]
Cleaned up exception messages so they will not be bloated with newlines
(which are rendered as '\n' in syslog and local apache logs, anyway) and
layers of "Mess:" tags.  Logging the ISO timestamp instead of the default
output of Perl's localtime()

git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1136 9efc2488-bf62-4759-914b-345cdb29e865

12 years agodebug logging
miker [Tue, 20 Nov 2007 20:00:53 +0000 (20:00 +0000)]
debug logging

git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1135 9efc2488-bf62-4759-914b-345cdb29e865

12 years agothinko, sorry
miker [Tue, 20 Nov 2007 19:51:17 +0000 (19:51 +0000)]
thinko, sorry

git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1134 9efc2488-bf62-4759-914b-345cdb29e865

12 years agostill working on the perl locale stuff
miker [Tue, 20 Nov 2007 19:49:03 +0000 (19:49 +0000)]
still working on the perl locale stuff

git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1133 9efc2488-bf62-4759-914b-345cdb29e865

12 years agofor-loop initial declaration issue; realigned some const-ification
miker [Tue, 20 Nov 2007 18:57:16 +0000 (18:57 +0000)]
for-loop initial declaration issue; realigned some const-ification

git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1132 9efc2488-bf62-4759-914b-345cdb29e865

12 years agopushing locale through in the perl
miker [Tue, 20 Nov 2007 18:46:25 +0000 (18:46 +0000)]
pushing locale through in the perl

git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1131 9efc2488-bf62-4759-914b-345cdb29e865

12 years agouber-patch from Scott McKellar cleans up large amounts of const-correctness issues...
miker [Mon, 19 Nov 2007 03:19:09 +0000 (03:19 +0000)]
uber-patch from Scott McKellar cleans up large amounts of const-correctness issues and static-ifies several areas of unused header-based code; several cleanups to use simpler APIs such as buffer_release

git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1130 9efc2488-bf62-4759-914b-345cdb29e865

12 years agoremoved hard-coded reference to python 2.4
erickson [Thu, 15 Nov 2007 16:21:32 +0000 (16:21 +0000)]
removed hard-coded reference to python 2.4

git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1129 9efc2488-bf62-4759-914b-345cdb29e865

12 years agoadded ability to log to a file
erickson [Mon, 12 Nov 2007 22:43:06 +0000 (22:43 +0000)]
added ability to log to a file

git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1128 9efc2488-bf62-4759-914b-345cdb29e865

12 years agochanged imports to be fully qualified
erickson [Sun, 11 Nov 2007 17:42:09 +0000 (17:42 +0000)]
changed imports to be fully qualified

git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1127 9efc2488-bf62-4759-914b-345cdb29e865

12 years agoAnd let's not double-log messages. Sigh.
dbs [Thu, 8 Nov 2007 20:39:18 +0000 (20:39 +0000)]
And let's not double-log messages. Sigh.

git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1126 9efc2488-bf62-4759-914b-345cdb29e865

12 years agoFormat the date and time with leading zeroes to be easy on the eyes, and easier to...
dbs [Thu, 8 Nov 2007 20:36:16 +0000 (20:36 +0000)]
Format the date and time with leading zeroes to be easy on the eyes, and easier to parse.

git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1125 9efc2488-bf62-4759-914b-345cdb29e865

12 years agoCorrect name of prototype for osrf_message_get_last_locale()
dbs [Tue, 6 Nov 2007 22:45:19 +0000 (22:45 +0000)]
Correct name of prototype for osrf_message_get_last_locale()

git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1124 9efc2488-bf62-4759-914b-345cdb29e865

12 years agoEnable srfsh.py to load with the standard .srfsh.xml (no plugins)
dbs [Tue, 6 Nov 2007 19:33:49 +0000 (19:33 +0000)]
Enable srfsh.py to load with the standard .srfsh.xml (no plugins)

git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1123 9efc2488-bf62-4759-914b-345cdb29e865

12 years agomake the perl local support match the C version
miker [Tue, 6 Nov 2007 14:40:08 +0000 (14:40 +0000)]
make the perl local support match the C version

git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1122 9efc2488-bf62-4759-914b-345cdb29e865

12 years agoAvoid an "undefined variable" Perl warning when we receive no parameters.
dbs [Sun, 4 Nov 2007 11:38:50 +0000 (11:38 +0000)]
Avoid an "undefined variable" Perl warning when we receive no parameters.

git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1120 9efc2488-bf62-4759-914b-345cdb29e865

12 years agoConvert a few routine log messages from error to info level.
dbs [Sat, 3 Nov 2007 17:52:29 +0000 (17:52 +0000)]
Convert a few routine log messages from error to info level.

git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1119 9efc2488-bf62-4759-914b-345cdb29e865

13 years agoMake Logger a little more robust by setting a default loglevel
dbs [Tue, 30 Oct 2007 22:26:11 +0000 (22:26 +0000)]
Make Logger a little more robust by setting a default loglevel
and ensuring that we don't try to regex an undefined value.

git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1118 9efc2488-bf62-4759-914b-345cdb29e865

13 years agofixed infinite loop bug by hopping out of the loop if timeout gets down to 0, but...
erickson [Mon, 29 Oct 2007 12:23:31 +0000 (12:23 +0000)]
fixed infinite loop bug by hopping out of the loop if timeout gets down to 0, but the code still allows the the loop to occur once if timeout is initially 0

git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1117 9efc2488-bf62-4759-914b-345cdb29e865

13 years agoPatch from Scott McKellar to provide more const correctness to functions using osrfJS...
miker [Sat, 27 Oct 2007 01:48:03 +0000 (01:48 +0000)]
Patch from Scott McKellar to provide more const correctness to functions using osrfJSON objects

git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1116 9efc2488-bf62-4759-914b-345cdb29e865

13 years agoAdd a top-level javascript-install target
dbs [Thu, 25 Oct 2007 15:50:39 +0000 (15:50 +0000)]
Add a top-level javascript-install target

git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1115 9efc2488-bf62-4759-914b-345cdb29e865

13 years agoPatch from Scott McKellar to increase const correctness in the JSON parser.
miker [Thu, 25 Oct 2007 12:20:16 +0000 (12:20 +0000)]
Patch from Scott McKellar to increase const correctness in the JSON parser.

Also made the top level legacy_jsonParseString[Fmt] API const-correct, though this is removed within those wrapper calls to avoid potentially breaking the legacy code.

git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1114 9efc2488-bf62-4759-914b-345cdb29e865

13 years agoPatch from Scott McKellar to clean up some const qualification and initialize a point...
miker [Thu, 25 Oct 2007 12:04:05 +0000 (12:04 +0000)]
Patch from Scott McKellar to clean up some const qualification and initialize a pointer to NULL.

git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1113 9efc2488-bf62-4759-914b-345cdb29e865

13 years agoadded new constructor to build from class hints
erickson [Tue, 23 Oct 2007 15:36:45 +0000 (15:36 +0000)]
added new constructor to build from class hints

git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1112 9efc2488-bf62-4759-914b-345cdb29e865

13 years agoPatches from Scott McKellar covering:
miker [Fri, 19 Oct 2007 23:43:59 +0000 (23:43 +0000)]
Patches from Scott McKellar covering:

1. Eliminating a const-removing cast from jsonObjectToJSON().  This
cast is no longer necessary now that a recent patch has changed the
signature of jsonObjectEncodeClass().

2. Moving the JSON_INIT_CLEAR macro out of the header file and into
the implementation file.  No other file invokes this macro -- nor
could it, since the macro refers to two static functions within
osrf_json_object.c.  Strictly speaking another file could provide
other functions with the same signatures, but I doubt that any such
usage was ever intended.

3. Adds some sanity checking to prevent undefined behavior when
a floating point payload is not representable as an int.

4. Streamlines the serialization of hashes and arrays by
eliminating a layer of allocation and deallocation.

git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1111 9efc2488-bf62-4759-914b-345cdb29e865

13 years agoDeliberately break applications relying on pre-OpenSRF 1.0 behaviour.
dbs [Thu, 18 Oct 2007 03:08:38 +0000 (03:08 +0000)]
Deliberately break applications relying on pre-OpenSRF 1.0 behaviour.
JSON_v0.js represents "legacy" JSON format, while JSON_v1.js represents "modern" JSON format.

git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1110 9efc2488-bf62-4759-914b-345cdb29e865

13 years agoStart installing the Python libraries as well.
dbs [Thu, 18 Oct 2007 02:38:51 +0000 (02:38 +0000)]
Start installing the Python libraries as well.
Destination directory is named python25 because
Python3000 is just around the corner...

git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1109 9efc2488-bf62-4759-914b-345cdb29e865

13 years agoreturning explicit true/false on data received
erickson [Thu, 18 Oct 2007 02:22:22 +0000 (02:22 +0000)]
returning explicit true/false on data received

git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1108 9efc2488-bf62-4759-914b-345cdb29e865

13 years agoInstall the JavaScript libraries into an OpenSRF library,
dbs [Thu, 18 Oct 2007 01:11:10 +0000 (01:11 +0000)]
Install the JavaScript libraries into an OpenSRF library,
in prepration for OpenSRF applications being able to use
one known good JavaScript library for OpenSRF communication.
(I'm looking at you, EG, and your two copies of JSON.js)

git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1107 9efc2488-bf62-4759-914b-345cdb29e865

13 years agoI'm pretty sure we want $log here, as in all the other calls.
dbs [Tue, 16 Oct 2007 03:58:05 +0000 (03:58 +0000)]
I'm pretty sure we want $log here, as in all the other calls.
Perhaps we can get rid of the $logger import in the header?

git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1106 9efc2488-bf62-4759-914b-345cdb29e865

13 years agoEnable -l flag to work without an argument
dbs [Wed, 10 Oct 2007 21:51:18 +0000 (21:51 +0000)]
Enable -l flag to work without an argument

git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1105 9efc2488-bf62-4759-914b-345cdb29e865

13 years agoMore typos, as I read through logs.
dbs [Wed, 10 Oct 2007 20:58:39 +0000 (20:58 +0000)]
More typos, as I read through logs.

git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1104 9efc2488-bf62-4759-914b-345cdb29e865

13 years agoadding -l for localhost support
miker [Wed, 10 Oct 2007 20:38:14 +0000 (20:38 +0000)]
adding -l for localhost support

git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1103 9efc2488-bf62-4759-914b-345cdb29e865

13 years agoAdd -D_LARGEFILE64_SOURCE flag to CGLAGS to avoid compile problems on 32-bit platforms.
dbs [Wed, 10 Oct 2007 20:10:19 +0000 (20:10 +0000)]
Add -D_LARGEFILE64_SOURCE flag to CGLAGS to avoid compile problems on 32-bit platforms.

git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1102 9efc2488-bf62-4759-914b-345cdb29e865

13 years agoFix some typos found while trying to improve osrf error messages.
dbs [Wed, 10 Oct 2007 18:47:42 +0000 (18:47 +0000)]
Fix some typos found while trying to improve osrf error messages.

git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1101 9efc2488-bf62-4759-914b-345cdb29e865

13 years agoprovide a warning-level default logger if none is defined
erickson [Fri, 5 Oct 2007 20:24:09 +0000 (20:24 +0000)]
provide a warning-level default logger if none is defined

git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1100 9efc2488-bf62-4759-914b-345cdb29e865

13 years agoPatch that:
miker [Mon, 1 Oct 2007 02:47:44 +0000 (02:47 +0000)]
Patch that:

1) Creates safe_calloc, suggested by Scott McKellar which includes
memset, as calloc does.  safe_malloc will eventually lose its call
to memset.

2) Creates a macro in utils.h called osrf_clearbuf which

 * under CLFAGS=-DNDEBUG fills the buffer with !s and a trailing nul
 * otherwise (currently) uses memset to fill with nuls

The secondary behavior should be changed to a no-op after no more
problems arise under NDEBUG mode.  I reversed the suggested semantics
because I'm not ready to completely break trunk.  To break everything
(AKA find where we should be providing a terminal nul) just compile
like this:

 $ CLFAGS=-DNDEBUG make clean all

3) replaces all memsets (excepting the ones in safe_?alloc) that act
on char bufs with said macro, so they can be spotted and improved to
deal with nul terminators where needed.  I didn't touch any memsets on
struct pointers.

4) made jid_get_*() from src/libopensrf/transport_message.c safe for
use with NDEBUG mode.  They were depending on the target buffer that
the caller passes in to be nul-filled (they use strncpy/memcpy which
don't guarantee terminal nul) -- now they provide their own terminal
nul.

git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1099 9efc2488-bf62-4759-914b-345cdb29e865

13 years agoBroad patch from Dan Scott to move towards better memory management:
miker [Sun, 30 Sep 2007 19:14:26 +0000 (19:14 +0000)]
Broad patch from Dan Scott to move towards better memory management:

 * bzero->memset (with sizeof) - except when followed immediately by
   snprintf(), in which case the call was deleted completely
 * sprintf->snprintf (with sizeof) - for the C99-guaranteed
   null-terminated string and avoidance of overwrites
 * fgets (with sizeof) - because in at least one case "len - 1" was
   being used for the length, even though fgets is defined to retrieve 1
   byte less than the requested length - so the code was effectively
   retrieving 2 bytes less than the allocated buffer
 * in 2 places in srfsh.c, increased buffer size by 1 to allow for
   null terminator
 * various typo fixes

git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1098 9efc2488-bf62-4759-914b-345cdb29e865

13 years agoPatch from Dan Scott to:
miker [Sun, 30 Sep 2007 18:53:17 +0000 (18:53 +0000)]
Patch from Dan Scott to:

1) fix typos and output alignment
2) include _LARGEFILE64_SOURCE in the makefile to make 32b linux happy

git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1097 9efc2488-bf62-4759-914b-345cdb29e865

13 years agoUse of const-correct osrfObjectGetKeyConst() from Scott McKellar:
miker [Sun, 30 Sep 2007 17:56:45 +0000 (17:56 +0000)]
Use of const-correct osrfObjectGetKeyConst() from Scott McKellar:

1. It replaces jsonObjectGetKey() with jsonObjectGetKeyConst().

2. It uses const pointers, instead of non-const pointers, to capture
the return values of jsonObjectGetIndex() and jsonObjectGetString().

git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1096 9efc2488-bf62-4759-914b-345cdb29e865

13 years agoContinued const-correctness improvement from Scott McKellar:
miker [Sun, 30 Sep 2007 17:54:25 +0000 (17:54 +0000)]
Continued const-correctness improvement from Scott McKellar:

1. I changed the signature of jsonObjectDecodeClass so that it accepts
a non-const pointer parameter.  Since it doesn't change the contents
of the jsonObject, there's no need to confine it to non-const
jsonObjects.

2. I replaced jsonObjectGetKey() with jsonObjectGetKeyConst().

3. In one spot I captured the return value of jsonObjectGetIndex()
with a const pointer instead of a non-const pointer.

git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1095 9efc2488-bf62-4759-914b-345cdb29e865

13 years agoPatch from Scott McKellar to improve const-correctness in srfsh:
miker [Sun, 30 Sep 2007 17:48:32 +0000 (17:48 +0000)]
Patch from Scott McKellar to improve const-correctness in srfsh:

This patch sprinkles a few const qualifiers over srfsh.c, and also
fixes a couple of things I stumbled across along the way.

The main purpose is to treat jsonObjects in a more const-correct
manner.  I introduced a new jsonObjectGetKeyConst function, and I
prepared for the day when jsonObjectGetString() returns a const
pointer instead of a non-const pointer.

This patch relies on a previous patch that defines the new
jsonObjectGetKeyConst function.

1. In handle_login() I changed hash to a const pointer, so that we
can assign the return value of jsonObjectGetString() to it.

2. Later in the same function, I rearranged the code a bit to ensure
that we always free a prior value of login_session before giving it
a new value.  The original code potentially leaks memory.

3. In the same area I changed authtoken to a const pointer.

4. In send_request() I eliminated an unnecessary test for the
non-nullness of omsg->_result_content, because we had just tested
it a few lines ago.

5. Also in send_request(): I introduced a layer of strdup() when
we get content from jsonObjectGetString().  This change concerns
more than just const-correctness.

The problem with the original code is that we get content sometimes
from jsonFormatString() and sometimes from jsonObjectGetString().
The former returns a malloc'ed buffer, which we need to free.  The
latter returns a pointer to a buffer owned by a jsonObject, and we
should not free it.  As it happens, we do free it.  If we got the
string from jsonObjectGetString(), then we leave the jsonObject with
an invalid pointer inside it.  If we free the jsonObject later, we'll
try to free that same buffer a second time.  Oops.

Another issue is that jsonObjectGetString() can return NULL, which
we should handle more carefully.

These problems occur in two different places in the same function.
I fixed them both the same way, with some differences in the details.

git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1094 9efc2488-bf62-4759-914b-345cdb29e865

13 years agoPatch from Scott McKellar which introduces a const-accepting and -returning
miker [Sun, 30 Sep 2007 14:03:19 +0000 (14:03 +0000)]
Patch from Scott McKellar which introduces a const-accepting and -returning
version of jsonObjectGetKey.  This is the first step in a plan to push
const-correctness on the OpenSRF stack when dealing with complex objects.  The
hope is that this will increase the utility of compile-time checks in new
client code.

git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1093 9efc2488-bf62-4759-914b-345cdb29e865

13 years agoadded some more rigorous checking of session connected-ness and some logging
erickson [Wed, 26 Sep 2007 15:17:36 +0000 (15:17 +0000)]
added some more rigorous checking of session connected-ness and some logging

git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1092 9efc2488-bf62-4759-914b-345cdb29e865

13 years agorepaired logic bug which left the parser state in the JSON_STATE_IN_KEY
erickson [Mon, 24 Sep 2007 02:43:04 +0000 (02:43 +0000)]
repaired logic bug which left the parser state in the JSON_STATE_IN_KEY
state after exiting from an empty JSON object.

git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1091 9efc2488-bf62-4759-914b-345cdb29e865

13 years agoadded cache cleanup code
erickson [Fri, 21 Sep 2007 16:12:07 +0000 (16:12 +0000)]
added cache cleanup code

git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1090 9efc2488-bf62-4759-914b-345cdb29e865

13 years agoPatch from Scott McKellar to log service name on child process startup and exit,...
miker [Sun, 2 Sep 2007 17:36:15 +0000 (17:36 +0000)]
Patch from Scott McKellar to log service name on child process startup and exit, along with more exit status info

git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1089 9efc2488-bf62-4759-914b-345cdb29e865

13 years agoadded an atomic method for simple, one-off calls
erickson [Thu, 30 Aug 2007 18:56:46 +0000 (18:56 +0000)]
added an atomic method for simple, one-off calls

git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1088 9efc2488-bf62-4759-914b-345cdb29e865

13 years agopatch from Scott McKellar to examine and report the exit status of child processes...
miker [Tue, 28 Aug 2007 00:29:22 +0000 (00:29 +0000)]
patch from Scott McKellar to examine and report the exit status of child processes as they shut down

git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1087 9efc2488-bf62-4759-914b-345cdb29e865

13 years agopatch from Scott McKellar to use const pointer qualification during object serialization
miker [Tue, 28 Aug 2007 00:28:22 +0000 (00:28 +0000)]
patch from Scott McKellar to use const pointer qualification during object serialization

git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1086 9efc2488-bf62-4759-914b-345cdb29e865

13 years agoadding thread name to the log output
erickson [Sun, 19 Aug 2007 13:54:43 +0000 (13:54 +0000)]
adding thread name to the log output

git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1085 9efc2488-bf62-4759-914b-345cdb29e865

13 years agosafer extraction of data from the in-memory object
erickson [Sun, 19 Aug 2007 13:52:25 +0000 (13:52 +0000)]
safer extraction of data from the in-memory object

git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1084 9efc2488-bf62-4759-914b-345cdb29e865

13 years agofixed import statement
erickson [Sun, 19 Aug 2007 12:59:36 +0000 (12:59 +0000)]
fixed import statement

git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1083 9efc2488-bf62-4759-914b-345cdb29e865

13 years agonot creating new handle if the current thread already has one. changed resource...
erickson [Sun, 19 Aug 2007 01:33:21 +0000 (01:33 +0000)]
not creating new handle if the current thread already has one.  changed resource layout

git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1082 9efc2488-bf62-4759-914b-345cdb29e865

13 years agoadded support for multi-threaded client interactions. much like the java lib, each...
erickson [Sun, 19 Aug 2007 01:16:02 +0000 (01:16 +0000)]
added support for multi-threaded client interactions.  much like the java lib, each thread is allowed 1 jabber connection, as opposed to 1 process-wide jabber connection.  also did some re-tabbing to force 4-space tabs (not raw tabs) - more of those to come

git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1081 9efc2488-bf62-4759-914b-345cdb29e865

13 years agoupdated to work with opensrf.jar with doing 'make run'
erickson [Fri, 17 Aug 2007 21:57:31 +0000 (21:57 +0000)]
updated to work with opensrf.jar with doing 'make run'

git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1080 9efc2488-bf62-4759-914b-345cdb29e865

13 years agoadded multi-threaded client support to the opensrf network/xmpp layer
erickson [Fri, 17 Aug 2007 21:57:16 +0000 (21:57 +0000)]
added multi-threaded client support to the opensrf network/xmpp layer
this is all managed below the covers so that clients can continue to safely
use bootstrapClient and will all "just work"

we now allow 1 xmpp connection per thread, as opposed to 1 per process.

added a test module

git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1079 9efc2488-bf62-4759-914b-345cdb29e865

13 years agominor layout change. calling notifyAll to ensure all threads are notified
erickson [Fri, 17 Aug 2007 21:50:01 +0000 (21:50 +0000)]
minor layout change.  calling notifyAll to ensure all threads are notified

git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1078 9efc2488-bf62-4759-914b-345cdb29e865

13 years agofor now, we reference the wstx stax implementation directly to resolve class loader...
erickson [Tue, 14 Aug 2007 19:08:38 +0000 (19:08 +0000)]
for now, we reference the wstx stax implementation directly to resolve class loader issues

git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1077 9efc2488-bf62-4759-914b-345cdb29e865

13 years agoPatch from Scott McKellar to protect SHA-1 against an off-by-one bug
miker [Tue, 7 Aug 2007 15:28:44 +0000 (15:28 +0000)]
Patch from Scott McKellar to protect SHA-1 against an off-by-one bug

git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1076 9efc2488-bf62-4759-914b-345cdb29e865

13 years agoPatch from Dan Scott to remove mentions of open-ils from the example config file
miker [Tue, 7 Aug 2007 15:15:08 +0000 (15:15 +0000)]
Patch from Dan Scott to remove mentions of open-ils from the example config file

git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1075 9efc2488-bf62-4759-914b-345cdb29e865

13 years agoadding new JSON parsing JS code, for wrapped class objects
erickson [Fri, 3 Aug 2007 19:31:12 +0000 (19:31 +0000)]
adding new JSON parsing JS code, for wrapped class objects

git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1074 9efc2488-bf62-4759-914b-345cdb29e865

13 years agoadding basic logging api with a filelogger version and a test module
erickson [Fri, 3 Aug 2007 15:49:27 +0000 (15:49 +0000)]
adding basic logging api with a filelogger version and a test module

git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1073 9efc2488-bf62-4759-914b-345cdb29e865

13 years agomore locale cleanup
miker [Fri, 3 Aug 2007 02:57:57 +0000 (02:57 +0000)]
more locale cleanup

git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1072 9efc2488-bf62-4759-914b-345cdb29e865

13 years agoun-crazy-fy current_locale
miker [Fri, 3 Aug 2007 02:30:45 +0000 (02:30 +0000)]
un-crazy-fy current_locale

git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1071 9efc2488-bf62-4759-914b-345cdb29e865

13 years agoformatting ... they are all tabs! ;)
miker [Fri, 3 Aug 2007 02:20:56 +0000 (02:20 +0000)]
formatting ... they are all tabs! ;)

git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1070 9efc2488-bf62-4759-914b-345cdb29e865

13 years agoarg ... left out one minor fix
miker [Fri, 3 Aug 2007 02:19:32 +0000 (02:19 +0000)]
arg ... left out one minor fix

git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1069 9efc2488-bf62-4759-914b-345cdb29e865

13 years agoformatting fixes; protect against NULL apache setting
miker [Fri, 3 Aug 2007 02:19:02 +0000 (02:19 +0000)]
formatting fixes; protect against NULL apache setting

git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1068 9efc2488-bf62-4759-914b-345cdb29e865

13 years agounbreaking the perl session locale stuff
miker [Thu, 2 Aug 2007 03:03:35 +0000 (03:03 +0000)]
unbreaking the perl session locale stuff

git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1067 9efc2488-bf62-4759-914b-345cdb29e865

13 years agoinitial sender_locale support ... probably going to break stuff; also, patch from...
miker [Thu, 2 Aug 2007 02:49:53 +0000 (02:49 +0000)]
initial sender_locale support ... probably going to break stuff; also, patch from Scott McKellar to define some undefined behavior in an snprintf call

git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1066 9efc2488-bf62-4759-914b-345cdb29e865

13 years agoPatch from Scott McKellar to provide defined behavior when passing NULL to an sprintf
miker [Wed, 1 Aug 2007 14:40:39 +0000 (14:40 +0000)]
Patch from Scott McKellar to provide defined behavior when passing NULL to an sprintf

git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1065 9efc2488-bf62-4759-914b-345cdb29e865

13 years agosynchronizing the initial xmpp login to prevent thread race condition on authentication
erickson [Sat, 28 Jul 2007 17:41:32 +0000 (17:41 +0000)]
synchronizing the initial xmpp login to prevent thread race condition on authentication

git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1064 9efc2488-bf62-4759-914b-345cdb29e865

13 years agoadded shutdown call to cleanly disconnect from the opensrf network
erickson [Sat, 28 Jul 2007 17:38:26 +0000 (17:38 +0000)]
added shutdown call to cleanly disconnect from the opensrf network

git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1063 9efc2488-bf62-4759-914b-345cdb29e865

13 years agore-factored and cleaned up the registered class base-class object
erickson [Sat, 28 Jul 2007 15:32:18 +0000 (15:32 +0000)]
re-factored and cleaned up the registered class base-class object

git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1062 9efc2488-bf62-4759-914b-345cdb29e865

13 years agomaking sure error logs are logged to stderr even if syslogging is not an option ...
erickson [Thu, 26 Jul 2007 20:31:41 +0000 (20:31 +0000)]
making sure error logs are logged to stderr even if syslogging is not an option -- eventually, it should fall back to stderr logging like the C code does

git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1061 9efc2488-bf62-4759-914b-345cdb29e865

13 years agoadded a try/catch around the XML parsing and an error log
erickson [Thu, 26 Jul 2007 20:30:52 +0000 (20:30 +0000)]
added a try/catch around the XML parsing and an error log

git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1060 9efc2488-bf62-4759-914b-345cdb29e865

13 years agopython only evaluates default function param values once, so mutable types will alway...
erickson [Thu, 26 Jul 2007 20:30:16 +0000 (20:30 +0000)]
python only evaluates default function param values once, so mutable types will always be pointers to the original default val.  change the default osrfNetworkObject init function to None and setting default manually

git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1059 9efc2488-bf62-4759-914b-345cdb29e865

13 years agoPatch from Scott McKellar to address potential buffer overflow in router query inside...
miker [Tue, 24 Jul 2007 01:48:09 +0000 (01:48 +0000)]
Patch from Scott McKellar to address potential buffer overflow in router query inside srfsh.

git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1058 9efc2488-bf62-4759-914b-345cdb29e865

13 years agoPatch from Scott McKellar providing:
miker [Mon, 23 Jul 2007 17:44:46 +0000 (17:44 +0000)]
Patch from Scott McKellar providing:

1. In handle_print(), I added the ability to display the value of
raw_print.  If we can display pretty_print, we should be able to
display raw_print.

2. In a couple of places we display the value of login_session.
However if we aren't logged in, we end up passing NULL to printf(),
thereby invoking undefined behavior.  Apparently glibc responds by
printing "(null)".  I contrived explicitly to print "(none)" rather
than rely on glibc.

3. Since login_session is assigned from strdup() if not NULL, I added
a free() for it in a couple of places: one at the end of main(), and
one just before the assignment from strdup().

git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1057 9efc2488-bf62-4759-914b-345cdb29e865

13 years agoadded JSON gateway support
erickson [Sun, 22 Jul 2007 22:06:49 +0000 (22:06 +0000)]
added JSON gateway support

git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1056 9efc2488-bf62-4759-914b-345cdb29e865

13 years agoadded a bunch of comments to the test client to help explain the api
erickson [Sat, 21 Jul 2007 20:50:19 +0000 (20:50 +0000)]
added a bunch of comments to the test client to help explain the api
made the makefile 'run' command more verbose

git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1055 9efc2488-bf62-4759-914b-345cdb29e865

13 years agoressurrected the srfsh time command
erickson [Sat, 21 Jul 2007 20:46:08 +0000 (20:46 +0000)]
ressurrected the srfsh time command

git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1054 9efc2488-bf62-4759-914b-345cdb29e865