Improvements to HTTP/S-RPC server (RIPD-489, RIPD-533)

A large rewrite
Probably not. Not sure if it makes a difference though.