-
Notifications
You must be signed in to change notification settings - Fork 99
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reading past end of JSON data in a stream #239
Comments
We should put back any characters we are eating. Is there a reason |
For one thing, (The peek implementation looked like it might hurt performance a lot, also, at least one of the methods, that does a try / finally and saves / restores the position in the stream, after reading a single byte) |
What I mean is, is there a reason why |
I'm not sure why it was left unexported in master, but at least there it is better supported (instead of just 2 methods, |
You'll likely also run into trouble with wrappers like To me having a |
One character (really, 1 byte) look-ahead is all that the JSON format needs, and that is only for numbers (everything else is terminated by a byte that is known in advance, i.e. |
I hit this bug today while accidentally reading some SOAP responses. Having the response wiped while doing a JSON read feels like a bug. In this example the original string is preserved, but in my debugging session, I was dealing with the array output initially not a string.
Basically, reading off the end of the array causes the array to get dropped. I would rather it not drop the array. It looks like this thread here is related. |
How is this related to
|
While investigating an issue with my changes for better performance and to fix numeric parsing issues, I realized that parsing a number can "eat" the next character in a stream.
The way that the
async.jl
unit test works, by writing out a stream of JSON values, and then reading them on another process, breaks if there is not another character to separate the values, and just a number is being read.I attempted to fix this using
Base.peek
, however on v0.6.2, it doesn't work for the typeTCPStream
.I'm not sure what the behavior of a similar test in JavaScript or Python would be.
The text was updated successfully, but these errors were encountered: