This repository has been archived by the owner on Sep 4, 2024. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
serde_json::from_reader requires that the other side close the socket for it to complete. Therefore we were forcing the server to always close streams to us, never reusing any single sockets. In fact, it was more a burden because after the first request for every request we would have to call the request() function twice: once for it to notice that the socket was closed on the other side (receiving an EOF on line 202 and confusingly returning an error telling the HTTP header was malformed).
Instead, get back to what was previously used in previous versions: read a line from the stream (using '\n' to mark the end of the request instead of a connection close) and parse it afterward.
From https://docs.rs/serde_json/latest/serde_json/fn.from_reader.html: