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.