Fixed no response bug when adding document with invalid xml #14
No reviewers
Labels
No labels
dependencies
javascript
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
quodatum/basex-node!14
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "master"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
When adding/replacing a document containing invalid xml the request would timeout without ever calling the callback method.
In debug mode I could see that the database was returning:
S1<<
'"..." (Line 1): The markup in the document preceding the root element must be well-formed.\u0000\u0001'
This would end up in the else statement in parser2 on line 173 if index.js which would just set the value of self.parser2part without returning a value. This would mean that the parser2 function call would implicitly return undefined which would break out of the while loop in onData (line 106) without ever calling the callback.
This would cause my application hang while waiting for a response and any subsequent calls to the database client to behave unpredictably.
My solution was to return an error response from parser2 with the 'info' field set to 'r.result' so that the callback function would get called from onData with the appropriate parameters.
I added a test case and all tests are passing.
Sorry about reformatting the code a bit. I needed some whitespace in there to read the code more easily.
Hi Jesse,
Thanks for this. I will merge it. And try to improve the code formating at the same time.
Thanks, Andy.
On Apr 3, 2014, at 3:18 PM, Andy Bunce notifications@github.com wrote:
I believe this is fixed in 0.6.3. The problem was that I was expecting the error response to look like
{partial result} {error} \1(and had no tests to check that it actually was :-(). In fact it seems it is just{error} \1http://docs.basex.org/wiki/Server_Protocol
I did not go with your pull as I made a number of other changes, hopefully improvements.
Thanks for reporting it. Streaming is still on my todo list
Ok. I will close the pull request and verify the fix from the main repo.
Pull request closed