RPCClient: check HTTP status code for errors also when streaming
To that end, refactor HTTP status checking logic so that it is reused in various places.
As part of this we also strengthen the unpickling logic.
Migrated from D2266 (view on Phabricator)