proxy mode, pt 2

The ReverseProxy code from the standard library doesn't actually
give us the control that we want. Pull it down and rip out what
we don't need, adding tests in the process.
An argument could be made both ways. Depending on how liberal your interpretation of "received an invalid response", it could encompass all failed HTTP requests. The other reasonable option here is a 500, which is basically the catchall "something bad happened" status code. A 502 gives the client a much bigger hint as to what's going on, even if it doesn't communicate 100% what's going on.