rpc: Prevent easy memory exhaustion attack

Allocate memory for POST message data only as bytes come in, instead of
all at once at the beginning.

Fixes #4343.
Merge pull request #4373

2ec5a3d rpc: Prevent easy memory exhaustion attack (Wladimir J. van der Laan)