paypal/kappa — pull request #33 by tlivings (2014-02-05 19:14:06+00:00)
Title: Fixup tarball rewrites to take into account client's requested host

Previously we were rewriting tarball urls with `protocol`, `host`, `port` info that was not necessarily accurate. `protocol` was coming from original tarball url, `host` from `vhost` or internal `server.info` host, and `port` from `server.info`.

This change makes it the same information as the original request from client. i.e:

- `protocol` - the protocol client requested (comes from `x-forwarded-proto` when a LB or ssl terminator is in place).
- `hostname` - comes from `request.info.host`, which reflect the `host` header, stripped of `port`.
- `port` - stripped out from `host` above.