Fix a segfault when signUp through the batch mechanism - Issue#91

The signUp handler is the only exception from all the other handlers
which return a copy of some node in the global DOM tree. Such copy
will have no connection with any XML parser dictionary at all and
they can be safely released along with another temporary document
created for response purpose.

When the signUp handler is directly invoked, the node from the input
document which manipulates a XML parser dictionary is directly returned.
In order not to interfere with the dictionary, obix_server_reply_object
will reference it properly.

Unfortunately, this won't work if the signUp handler is invoked via
the batch mechanism, because the input node is not added as the root
node of the temporary document but as children of the batchOut contract,
consequently obix_server_reply_object could not identify the usage
of a dictionary.

To address this, an extra copy is made before re-parenting the returned
node from a handler into the batchOut contract. If it has an owner
document which further takes advantage of a dictionary, it will be copied
so as to de-associate from the dictionary properly.

Signed-off-by: Qingtao Cao <harry.cao@nextdc.com>
Prevent recursive batch invocation - Issue#95

If the requested URI of a sub batch command points ot the batch facility
itself, return error code instead of invoking batch recursively. Otherwise
this could be a security hole when millions of batch commands are nested
together which can quickly consume the stack memory of oBIX server thread
answering such batch request.
Enable handlers to be redirected to via the batch mechanism

Also fixing Issue#94 and #98

If handlers are directly invoked through the GET/PUT/POST methods,
the requested URI is recorded in the obix_request_t structure. However,
if handlers are invoked via the batch mechanism, the requested URI is
always "/obix/batch" and the URI for the specific facility needed is
is specified by the "val" attribute of a batch command in the batchIn
contract.

To this end, handlers should take an extra "overrideUri" parameter to
manipulate the redirected-to URI in the batch request.

It's worthwhile to mention that not all handlers can be invoked via
the batch facility, for example, watch.pollChanges handler and history
handlers compete against the current server thread handling the batchIn
request on sending responses through the same FCGI request independently.
Worse still, the watch.pollChanges handler will race to release the FCGI
request resulting in segfault when the current server thread tries to
send back batchOut contract. Therefore they should not be allowed to be
raised through the batch mechanism.

Last but not least, remove redundant function calls in batch.c and perform
sanity checks on the redirected-to URI to prevent malicious access to the
root node of the global DOM tree.
Provide document for the batch facility

Provide the docs/BATCH.md file to highlight the attention that
oBIX clients should pay to when using the batch facility
Disable CXX compiler checking in CMake

The oBIX project is a C language project only therefore there is no
need for CMake to check the sanity of a CXX compiler. To this end,
the language should be explicitly specified along with the project
name
Initialise local pointers in history.Get handler - Issue#103

In Release version the the local pointers happen to not being initialised
to NULL at all, if the input document is malformed and contains no href
at all, the history.Get handler segfaults when it tries to free a wild
pointer
Fix a illegal memory access in link_pathname API - Issue#104

The link_pathname() API assembles a list of substrings such as
root, parent, filename and suffix into one. It will insert or
remove extra slashes between root and parent, or between parent
and filename if needed to ensure there is one and only one slash
as delimiter among them.

The root parameter is allowed to be a single slash, however, if
the parent argument equals to "/", it is skipped over but the
slash_followed() will return zero for the empty string and
consequently, an extra "/" is appended. However, this unnecessary
slash has not be taken into account when calculating the length
of the result string, resulting in illegal write attempt when
appending the rest of components.
Cosmetic changes on comments of Listener.param

To mention a special case to manipulate param == "/" to request to
have the entire device monitored when registering a listener for a
sub node.
Rename "device_href" config settings to "parent_href"

Rename the device_href config settings in MGATE Adaptor to
parent_href so as to conform with the convention adopted in
other adaptors.
Cosmetic fixes for comments in obix_http.c and obix_client.c

Improve comment or fix typo in comment
Add comments in tests/scripts/batch_in.xml about faulty requests

Add comments for batch commands that are inviting error contracts
returned in the batchOut contract.
Update the oBIX Deep-Dive Document with content about client side APIs

Provide a new chapter about oBIX client side core data strutures and
design concepts adopted, in particular, what kind of race conditions
have been dealt with.
Merge pull request #101 from Qingtao-Cao/devel

Improve batch mechanism - 3rd try

There seems to be no more comments in the past 2 weeks, close this PR so as to move forward.